| 1 | # Set of routines to normalise WISH data |
|---|
| 2 | from mantidsimple import * |
|---|
| 3 | import matplotlib.pyplot as p |
|---|
| 4 | import numpy as n |
|---|
| 5 | wish_dir="" |
|---|
| 6 | |
|---|
| 7 | # Get the valid wavelength range, i.e. excluding regions where choppers cut |
|---|
| 8 | def WISH_getlambdarange(): |
|---|
| 9 | return 0.7,10.35 |
|---|
| 10 | |
|---|
| 11 | def WISH_setuser(usern): |
|---|
| 12 | global username |
|---|
| 13 | username=usern |
|---|
| 14 | |
|---|
| 15 | def WISH_setdatadir(directory="/archive/ndxwish/Instrument/data/cycle_09_5/"): |
|---|
| 16 | global wish_datadir |
|---|
| 17 | wish_datadir=directory |
|---|
| 18 | |
|---|
| 19 | def WISH_setuserdir(directory): |
|---|
| 20 | global wish_userdir |
|---|
| 21 | wish_userdir=directory |
|---|
| 22 | |
|---|
| 23 | def WISH_datadir(): |
|---|
| 24 | return wish_datadir |
|---|
| 25 | |
|---|
| 26 | def WISH_userdir(cycle='cycle_10_1'): |
|---|
| 27 | return wish_userdir |
|---|
| 28 | |
|---|
| 29 | def WISH_calibration(cycle="11_4"): |
|---|
| 30 | #return "/home/mp43/Calibration/Cycle_"+cycle+"/" |
|---|
| 31 | return "/home/hqs74821/work/mantid_stuff/DockWidget/" |
|---|
| 32 | |
|---|
| 33 | def WISH_startup(usern,cycle='10_1'): |
|---|
| 34 | global userdatadir |
|---|
| 35 | global userdataprocessed |
|---|
| 36 | global mtdplt |
|---|
| 37 | import sys |
|---|
| 38 | sys.path.append('/home/hqs74821/work/mantid_stuff/DockWidget/') |
|---|
| 39 | import Mantid_plotting as mtdplt |
|---|
| 40 | userdatadir="/archive/ndxwish/Instrument/data/cycle_"+cycle+'/' |
|---|
| 41 | WISH_setdatadir(userdatadir) |
|---|
| 42 | print "Raw Data in : ", userdatadir |
|---|
| 43 | userdataprocessed="/home/hqs74821/work/mantid_stuff/DockWidget/ProcessedData/" |
|---|
| 44 | WISH_setuserdir(directory=userdataprocessed) |
|---|
| 45 | print "Processed Data in : ",userdataprocessed |
|---|
| 46 | return |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | #Returns the calibration filename |
|---|
| 50 | def WISH_cal(panel): |
|---|
| 51 | return WISH_calibration()+"WISH_cycle_10_3_noends_9to9.cal" |
|---|
| 52 | |
|---|
| 53 | # Returns the grouping filename |
|---|
| 54 | def WISH_group(): |
|---|
| 55 | return WISH_calibration()+"WISH_cycle_10_3_noends_9to9.cal" |
|---|
| 56 | |
|---|
| 57 | def WISH_getvana(panel,SE="candlestick",cycle="09_4"): |
|---|
| 58 | if (SE=="candlestick"): |
|---|
| 59 | if (cycle=="09_2"): |
|---|
| 60 | return WISH_calibration()+"vana318-"+str(panel)+"foc-rmbins-smooth50.nx5" |
|---|
| 61 | if (cycle=="09_3"): |
|---|
| 62 | return WISH_calibration(cycle)+"vana935-"+str(panel)+"foc-SS.nx5" |
|---|
| 63 | if (cycle=="09_4"): |
|---|
| 64 | return WISH_calibration(cycle)+"vana3123-"+str(panel)+"foc-SS.nx5" |
|---|
| 65 | if (cycle=="09_5"): |
|---|
| 66 | return WISH_calibration(cycle)+"vana3123-"+str(panel)+"foc-SS.nx5" |
|---|
| 67 | if (cycle=="11_4"): |
|---|
| 68 | return WISH_calibration(cycle)+"vana19612-"+str(panel)+"foc-SF-SS.nxs" |
|---|
| 69 | if (SE=="WISHcryo"): |
|---|
| 70 | if (cycle=="09_2"): |
|---|
| 71 | return WISH_calibration()+"vana318-"+str(panel)+"foc-rmbins-smooth50.nx5" |
|---|
| 72 | if (cycle=="09_3"): |
|---|
| 73 | return WISH_calibration(cycle)+"vana935-"+str(panel)+"foc-SS.nx5" |
|---|
| 74 | if (cycle=="09_4"): |
|---|
| 75 | return WISH_calibration(cycle)+"vana3123-"+str(panel)+"foc-SS.nx5" |
|---|
| 76 | if (cycle=="11_1"): |
|---|
| 77 | return WISH_calibration(cycle)+"vana17718-"+str(panel)+"foc-SS.nxs" |
|---|
| 78 | if (cycle=="11_2"): |
|---|
| 79 | return WISH_calibration(cycle)+"vana16812-"+str(panel)+"foc-SS.nx5" |
|---|
| 80 | if (cycle=="11_3"): |
|---|
| 81 | return WISH_calibration(cycle)+"vana18590-"+str(panel)+"foc-SS-new.nxs" |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | def split_string(t): |
|---|
| 85 | indxp=0 |
|---|
| 86 | for i in range(0,len(t)): |
|---|
| 87 | if (t[i]=="+"): |
|---|
| 88 | indxp=i |
|---|
| 89 | if (indxp!=0): |
|---|
| 90 | return int(t[0:indxp]),int(t[indxp+1:len(t)]) |
|---|
| 91 | |
|---|
| 92 | def WISH_getemptyinstrument(panel,cycle="09_4"): |
|---|
| 93 | if (cycle=="09_4"): |
|---|
| 94 | return WISH_calibration(cycle)+"emptyinst3120-"+str(panel)+"foc.nx5" |
|---|
| 95 | |
|---|
| 96 | def WISH_getempty(panel,SE="WISHcryo",cycle="09_4"): |
|---|
| 97 | if (SE=="WISHcryo"): |
|---|
| 98 | if (cycle=="09_2"): |
|---|
| 99 | return WISH_calibration(cycle)+"emptycryo322-"+str(panel)+"-smooth50.nx5" |
|---|
| 100 | if (cycle=="09_3"): |
|---|
| 101 | return WISH_calibration(cycle)+"emptycryo1725-"+str(panel)+"foc.nx5" |
|---|
| 102 | if (cycle=="09_4"): |
|---|
| 103 | return WISH_calibration(cycle)+"emptycryo3307-"+str(panel)+"foc.nx5" |
|---|
| 104 | if (cycle=="09_5"): |
|---|
| 105 | return WISH_calibration(cycle)+"emptycryo16759-"+str(panel)+"foc.nx5" |
|---|
| 106 | if (cycle=="11_1"): |
|---|
| 107 | return WISH_calibration(cycle)+"emptycryo17712-"+str(panel)+"foc-SS.nxs" |
|---|
| 108 | if (cycle=="11_2"): |
|---|
| 109 | return WISH_calibration(cycle)+"emptycryo16759-"+str(panel)+"foc-SS.nx5" |
|---|
| 110 | if (cycle=="11_3"): |
|---|
| 111 | return WISH_calibration(cycle)+"emptycryo17712-"+str(panel)+"foc-SS-new.nxs" |
|---|
| 112 | if (cycle=="11_4"): |
|---|
| 113 | return WISH_calibration(cycle)+"empty_mag20620-"+str(panel)+"foc-HR-SF.nxs" |
|---|
| 114 | if (SE=="candlestick"): |
|---|
| 115 | if (cycle=="09_4"): |
|---|
| 116 | return WISH_calibration(cycle)+"emptyinst3120-"+str(panel)+"foc.nxs" |
|---|
| 117 | if (cycle=="09_3"): |
|---|
| 118 | return WISH_calibration(cycle)+"emptyinst1726-"+str(panel)+"foc-monitor.nxs" |
|---|
| 119 | if (cycle=="11_4"): |
|---|
| 120 | return WISH_calibration(cycle)+"emptyinst19618-"+str(panel)+"foc-SF-S.nxs" |
|---|
| 121 | |
|---|
| 122 | def WISH_getfilename(run_number,ext): |
|---|
| 123 | if (ext[0]!='s'): |
|---|
| 124 | data_dir=WISH_datadir() |
|---|
| 125 | else: |
|---|
| 126 | #data_dir="/datad/ndxwish/" |
|---|
| 127 | data_dir=WISH_datadir() |
|---|
| 128 | digit=len(str(run_number)) |
|---|
| 129 | filename=data_dir+"WISH" |
|---|
| 130 | for i in range(0,8-digit): |
|---|
| 131 | filename=filename+"0" |
|---|
| 132 | filename+=str(run_number)+"."+ext |
|---|
| 133 | return filename |
|---|
| 134 | |
|---|
| 135 | def WISH_returnpanel(panel): |
|---|
| 136 | if (panel==1): |
|---|
| 137 | min=6 |
|---|
| 138 | max=19461 |
|---|
| 139 | elif (panel==2): |
|---|
| 140 | min=19462 |
|---|
| 141 | max=38917 |
|---|
| 142 | elif( panel==3): |
|---|
| 143 | min=38918 |
|---|
| 144 | max=58373 |
|---|
| 145 | elif (panel==4): |
|---|
| 146 | min=58374 |
|---|
| 147 | max=77829 |
|---|
| 148 | elif (panel==5): |
|---|
| 149 | min=77830 |
|---|
| 150 | max=97285 |
|---|
| 151 | elif (panel==6): |
|---|
| 152 | min=97286 |
|---|
| 153 | max=116741 |
|---|
| 154 | elif (panel==7): |
|---|
| 155 | min=116742 |
|---|
| 156 | max=136197 |
|---|
| 157 | elif (panel==8): |
|---|
| 158 | min=136198 |
|---|
| 159 | max=155653 |
|---|
| 160 | elif (panel==9): |
|---|
| 161 | min=155654 |
|---|
| 162 | max=175109 |
|---|
| 163 | elif (panel==0): |
|---|
| 164 | min=6 |
|---|
| 165 | max=175109 |
|---|
| 166 | return min,max |
|---|
| 167 | |
|---|
| 168 | # Reads a wish data file return a workspace with a short name |
|---|
| 169 | def WISH_read(number,panel,ext): |
|---|
| 170 | if type(number) is int: |
|---|
| 171 | filename=WISH_getfilename(number,ext) |
|---|
| 172 | if (ext[0:9]=="nxs_event"): |
|---|
| 173 | filename=WISH_getfilename(number,"nxs") |
|---|
| 174 | print "will be reading filename..."+filename |
|---|
| 175 | min,max=WISH_returnpanel(panel) |
|---|
| 176 | if (panel!=0): |
|---|
| 177 | output="w"+str(number)+"-"+str(panel) |
|---|
| 178 | else: |
|---|
| 179 | output="w"+str(number) |
|---|
| 180 | if (ext=="raw"): |
|---|
| 181 | LoadRaw(Filename=filename,OutputWorkspace=output,SpectrumMin=str(min),SpectrumMax=str(max),LoadLogFiles="0") |
|---|
| 182 | MaskBins(output,output,XMin=99900,XMax=106000) |
|---|
| 183 | print "standard raw file loaded" |
|---|
| 184 | if (ext[0]=="s"): |
|---|
| 185 | LoadRaw(Filename=filename,OutputWorkspace=output,SpectrumMin=str(min),SpectrumMax=str(max),LoadLogFiles="0") |
|---|
| 186 | MaskBins(output,output,XMin=99900,XMax=106000) |
|---|
| 187 | print "sav file loaded" |
|---|
| 188 | if (ext=="nxs_event"): |
|---|
| 189 | LoadEventNexus(Filename=filename,OutputWorkspace=output,LoadMonitors='1') |
|---|
| 190 | RenameWorkspace(output+"_monitors","w"+str(number)+"_monitors") |
|---|
| 191 | Rebin(InputWorkspace=output,OutputWorkspace=output,Params='6000,-0.00063,110000') |
|---|
| 192 | ConvertToMatrixWorkspace(output,output) |
|---|
| 193 | min,max=WISH_returnpanel(panel) |
|---|
| 194 | CropWorkspace(InputWorkspace=output,OutputWorkspace=output,StartWorkspaceIndex=min-6,EndWorkspaceIndex=max-6) |
|---|
| 195 | MaskBins(output,output,XMin=99900,XMax=106000) |
|---|
| 196 | print "full nexus eventfile loaded" |
|---|
| 197 | if (ext[0:10]=="nxs_event_"): |
|---|
| 198 | label,tmin,tmax=split_string_event(ext) |
|---|
| 199 | output=output+"_"+label |
|---|
| 200 | if (tmax=="end"): |
|---|
| 201 | LoadEventNexus(Filename=filename,OutputWorkspace=output,FilterByTimeStart=tmin,LoadMonitors='1',MonitorsAsEvents='1',FilterMonByTimeStart=tmin) |
|---|
| 202 | else: |
|---|
| 203 | LoadEventNexus(Filename=filename,OutputWorkspace=output,FilterByTimeStart=tmin,FilterByTimeStop=tmax,LoadMonitors='1',MonitorsAsEvents='1',FilterMonByTimeStart=tmin,FilterMonByTimeStop=tmax) |
|---|
| 204 | RenameWorkspace(output+"_monitors","w"+str(number)+"_monitors") |
|---|
| 205 | print "renaming monitors done!" |
|---|
| 206 | Rebin(InputWorkspace=output,OutputWorkspace=output,Params='6000,-0.00063,110000') |
|---|
| 207 | ConvertToMatrixWorkspace(output,output) |
|---|
| 208 | min,max=WISH_returnpanel(panel) |
|---|
| 209 | CropWorkspace(InputWorkspace=output,OutputWorkspace=output,StartWorkspaceIndex=min-6,EndWorkspaceIndex=max-6) |
|---|
| 210 | MaskBins(output,output,XMin=99900,XMax=106000) |
|---|
| 211 | print "nexus event file chopped" |
|---|
| 212 | if (ext=="nxs"): |
|---|
| 213 | LoadNexus(Filename=filename,OutputWorkspace=output) |
|---|
| 214 | print "standard histo nxs file loaded" |
|---|
| 215 | else: |
|---|
| 216 | n1,n2=split_string(number) |
|---|
| 217 | output="w"+str(n1)+"_"+str(n2)+"-"+str(panel) |
|---|
| 218 | filename=WISH_getfilename(n1,ext) |
|---|
| 219 | print "reading filename..."+filename |
|---|
| 220 | min,max=WISH_returnpanel(panel) |
|---|
| 221 | output1="w"+str(n1)+"-"+str(panel) |
|---|
| 222 | LoadRaw(Filename=filename,OutputWorkspace=output1,SpectrumMin=str(min),SpectrumMax=str(max),LoadLogFiles="0") |
|---|
| 223 | filename=WISH_getfilename(n2,ext) |
|---|
| 224 | print "reading filename..."+filename |
|---|
| 225 | min,max=WISH_returnpanel(panel) |
|---|
| 226 | output2="w"+str(n2)+"-"+str(panel) |
|---|
| 227 | LoadRaw(Filename=filename,OutputWorkspace=output2,SpectrumMin=str(min),SpectrumMax=str(max),LoadLogFiles="0") |
|---|
| 228 | MergeRuns(output1+","+output2,output) |
|---|
| 229 | mantid.deleteWorkspace(output1) |
|---|
| 230 | mantid.deleteWorkspace(output2) |
|---|
| 231 | ConvertUnits(output,output,"Wavelength") |
|---|
| 232 | lmin,lmax=WISH_getlambdarange() |
|---|
| 233 | CropWorkspace(output,output,XMin=lmin,XMax=lmax) |
|---|
| 234 | monitor=WISH_process_incidentmon(number,ext,spline_terms=70,debug=False) |
|---|
| 235 | print "first norm to be done" |
|---|
| 236 | NormaliseToMonitor(InputWorkspace=output,OutputWorkspace=output+"norm1",MonitorWorkspace=monitor) |
|---|
| 237 | print "second norm to be done" |
|---|
| 238 | NormaliseToMonitor(InputWorkspace=output+"norm1",OutputWorkspace=output+"norm2",MonitorWorkspace=monitor,IntegrationRangeMin=0.7,IntegrationRangeMax=10.35) |
|---|
| 239 | DeleteWorkspace(output) |
|---|
| 240 | DeleteWorkspace(output+"norm1") |
|---|
| 241 | RenameWorkspace(output+"norm2",output) |
|---|
| 242 | ConvertUnits(output,output,"TOF") |
|---|
| 243 | ReplaceSpecialValues(output,output,NaNValue=0.0,NaNError=0.0,InfinityValue=0.0,InfinityError=0.0) |
|---|
| 244 | return output |
|---|
| 245 | |
|---|
| 246 | #Focus dataset for a given panel and return the workspace |
|---|
| 247 | def WISH_focus_onepanel(work,focus,panel): |
|---|
| 248 | AlignDetectors(work,work,WISH_cal(panel)) |
|---|
| 249 | DiffractionFocussing(work,focus,WISH_group()) |
|---|
| 250 | if (panel==5): |
|---|
| 251 | CropWorkspace(focus,focus,XMin=0.3) |
|---|
| 252 | mantid.deleteWorkspace(work) |
|---|
| 253 | return focus |
|---|
| 254 | |
|---|
| 255 | def WISH_split(focus): |
|---|
| 256 | for i in range(0,10): |
|---|
| 257 | out=focus[0:len(focus)-3]+"-"+str(i+1)+"foc" |
|---|
| 258 | ExtractSingleSpectrum(focus,out,i) |
|---|
| 259 | mantid.deleteWorkspace(focus) |
|---|
| 260 | return |
|---|
| 261 | |
|---|
| 262 | def WISH_focus(work,panel): |
|---|
| 263 | focus=work+"foc" |
|---|
| 264 | if (panel!=0): |
|---|
| 265 | WISH_focus_onepanel(work,focus,panel) |
|---|
| 266 | else: |
|---|
| 267 | WISH_focus_onepanel(work,focus,panel) |
|---|
| 268 | WISH_split(focus) |
|---|
| 269 | |
|---|
| 270 | def WISH_process(number,panel,ext,SEsample="WISHcryo",emptySEcycle="09_4",SEvana="candlestick",cyclevana="09_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0): |
|---|
| 271 | w=WISH_read(number,panel,ext) |
|---|
| 272 | print "file read and normalized" |
|---|
| 273 | if (absorb): |
|---|
| 274 | ConvertUnits(w,w,"Wavelength") |
|---|
| 275 | CylinderAbsorption(InputWorkspace=w,OutputWorkspace="T", |
|---|
| 276 | CylinderSampleHeight=h,CylinderSampleRadius=r,AttenuationXSection=Xa, |
|---|
| 277 | ScatteringXSection=Xs,SampleNumberDensity=nd, |
|---|
| 278 | NumberOfSlices="10",NumberOfAnnuli="10",NumberOfWavelengthPoints="25",ExpMethod="Normal") |
|---|
| 279 | Divide(w,"T",w) |
|---|
| 280 | mantid.deleteWorkspace("T") |
|---|
| 281 | ConvertUnits(w,w,"TOF") |
|---|
| 282 | wfoc=WISH_focus(w,panel) |
|---|
| 283 | print "focussing done!" |
|---|
| 284 | if type(number) is int: |
|---|
| 285 | wfocname="w"+str(number)+"-"+str(panel)+"foc" |
|---|
| 286 | if (len(ext)>9): |
|---|
| 287 | label,tmin,tmax=split_string_event(ext) |
|---|
| 288 | wfocname="w"+str(number)+"-"+str(panel)+"_"+label+"foc" |
|---|
| 289 | else: |
|---|
| 290 | n1,n2=split_string(number) |
|---|
| 291 | wfocname="w"+str(n1)+"_"+str(n2)+"-"+str(panel)+"foc" |
|---|
| 292 | if (panel==1): |
|---|
| 293 | CropWorkspace(wfocname,wfocname,XMin=0.80,XMax=53.3) |
|---|
| 294 | elif(panel==2): |
|---|
| 295 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=13.1) |
|---|
| 296 | elif(panel==3): |
|---|
| 297 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=7.77) |
|---|
| 298 | elif(panel==4): |
|---|
| 299 | CropWorkspace(wfocname,wfocname,XMin=0.40,XMax=5.86) |
|---|
| 300 | elif(panel==5): |
|---|
| 301 | CropWorkspace(wfocname,wfocname,XMin=0.35,XMax=4.99) |
|---|
| 302 | elif(panel==6): |
|---|
| 303 | CropWorkspace(wfocname,wfocname,XMin=0.35,XMax=4.99) |
|---|
| 304 | elif(panel==7): |
|---|
| 305 | CropWorkspace(wfocname,wfocname,XMin=0.40,XMax=5.86) |
|---|
| 306 | elif(panel==8): |
|---|
| 307 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=7.77) |
|---|
| 308 | elif(panel==9): |
|---|
| 309 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=13.1) |
|---|
| 310 | |
|---|
| 311 | if (panel==0): |
|---|
| 312 | for i in range(1,10): |
|---|
| 313 | wfocname="w"+str(number)+"-"+str(i)+"foc" |
|---|
| 314 | CropWorkspace(wfocname,wfocname,XMin=0.80,XMax=53.3) |
|---|
| 315 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=13.1) |
|---|
| 316 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=7.77) |
|---|
| 317 | CropWorkspace(wfocname,wfocname,XMin=0.40,XMax=5.86) |
|---|
| 318 | CropWorkspace(wfocname,wfocname,XMin=0.35,XMax=4.99) |
|---|
| 319 | CropWorkspace(wfocname,wfocname,XMin=0.35,XMax=4.99) |
|---|
| 320 | CropWorkspace(wfocname,wfocname,XMin=0.40,XMax=5.86) |
|---|
| 321 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=7.77) |
|---|
| 322 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=13.1) |
|---|
| 323 | #print "will try to load an empty with the name:" |
|---|
| 324 | print WISH_getempty(panel,SEsample,emptySEcycle) |
|---|
| 325 | if (panel==0): |
|---|
| 326 | for i in range(1,10): |
|---|
| 327 | wfocname="w"+str(number)+"-"+str(i)+"foc" |
|---|
| 328 | LoadNexusProcessed(Filename=WISH_getempty(i,SEsample,emptySEcycle),OutputWorkspace="empty") |
|---|
| 329 | RebinToWorkspace("empty",wfocname,"empty") |
|---|
| 330 | Minus(wfocname,"empty",wfocname) |
|---|
| 331 | mantid.deleteWorkspace("empty") |
|---|
| 332 | print "will try to load a vanadium with the name:"+WISH_getvana(i,SEvana,cyclevana) |
|---|
| 333 | LoadNexusProcessed(Filename=WISH_getvana(i,SEvana,cyclevana),OutputWorkspace="vana") |
|---|
| 334 | RebinToWorkspace("vana",wfocname,"vana") |
|---|
| 335 | Divide(wfocname,"vana",wfocname) |
|---|
| 336 | mantid.deleteWorkspace("vana") |
|---|
| 337 | ConvertUnits(wfocname,wfocname,"TOF") |
|---|
| 338 | ReplaceSpecialValues(wfocname,wfocname,NaNValue=0.0,NaNError=0.0,InfinityValue=0.0,InfinityError=0.0) |
|---|
| 339 | SaveGSS(InputWorkspace=wfocname,Filename=WISH_userdir()+str(number)+"-"+str(i)+ext+".gss",Append=False,Bank=1) |
|---|
| 340 | SaveFocusedXYE(wfocname,WISH_userdir()+str(number)+"-"+str(i)+ext+".dat") |
|---|
| 341 | SaveNexusProcessed(wfocname,WISH_userdir()+str(number)+"-"+str(i)+ext+".nxs") |
|---|
| 342 | else: |
|---|
| 343 | LoadNexusProcessed(Filename=WISH_getempty(panel,SEsample,emptySEcycle),OutputWorkspace="empty") |
|---|
| 344 | RebinToWorkspace("empty",wfocname,"empty") |
|---|
| 345 | Minus(wfocname,"empty",wfocname) |
|---|
| 346 | mantid.deleteWorkspace("empty") |
|---|
| 347 | print "will try to load a vanadium with the name:"+WISH_getvana(panel,SEvana,cyclevana) |
|---|
| 348 | LoadNexusProcessed(Filename=WISH_getvana(panel,SEvana,cyclevana),OutputWorkspace="vana") |
|---|
| 349 | RebinToWorkspace("vana",wfocname,"vana") |
|---|
| 350 | Divide(wfocname,"vana",wfocname) |
|---|
| 351 | mantid.deleteWorkspace("vana") |
|---|
| 352 | ConvertUnits(wfocname,wfocname,"TOF") |
|---|
| 353 | ReplaceSpecialValues(wfocname,wfocname,NaNValue=0.0,NaNError=0.0,InfinityValue=0.0,InfinityError=0.0) |
|---|
| 354 | SaveGSS(InputWorkspace=wfocname,Filename=WISH_userdir()+str(number)+"-"+str(panel)+ext+".gss",Append=False,Bank=1) |
|---|
| 355 | SaveFocusedXYE(wfocname,WISH_userdir()+str(number)+"-"+str(panel)+ext+".dat") |
|---|
| 356 | SaveNexusProcessed(wfocname,WISH_userdir()+str(number)+"-"+str(panel)+ext+".nxs") |
|---|
| 357 | return wfocname |
|---|
| 358 | #Create a corrected vanadium (normalise,corrected for attenuation and empty, strip peaks) and |
|---|
| 359 | # save a a nexus processed file. |
|---|
| 360 | # It looks like smoothing of 100 works quite well |
|---|
| 361 | def WISH_createvan(van,empty,panel,smoothing,vh,vr,cycle_van="09_3",cycle_empty="09_3"): |
|---|
| 362 | WISH_setdatadir("/archive/ndxwish/Instrument/data/cycle_"+cycle_van+"/") |
|---|
| 363 | wvan=WISH_read(van,panel,"nxs_event") |
|---|
| 364 | WISH_setdatadir("/archive/ndxwish/Instrument/data/cycle_"+cycle_empty+"/") |
|---|
| 365 | wempty=WISH_read(empty,panel,"nxs_event") |
|---|
| 366 | Minus(wvan,wempty,wvan) |
|---|
| 367 | print "read van and empty" |
|---|
| 368 | mantid.deleteWorkspace(wempty) |
|---|
| 369 | ConvertUnits(wvan,wvan,"Wavelength") |
|---|
| 370 | CylinderAbsorption(InputWorkspace=wvan,OutputWorkspace="T", |
|---|
| 371 | CylinderSampleHeight=str(vh),CylinderSampleRadius=str(vr),AttenuationXSection="4.8756", |
|---|
| 372 | ScatteringXSection="5.16",SampleNumberDensity="0.07118", |
|---|
| 373 | NumberOfSlices="10",NumberOfAnnuli="10",NumberOfWavelengthPoints="25",ExpMethod="Normal") |
|---|
| 374 | Divide(wvan,"T",wvan) |
|---|
| 375 | mantid.deleteWorkspace("T") |
|---|
| 376 | ConvertUnits(wvan,wvan,"TOF") |
|---|
| 377 | vanfoc=WISH_focus(wvan,panel) |
|---|
| 378 | mantid.deleteWorkspace(wvan) |
|---|
| 379 | #StripPeaks(vanfoc,vanfoc) |
|---|
| 380 | #SmoothData(vanfoc,vanfoc,str(smoothing)) |
|---|
| 381 | return |
|---|
| 382 | |
|---|
| 383 | def WISH_createempty(empty,panel): |
|---|
| 384 | wempty=WISH_read(empty,panel,"raw") |
|---|
| 385 | emptyfoc=WISH_focus(wempty,panel) |
|---|
| 386 | return emptyfoc |
|---|
| 387 | |
|---|
| 388 | def WISH_monitors(rb,ext): |
|---|
| 389 | data_dir=WISH_dir() |
|---|
| 390 | file=WISH_getfilename(rb,ext) |
|---|
| 391 | wout="w"+str(rb) |
|---|
| 392 | print "reading File..."+file |
|---|
| 393 | LoadRaw(Filename=file,OutputWorkspace=wout,SpectrumMin=str(1),SpectrumMax=str(5),LoadLogFiles="0") |
|---|
| 394 | NormaliseByCurrent(wout,wout) |
|---|
| 395 | ConvertToDistribution(wout) |
|---|
| 396 | return wout |
|---|
| 397 | |
|---|
| 398 | def WISH_PH_TOF(runnumber,tubemin): |
|---|
| 399 | min=6+(tubenumber-1)*128 |
|---|
| 400 | max=min+128 |
|---|
| 401 | file=WISH_getfilename(runnumber,tubemin) |
|---|
| 402 | output="Run"+str(runnumber)+"tube"+str(tubenumber) |
|---|
| 403 | w=WISH_read(number,panel,ext) |
|---|
| 404 | print "file read and normalized" |
|---|
| 405 | if (absorb): |
|---|
| 406 | ConvertUnits(w,w,"Wavelength") |
|---|
| 407 | CylinderAbsorption(InputWorkspace=w,OutputWorkspace="T", |
|---|
| 408 | CylinderSampleHeight=h,CylinderSampleRadius=r,AttenuationXSection=Xa, |
|---|
| 409 | ScatteringXSection=Xs,SampleNumberDensity=nd, |
|---|
| 410 | NumberOfSlices="10",NumberOfAnnuli="10",NumberOfWavelengthPoints="25",ExpMethod="Normal") |
|---|
| 411 | Divide(w,"T",w) |
|---|
| 412 | mantid.deleteWorkspace("T") |
|---|
| 413 | ConvertUnits(w,w,"TOF") |
|---|
| 414 | wfoc=WISH_focus(w,panel) |
|---|
| 415 | print "focussing done!" |
|---|
| 416 | if type(number) is int: |
|---|
| 417 | wfocname="w"+str(number)+"-"+str(panel)+"foc" |
|---|
| 418 | if (len(ext)>9): |
|---|
| 419 | label,tmin,tmax=split_string_event(ext) |
|---|
| 420 | wfocname="w"+str(number)+"-"+str(panel)+"_"+label+"foc" |
|---|
| 421 | else: |
|---|
| 422 | n1,n2=split_string(number) |
|---|
| 423 | wfocname="w"+str(n1)+"_"+str(n2)+"-"+str(panel)+"foc" |
|---|
| 424 | if (panel==1): |
|---|
| 425 | CropWorkspace(wfocname,wfocname,XMin=0.80,XMax=53.3) |
|---|
| 426 | elif(panel==2): |
|---|
| 427 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=13.1) |
|---|
| 428 | elif(panel==3): |
|---|
| 429 | CropWorkspace(wfocname,wfocname,XMin=0.50,XMax=7.77) |
|---|
| 430 | elif(panel==4): |
|---|
| 431 | CropWorkspace(wfocname,wfocname,XMin=0.40,XMax=5.86) |
|---|
| 432 | elif(panel==5): |
|---|
| 433 | CropWorkspace(wfocname,wfocname,XMin=0.35,XMax=4.99) |
|---|
| 434 | #print "will try to load an empty with the name:" |
|---|
| 435 | print WISH_getempty(panel,SEsample,emptySEcycle) |
|---|
| 436 | if (panel==0): |
|---|
| 437 | for i in range(1,6): |
|---|
| 438 | LoadNexusProcessed(Filename=WISH_getempty(i,SEsample,emptySEcycle),OutputWorkspace="empty") |
|---|
| 439 | RebinToWorkspace("empty",wfocname,"empty") |
|---|
| 440 | Minus(wfocname,"empty",wfocname) |
|---|
| 441 | mantid.deleteWorkspace("empty") |
|---|
| 442 | print "will try to load a vanadium with the name:"+WISH_getvana(i,SEvana,cyclevana) |
|---|
| 443 | LoadNexusProcessed(Filename=WISH_getvana(i,SEvana,cyclevana),OutputWorkspace="vana") |
|---|
| 444 | RebinToWorkspace("vana",wfocname,"vana") |
|---|
| 445 | Divide(wfocname,"vana",wfocname) |
|---|
| 446 | mantid.deleteWorkspace("vana") |
|---|
| 447 | ConvertUnits(wfocname,wfocname,"TOF") |
|---|
| 448 | # SaveGSS(InputWorkspace=wfocname,Filename=WISH_userdir()+str(number)+"-"+str(i)+ext+".gss",Append=False,Bank=1) |
|---|
| 449 | # SaveFocusedXYE(wfocname,WISH_userdir()+str(number)+"-"+str(i)+ext+".dat") |
|---|
| 450 | else: |
|---|
| 451 | LoadNexusProcessed(Filename=WISH_getempty(panel,SEsample,emptySEcycle),OutputWorkspace="empty") |
|---|
| 452 | RebinToWorkspace("empty",wfocname,"empty") |
|---|
| 453 | Minus(wfocname,"empty",wfocname) |
|---|
| 454 | mantid.deleteWorkspace("empty") |
|---|
| 455 | print "will try to load a vanadium with the name:"+WISH_getvana(panel,SEvana,cyclevana) |
|---|
| 456 | LoadNexusProcessed(Filename=WISH_getvana(panel,SEvana,cyclevana),OutputWorkspace="vana") |
|---|
| 457 | RebinToWorkspace("vana",wfocname,"vana") |
|---|
| 458 | Divide(wfocname,"vana",wfocname) |
|---|
| 459 | mantid.deleteWorkspace("vana") |
|---|
| 460 | ConvertUnits(wfocname,wfocname,"TOF") |
|---|
| 461 | # SaveGSS(InputWorkspace=wfocname,Filename=WISH_userdir()+str(number)+"-"+str(panel)+ext+".gss",Append=False,Bank=1) |
|---|
| 462 | # SaveFocusedXYE(wfocname,WISH_userdir()+str(number)+"-"+str(panel)+ext+".dat") |
|---|
| 463 | return wfocname |
|---|
| 464 | LoadRaw(Filename=file,OutputWorkspace=output,spectrummin=str(min),spectrummax=str(max),LoadLogFiles="0") |
|---|
| 465 | Integration(output,output+"int") |
|---|
| 466 | g=plotTimeBin(output+"int",0) |
|---|
| 467 | |
|---|
| 468 | # Smoothing the incident beam monitor using a spline function. Regions around Bragg edges are masked, before fitting with a spline function. |
|---|
| 469 | # Returns a smooth monitor spectrum |
|---|
| 470 | |
|---|
| 471 | |
|---|
| 472 | def WISH_process_incidentmon(number,ext,spline_terms=20,debug=False): |
|---|
| 473 | if type(number) is int: |
|---|
| 474 | fname=WISH_getfilename(number,ext) |
|---|
| 475 | works="monitor"+str(number) |
|---|
| 476 | if (ext=="raw"): |
|---|
| 477 | works="monitor"+str(number) |
|---|
| 478 | LoadRaw(Filename=fname,OutputWorkspace=works,SpectrumMin=4,SpectrumMax=4,LoadLogFiles="0") |
|---|
| 479 | if (ext[0]=="s"): |
|---|
| 480 | works="monitor"+str(number) |
|---|
| 481 | LoadRaw(Filename=fname,OutputWorkspace=works,SpectrumMin=4,SpectrumMax=4,LoadLogFiles="0") |
|---|
| 482 | if (ext=="nxs"): |
|---|
| 483 | works="monitor"+str(number) |
|---|
| 484 | LoadNexus(Filename=fname,OutputWorkspace=works,SpectrumMin=4,SpectrumMax=4) |
|---|
| 485 | if (ext[0:9]=="nxs_event"): |
|---|
| 486 | temp="w"+str(number)+"_monitors" |
|---|
| 487 | works="w"+str(number)+"_monitor4" |
|---|
| 488 | Rebin(temp,temp,Params='6000,-0.00063,110000',PreserveEvents=False) |
|---|
| 489 | ExtractSingleSpectrum(temp,works,3) |
|---|
| 490 | else: |
|---|
| 491 | n1,n2=split_string(number) |
|---|
| 492 | works="monitor"+str(n1)+"_"+str(n2) |
|---|
| 493 | fname=WISH_getfilename(n1,ext) |
|---|
| 494 | works1="monitor"+str(n1) |
|---|
| 495 | LoadRaw(Filename=fname,OutputWorkspace=works1,SpectrumMin=4,SpectrumMax=4,LoadLogFiles="0") |
|---|
| 496 | fname=WISH_getfilename(n2,ext) |
|---|
| 497 | works2="monitor"+str(n2) |
|---|
| 498 | LoadRaw(Filename=fname,OutputWorkspace=works2,SpectrumMin=4,SpectrumMax=4,LoadLogFiles="0") |
|---|
| 499 | MergeRuns(works1+","+works2,works) |
|---|
| 500 | mantid.deleteWorkspace(works1) |
|---|
| 501 | mantid.deleteWorkspace(works2) |
|---|
| 502 | ConvertUnits(works,works,"Wavelength") |
|---|
| 503 | lmin,lmax=WISH_getlambdarange() |
|---|
| 504 | CropWorkspace(works,works,XMin=lmin,XMax=lmax) |
|---|
| 505 | ex_regions=n.zeros((2,4)) |
|---|
| 506 | ex_regions[:,0]=[4.57,4.76] |
|---|
| 507 | ex_regions[:,1]=[3.87,4.12] |
|---|
| 508 | ex_regions[:,2]=[2.75,2.91] |
|---|
| 509 | ex_regions[:,3]=[2.24,2.50] |
|---|
| 510 | ConvertToDistribution(works) |
|---|
| 511 | if (debug): |
|---|
| 512 | x,y,z=mtdplt.getnarray(works,0) |
|---|
| 513 | p.plot(x,y) |
|---|
| 514 | for reg in range(0,4): |
|---|
| 515 | MaskBins(works,works,XMin=ex_regions[0,reg],XMax=ex_regions[1,reg]) |
|---|
| 516 | if (debug): |
|---|
| 517 | x,y,z=mtdplt.getnarray(works,LoadRaw0) |
|---|
| 518 | p.plot(x,y) |
|---|
| 519 | SplineBackground(works,works,0,spline_terms) |
|---|
| 520 | if (debug): |
|---|
| 521 | x,y,z=mtdplt.getnarray(works,0) |
|---|
| 522 | p.plot(x,y) |
|---|
| 523 | p.show() |
|---|
| 524 | SmoothData(works,works,40) |
|---|
| 525 | ConvertFromDistribution(works) |
|---|
| 526 | return works |
|---|
| 527 | |
|---|
| 528 | #removes the peaks in a vanadium run, then performs a spline and a smooth |
|---|
| 529 | def Removepeaks_spline_smooth_empty(works,panel,debug=False): |
|---|
| 530 | if (panel==1): |
|---|
| 531 | splineterms=0 |
|---|
| 532 | smoothterms=30 |
|---|
| 533 | if (panel==2): |
|---|
| 534 | splineterms=0 |
|---|
| 535 | smoothterms=10 |
|---|
| 536 | if (panel==3): |
|---|
| 537 | splineterms=0 |
|---|
| 538 | smoothterms=15 |
|---|
| 539 | if (panel==4): |
|---|
| 540 | splineterms=0 |
|---|
| 541 | smoothterms=15 |
|---|
| 542 | if (panel==5): |
|---|
| 543 | splineterms=0 |
|---|
| 544 | smoothterms=10 |
|---|
| 545 | if (debug): |
|---|
| 546 | x,y,z=getnarray(works,0) |
|---|
| 547 | p.plot(x,y) |
|---|
| 548 | if (splineterms!=0): |
|---|
| 549 | SplineBackground(works,works,0,splineterms) |
|---|
| 550 | if (debug): |
|---|
| 551 | x,y,z=getnarray(works,0) |
|---|
| 552 | p.plot(x,y) |
|---|
| 553 | SmoothData(works,works,smoothterms) |
|---|
| 554 | if (debug): |
|---|
| 555 | x,y,z=getnarray(works,0) |
|---|
| 556 | p.plot(x,y) |
|---|
| 557 | p.show() |
|---|
| 558 | return works |
|---|
| 559 | |
|---|
| 560 | def split_string_event(t): |
|---|
| 561 | #this assumes the form nxs_event_label_tmin_tmax |
|---|
| 562 | indx_=[] |
|---|
| 563 | for i in range(10,len(t)): |
|---|
| 564 | if (t[i]=="_"): |
|---|
| 565 | indx_.append(i) |
|---|
| 566 | label=t[10:indx_[0]] |
|---|
| 567 | tmin=t[indx_[0]+1:indx_[1]] |
|---|
| 568 | tmax=t[indx_[1]+1:len(t)] |
|---|
| 569 | return label,tmin,tmax |
|---|
| 570 | |
|---|
| 571 | #test="nxs_event_1_300.00_600.00" |
|---|
| 572 | #print split_string_event(test) |
|---|
| 573 | |
|---|
| 574 | # ##################################################################### |
|---|
| 575 | # ##### USER SPECIFIC PART STARTS BELOW ## |
|---|
| 576 | # ##### IN CASE LINES ABOVE HAVE BEEN EDITED AND SCRIPTS NO LONGER WORK ## |
|---|
| 577 | # ##### LOG OUT AND BACK IN TO THE MACHINE ## |
|---|
| 578 | # ##################################################################### |
|---|
| 579 | # ########### SETTING the paths automatically : WISH_startup(username,cycle_name) ############## |
|---|
| 580 | WISH_startup("mp43","13_3") |
|---|
| 581 | # # WISH PROCESS ROUTINES TO EDIT (penultimate line optional but useful for recovering data later on) # |
|---|
| 582 | # To add two raw files together, replace runno (integer, eg. 16800) by a string "int1+int2" (eg "16800+16801" note quotes) |
|---|
| 583 | # ############################################################################################## |
|---|
| 584 | #beg=0 |
|---|
| 585 | #end=1800 |
|---|
| 586 | #nbslices=int(end/180) |
|---|
| 587 | #suffix=[] |
|---|
| 588 | #for k in range(0,nbslices): |
|---|
| 589 | # suffix.append("nxs_event_slice"+str(k)+"_"+str(int(k*180))+"_"+str((k+1)*180)) |
|---|
| 590 | |
|---|
| 591 | #print len(suffix) |
|---|
| 592 | #print suffix[0], suffix[k] |
|---|
| 593 | |
|---|
| 594 | #for i in range(24901,24902): |
|---|
| 595 | # for j in range(2,3): |
|---|
| 596 | # for k in range(0,len(suffix)): |
|---|
| 597 | # wout=WISH_process(i,j,suffix[k],"candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 598 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 599 | # ############################################################################################## |
|---|
| 600 | #for i in range(24895,24896): |
|---|
| 601 | # for j in range(5,6): |
|---|
| 602 | # wout=WISH_process(i,j,"nxs_event_slice1_0_300","candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 603 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 604 | # wout=WISH_process(i,j,"nxs_event_slice2_300_600","candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 605 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 606 | # wout=WISH_process(i,j,"nxs_event_slice3_600_900","candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 607 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 608 | # wout=WISH_process(i,j,"nxs_event_slice4_900_1200","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 609 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 610 | # wout=WISH_process(i,j,"nxs_event_slice5_1200_1500","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 611 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 612 | # wout=WISH_process(i,j,"nxs_event_slice6_1500_1800","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 613 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 614 | # wout=WISH_process(i,j,"nxs_event_slice7_1800_2100","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 615 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 616 | # wout=WISH_process(i,j,"nxs_event_slice8_2100_2400","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 617 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 618 | # wout=WISH_process(i,j,"nxs_event_slice9_2400_2700","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 619 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 620 | # wout=WISH_process(i,j,"nxs_event_slice10_2700_3000","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 621 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 622 | # wout=WISH_process(i,j,"nxs_event_slice11_3000_3300","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 623 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 624 | # wout=WISH_process(i,j,"nxs_event_slice12_3300_end","WISHcryo","11_3","WISHcryo","11_3",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 625 | |
|---|
| 626 | for i in range(25449,25450): |
|---|
| 627 | for j in range(1,10): |
|---|
| 628 | wout=WISH_process(i,j,"raw","candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 629 | ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 630 | # SaveGSS("w"+str(i)+"-1foc",WISH_userdir()+str(i)+"-1foc"+".gss",Append=False,Bank=1) |
|---|
| 631 | # SaveFocusedXYE("w"+str(i)+"-1foc",WISH_userdir()+str(i)+"-1foc"+".dat") |
|---|
| 632 | # SaveGSS("w"+str(i)+"-2foc",WISH_userdir()+str(i)+"-2foc"+".gss",Append=False,Bank=1) |
|---|
| 633 | # SaveFocusedXYE("w"+str(i)+"-2foc",WISH_userdir()+str(i)+"-2foc"+".dat") |
|---|
| 634 | RebinToWorkspace("w"+str(i)+"-6foc","w"+str(i)+"-5foc","w"+str(i)+"-6foc") |
|---|
| 635 | Plus("w"+str(i)+"-5foc","w"+str(i)+"-6foc","w"+str(i)+"-5_6foc") |
|---|
| 636 | ConvertUnits("w"+str(i)+"-5_6foc","w"+str(i)+"-5_6foc"+"-d","dSpacing") |
|---|
| 637 | SaveGSS("w"+str(i)+"-5_6foc",WISH_userdir()+str(i)+"-5_6foc"+".gss",Append=False,Bank=1) |
|---|
| 638 | SaveFocusedXYE("w"+str(i)+"-5_6foc",WISH_userdir()+str(i)+"-5_6foc"+".dat") |
|---|
| 639 | SaveNexusProcessed("w"+str(i)+"-5_6foc",WISH_userdir()+str(i)+"-5_6foc"+".nxs") |
|---|
| 640 | RebinToWorkspace("w"+str(i)+"-7foc","w"+str(i)+"-4foc","w"+str(i)+"-7foc") |
|---|
| 641 | Plus("w"+str(i)+"-4foc","w"+str(i)+"-7foc","w"+str(i)+"-4_7foc") |
|---|
| 642 | ConvertUnits("w"+str(i)+"-4_7foc","w"+str(i)+"-4_7foc"+"-d","dSpacing") |
|---|
| 643 | SaveGSS("w"+str(i)+"-4_7foc",WISH_userdir()+str(i)+"-4_7foc"+".gss",Append=False,Bank=1) |
|---|
| 644 | SaveFocusedXYE("w"+str(i)+"-4_7foc",WISH_userdir()+str(i)+"-4_7foc"+".dat") |
|---|
| 645 | SaveNexusProcessed("w"+str(i)+"-4_7foc",WISH_userdir()+str(i)+"-4_7foc"+".nxs") |
|---|
| 646 | RebinToWorkspace("w"+str(i)+"-8foc","w"+str(i)+"-3foc","w"+str(i)+"-8foc") |
|---|
| 647 | Plus("w"+str(i)+"-3foc","w"+str(i)+"-8foc","w"+str(i)+"-3_8foc") |
|---|
| 648 | ConvertUnits("w"+str(i)+"-3_8foc","w"+str(i)+"-3_8foc"+"-d","dSpacing") |
|---|
| 649 | SaveGSS("w"+str(i)+"-3_8foc",WISH_userdir()+str(i)+"-3_8foc"+".gss",Append=False,Bank=1) |
|---|
| 650 | SaveFocusedXYE("w"+str(i)+"-3_8foc",WISH_userdir()+str(i)+"-3_8foc"+".dat") |
|---|
| 651 | SaveNexusProcessed("w"+str(i)+"-3_8foc",WISH_userdir()+str(i)+"-3_8foc"+".nxs") |
|---|
| 652 | RebinToWorkspace("w"+str(i)+"-9foc","w"+str(i)+"-2foc","w"+str(i)+"-9foc") |
|---|
| 653 | Plus("w"+str(i)+"-2foc","w"+str(i)+"-9foc","w"+str(i)+"-2_9foc") |
|---|
| 654 | ConvertUnits("w"+str(i)+"-2_9foc","w"+str(i)+"-2_9foc"+"-d","dSpacing") |
|---|
| 655 | SaveGSS("w"+str(i)+"-2_9foc",WISH_userdir()+str(i)+"-2_9foc"+".gss",Append=False,Bank=1) |
|---|
| 656 | SaveFocusedXYE("w"+str(i)+"-2_9foc",WISH_userdir()+str(i)+"-2_9foc"+".dat") |
|---|
| 657 | SaveNexusProcessed("w"+str(i)+"-2_9foc",WISH_userdir()+str(i)+"-2_9foc"+".nxs") |
|---|
| 658 | # ############################################################################################# |
|---|
| 659 | #for i in range(23840,23841): |
|---|
| 660 | # for j in range(5,0,-1): |
|---|
| 661 | # wout=WISH_process(i,j,"raw","candlestick","11_4","candlestick","11_4",absorb=False,nd=0.0,Xs=0.0,Xa=0.0,h=0.0,r=0.0) |
|---|
| 662 | # SaveNexusProcessed(wout,WISH_userdir()+wout+".nxs") |
|---|
| 663 | # ConvertUnits(wout,wout+"-d","dSpacing") |
|---|
| 664 | |
|---|
| 665 | |
|---|
| 666 | # ########################################################################################### |
|---|
| 667 | #for i in range(18880,18881): |
|---|
| 668 | # for j in range(1,6): |
|---|
| 669 | # wout=WISH_process(i,j,"raw","WISHcryo","11_3","WISHcryo","11_3",absorb=True,nd=0.0035,Xs=62.27,Xa=429.95,h=4.0,r=0.15) |
|---|
| 670 | # ########################################################################################### |
|---|
| 671 | # ######### END OF WISH PROCESS ROUTINES ################## |
|---|
| 672 | |
|---|
| 673 | # ##################################################################### |
|---|
| 674 | # How to retrieve already processed Data without having to reprocess it (in case Mantid session has been closed # |
|---|
| 675 | #for runno in range(24122,24130): |
|---|
| 676 | # for j in range(1,6): |
|---|
| 677 | # wr=str(runno)+"-"+str(j)+"raw-0" |
|---|
| 678 | # LoadNexusProcessed(WISH_userdir()+wr+".nxs",wr) |
|---|
| 679 | # ConvertUnits(wr,wr+"-d","dSpacing") |
|---|
| 680 | |
|---|
| 681 | ##################################################################### |
|---|
| 682 | #for runno in range(22678,22686): |
|---|
| 683 | #for j in range(1,6): |
|---|
| 684 | #wr="w"+str(runno)+"-"+str(j)+"foc" |
|---|
| 685 | |
|---|
| 686 | #for j in range(1,6): |
|---|
| 687 | # Plus("w22663"+"-"+str(j)+"foc","w22664"+"-"+str(j)+"foc","vancan"+"-"+str(j)+"foc") |
|---|
| 688 | # SaveGSS(InputWorkspace="vancan"+"-"+str(j)+"foc",Filename=WISH_userdir()+"vancan"+"-"+str(j)+"foc.gss",Append=False,Bank=1) |
|---|
| 689 | |
|---|
| 690 | |
|---|
| 691 | |
|---|
| 692 | |
|---|
| 693 | # #################################################################### |
|---|
| 694 | # If you don't have a correct empty, either use the most suitable one or use the lines below #### |
|---|
| 695 | #for i in range(1197,1410): |
|---|
| 696 | # for j in range(1,6): |
|---|
| 697 | # wout=WISH_read(i,j,"raw") |
|---|
| 698 | # wfoc=WISH_focus(wout,j) |
|---|
| 699 | # #################################################################### |
|---|
| 700 | # use the lines below to manually set the paths if needed |
|---|
| 701 | #WISH_setdatadir("/archive/ndxwish/Instrument/data/cycle_10_1/") |
|---|
| 702 | #WISH_setuserdir("/home/mp43/ProcessedData/")WISHcryo |
|---|
| 703 | # ######### use the lines below to process a LoadRawvanadium run ################## |
|---|
| 704 | #for j in range(1,2): |
|---|
| 705 | # WISH_createvan(19612,19618,j,100,4.0,0.15,cycle_van="11_4",cycle_empty="11_4") |
|---|
| 706 | # CropWorkspace(InputWorkspace="w19612-"+str(j)+"foc",OutputWorkspace="w19612-"+str(j)+"foc",XMin='0.35',XMax='5.0') |
|---|
| 707 | # Removepeaks_spline_smooth_vana("w18904-"+str(j)+"foc",j,debug=False) |
|---|
| 708 | # SaveNexusProcessed("w16847-"+str(i)+"foc",WISH_userdir()+"vana16847-"+str(i)+"foc.nx5") |
|---|
| 709 | # ######## use the lines below to create a processed empty (instrument, cryostat, can..) run ######## |
|---|
| 710 | #for i in range(4,5): |
|---|
| 711 | # WISH_createempty(20620,i) |
|---|
| 712 | #SaveNexusProcessed("w16748-"+str(i)+"foc",WISH_userdir()+"emptyinst16748-"+str(i)+"foc.nx5") |
|---|
| 713 | |
|---|
| 714 | |
|---|