Ticket #7167: process_data_new.py

File process_data_new.py, 4.4 KB (added by Peter Peterson, 7 years ago)
Line 
1
2folder = '/SNS/SNAP/IPTS-8561/shared/'
3
4
5if mtd.doesExist('cols')== False : CreateGroupingWorkspace(InstrumentName='SNAP',GroupDetectorsBy='Column',OutputWorkspace='cols')
6if mtd.doesExist('mask_edges')== False : LoadMask(Instrument='SNAP',InputFile=r'/SNS/SNAP/IPTS-8561/shared/mask_detectors.xml',OutputWorkspace='mask_edges')
7
8#Loading Vanadium Spectra Files
9
10
11runs = [12278]
12runs=range(12281,12317)+[12279]
13
14
15for run in runs:
16        print 'Processing run %s'%run
17        LoadEventNexus(Filename=r'SNAP_%s_event.nxs'%run,OutputWorkspace='SNAP_%s'%run,Precount='1',MonitorsAsEvents='1')       
18        MaskDetectors(Workspace='SNAP_%s'%run, MaskedWorkspace='mask_edges')
19        AddSampleLog(Workspace='SNAP_%s'%run,LogName='det_arc1',LogText='-50.75',LogType='Number Series')
20        LoadInstrument(Workspace='SNAP_%s'%run,InstrumentName='SNAP',RewriteSpectraMap='0')
21        AlignDetectors(InputWorkspace='SNAP_%s'%run, OutputWorkspace='SNAP_%s_d'%run,CalibrationFile=folder+'/SNAP_calibrate_d12276_2013_05_17.cal') 
22#       ConvertUnits(InputWorkspace='SNAP_%s'%run,OutputWorkspace='SNAP_%s_d'%run,Target='dSpacing')
23        Rebin(InputWorkspace='SNAP_%s_d'%run,OutputWorkspace='SNAP_%s_d'%run,Params='0.5,-0.004,8')
24        DiffractionFocussing(InputWorkspace='SNAP_%s_d'%run,OutputWorkspace='SNAP_%s_col'%run,GroupingWorkspace='cols',PreserveEvents='0')
25        SumSpectra(InputWorkspace='SNAP_%s_col'%run,OutputWorkspace='SNAP_%s_14'%run,ListOfWorkspaceIndices='0,1,2,3',IncludeMonitors='0')
26        SumSpectra(InputWorkspace='SNAP_%s_col'%run,OutputWorkspace='SNAP_%s_56'%run,ListOfWorkspaceIndices='4,5',IncludeMonitors='0')
27        ConjoinWorkspaces(InputWorkspace1='SNAP_%s_14'%run,InputWorkspace2='SNAP_%s_56'%run,CheckOverlapping='0')
28        ConvertUnits(InputWorkspace='SNAP_%s_col'%run,OutputWorkspace='SNAP_%s_col_tof'%run,Target='TOF',AlignBins='0')
29        ConvertUnits(InputWorkspace='SNAP_%s_14'%run,OutputWorkspace='SNAP_%s_14_tof'%run,Target='TOF',AlignBins='0')
30       
31#       ConvertToPointData(InputWorkspace='SNAP_%s_col'%run,OutputWorkspace='SNAP_%s_col'%run)
32        Divide(LHSWorkspace='SNAP_%s_col'%run,RHSWorkspace='SNAP_12278_col',OutputWorkspace='SNAP_%s_nor'%run)
33        ReplaceSpecialValues(InputWorkspace='SNAP_%s_nor'%run,OutputWorkspace='SNAP_%s_nor'%run,NaNValue='0',BigNumberThreshold='30')
34        SaveAscii(InputWorkspace='SNAP_%s_nor'%run, Filename=folder+'data/d_spacing/SNAP_%s_d.csv'%run)
35#       RemoveLogs(Workspace='SNAP_%s_col'%run)
36#       RemoveLogs(Workspace='SNAP_%s_nor'%run)
37       
38#       ConvertToPointData(InputWorkspace='SNAP_%s_14'%run,OutputWorkspace='SNAP_%s_14'%run)
39        Divide(LHSWorkspace='SNAP_%s_14'%run,RHSWorkspace='SNAP_12278_14',OutputWorkspace='SNAP_%s_nor_14'%run)
40        ReplaceSpecialValues(InputWorkspace='SNAP_%s_nor_14'%run,OutputWorkspace='SNAP_%s_nor_14'%run,NaNValue='0',BigNumberThreshold='30')
41        SaveAscii(InputWorkspace='SNAP_%s_nor_14'%run, Filename=folder+'data/d_spacing/SNAP_%s_d.csv'%run)
42#       RemoveLogs(Workspace='SNAP_%s_14'%run)
43#       RemoveLogs(Workspace='SNAP_%s_nor_14'%run)
44       
45#       ConvertToPointData(InputWorkspace='SNAP_%s_col_tof'%run,OutputWorkspace='SNAP_%s_col_tof'%run)
46        Divide(LHSWorkspace='SNAP_%s_col_tof'%run,RHSWorkspace='SNAP_12278_col_tof',OutputWorkspace='SNAP_%s_nor_tof'%run)
47        ReplaceSpecialValues(InputWorkspace='SNAP_%s_nor_tof'%run,OutputWorkspace='SNAP_%s_nor_tof'%run,NaNValue='0',BigNumberThreshold='30')
48        SaveGSS(InputWorkspace='SNAP_%s_nor_tof'%run,Filename=folder +'data/gsas/SNAP_%s.gsa'%run, Format = 'SLOG',SplitFiles='False')
49        SaveFocusedXYE(InputWorkspace='SNAP_%s_nor_tof'%run,Filename=folder +'data/fullprof/SNAP_%s.dat'%run,SplitFiles='True',IncludeHeader='1')
50       
51#       ConvertToPointData(InputWorkspace='SNAP_%s_14_tof'%run,OutputWorkspace='SNAP_%s_14_tof'%run)
52        Divide(LHSWorkspace='SNAP_%s_14_tof'%run,RHSWorkspace='SNAP_12278_14_tof',OutputWorkspace='SNAP_%s_nor_14_tof'%run)
53        ReplaceSpecialValues(InputWorkspace='SNAP_%s_nor_14_tof'%run,OutputWorkspace='SNAP_%s_nor_14_tof'%run,NaNValue='0',BigNumberThreshold='30')
54        SaveGSS(InputWorkspace='SNAP_%s_nor_14_tof'%run,Filename=folder +'data/gsas/SNAP_%s_14.gsa'%run, Format = 'SLOG',SplitFiles='False')
55        SaveFocusedXYE(InputWorkspace='SNAP_%s_nor_14_tof'%run,Filename=folder +'data/fullprof/SNAP_%s_14.dat'%run,SplitFiles='True',IncludeHeader='1')
56
57       
58        DeleteWorkspace(Workspace='SNAP_%s'%run)
59        DeleteWorkspace(Workspace='SNAP_%s_d'%run)
60        DeleteWorkspace(Workspace='SNAP_%s_col'%run)
61        DeleteWorkspace(Workspace='SNAP_%s_14'%run)
62        DeleteWorkspace(Workspace='SNAP_%s_col_tof'%run)
63        DeleteWorkspace(Workspace='SNAP_%s_14_tof'%run)
64        DeleteWorkspace(Workspace='SNAP_%s_nor_tof'%run)
65        DeleteWorkspace(Workspace='SNAP_%s_nor_14_tof'%run)
66