1 | #!/usr/bin/env python |
---|
2 | import os |
---|
3 | from MantidFramework import mtd |
---|
4 | mtd.initialise() |
---|
5 | import datetime |
---|
6 | starttime = datetime.datetime.now() |
---|
7 | |
---|
8 | wksp = "VULCAN_5836" |
---|
9 | workdir = "./" |
---|
10 | nxsdir = "./" |
---|
11 | peakpos = 1.3823 |
---|
12 | dstep =-0.002 |
---|
13 | dmin = 0.2 |
---|
14 | dmax = 10.0 |
---|
15 | |
---|
16 | peakmin = peakpos-0.1 |
---|
17 | peakmax = peakpos+0.1 |
---|
18 | |
---|
19 | # Load event file for East and West detectors |
---|
20 | LoadSNSEventNexus(Filename=nxsdir+wksp+"_event.nxs", OutputWorkspace=wksp) |
---|
21 | # Sort output events |
---|
22 | Sort(InputWorkspace=wksp) |
---|
23 | |
---|
24 | # Remove old calibration files |
---|
25 | cmd = "rm "+workdir+wksp+".cal*" |
---|
26 | os.system(cmd) |
---|
27 | # Add detector groups to calibration file |
---|
28 | CreateCalFileByNames(InstrumentWorkspace=wksp, GroupingFileName=workdir+wksp+".cal", |
---|
29 | GroupNames="bank21,bank22,bank23,bank26,bank27,bank28") |
---|
30 | #Optimize Detectors |
---|
31 | DspacemaptoCal(InputWorkspace=wksp, DspacemapFile="./pid_offset_vulcan_new.dat",CalibrationFile=workdir+wksp+".cal",FileType="VULCAN-ASCII") |
---|
32 | # Align detectors using new calibration file with offsets |
---|
33 | AlignDetectors(InputWorkspace=wksp, OutputWorkspace=wksp, |
---|
34 | CalibrationFile=workdir+wksp+".cal", VULCANDspacemapFile=True) |
---|
35 | # Diffraction focusing using new calibration file with offsets |
---|
36 | DiffractionFocussing(InputWorkspace=wksp, OutputWorkspace=wksp, |
---|
37 | GroupingFileName=workdir+wksp+".cal") |
---|
38 | # Rebin file with offsets |
---|
39 | Rebin(InputWorkspace=wksp, OutputWorkspace=wksp,Params=str(dmin)+","+str(dstep)+","+str(dmax)) |
---|
40 | #ConvertUnits(InputWorkspace=wksp, OutputWorkspace=wksp,Target="TOF") |
---|
41 | #NormaliseByCurrent(InputWorkspace=wksp, OutputWorkspace=wksp) |
---|
42 | #SaveSNSNexus(InputFilename=wksp+".nxs",InputWorkspace=wksp, OutputFilename=wksp+"_mantid.nxs", Compress=True) |
---|
43 | gl = plotSpectrum(wksp, [0,1,2,3,4,5]) |
---|
44 | l = gl.activeLayer() |
---|
45 | l.setAxisScale(Layer.Bottom, 0.95,1.35) |
---|
46 | |
---|
47 | |
---|
48 | elapsedtime = datetime.datetime.now() - starttime |
---|
49 | print "total time to run", str(elapsedtime) |
---|
50 | |
---|