Ticket #2523: VULCAN_5836.py

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