def Norm_data(rnum, cycle): # Load and normalize SX data mantid.LoadRaw( Filename='/archive/Instruments$/NDXWISH/Instrument/data/cycle_' + cycle + '/WISH000' + str(rnum) + '.raw', OutputWorkspace='WISH000' + str(rnum), LoadMonitors='Separate') # ConvertToEventWorkspace(InputWorkspace='WISH000'+str(rnum), OutputWorkspace='WISH000'+str(rnum)) mantid.CropWorkspace(InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(i), XMin=6000, XMax=99000) mantid.ConvertUnits(InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(rnum), Target='Wavelength') mantid.NormaliseByCurrent(InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(rnum)) # normalize By vanadium PredictPeaks mantid.CropWorkspace(InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(rnum), XMin=0.75, XMax=9.3) mantid.RebinToWorkspace(WorkspaceToRebin='Vana_smoot1', WorkspaceToMatch='WISH000' + str(rnum), OutputWorkspace='Vana_smoot1') mantid.Divide(LHSWorkspace='WISH000' + str(rnum), RHSWorkspace='Vana_smoot1', OutputWorkspace='WISH000' + str(rnum)) # remove spike in the data above 1e15 and -1e15 mantid.ReplaceSpecialValues(InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(rnum), NaNValue=0, InfinityValue=0, BigNumberThreshold=1e15, SmallNumberThreshold=-1e15) # Convert to Diffraction MD and Lorentz Correction mantid.ConvertToDiffractionMDWorkspace( InputWorkspace='WISH000' + str(rnum), OutputWorkspace='WISH000' + str(rnum) + '_MD', LorentzCorrection=True)
FilterByTofMin=3000, FilterByTofMax=16000) # ------------------------------------------------------------------------------------------------------------------------------------------ # Part 1. Basic Reduction # Spherical Absorption and Lorentz Corrections ws = mantid.AnvredCorrection(InputWorkspace=ws, LinearScatteringCoef=0.451, LinearAbsorptionCoef=0.993, Radius=0.14) # Convert to Q space LabQ = mantid.ConvertToDiffractionMDWorkspace(InputWorkspace=ws, LorentzCorrection='0', OutputDimensions='Q (lab frame)', SplitInto=2, SplitThreshold=150) # Find peaks PeaksLattice = mantid.FindPeaksMD(InputWorkspace=LabQ, MaxPeaks=100) # 3d integration to centroid peaks PeaksLattice = mantid.CentroidPeaksMD(InputWorkspace=LabQ, PeakRadius=0.12, PeaksWorkspace=PeaksLattice) # Find the UB matrix using the peaks and known lattice parameters mantid.FindUBUsingLatticeParameters(PeaksWorkspace=PeaksLattice, a=10.3522, b=6.0768,
print(latt.gamma()) # # Exclude the monitors when loading the raw SXD file. This avoids # mantid.Load(Filename='SXD23767.raw', OutputWorkspace='SXD23767', LoadMonitors='Exclude') # # A lower SplitThreshold, with a reasonable bound on the recursion depth, helps find weaker peaks at higher Q. # QLab = mantid.ConvertToDiffractionMDWorkspace(InputWorkspace='SXD23767', OutputDimensions='Q (lab frame)', SplitThreshold=50, LorentzCorrection='1', MaxRecursionDepth='13', Extents='-15,15,-15,15,-15,15') # # NaCl has a relatively small unit cell, so the distance between peaks is relatively large. Setting the PeakDistanceThreshold # higher avoids finding high count regions on the sides of strong peaks as separate peaks. # peaks_qLab = mantid.FindPeaksMD(InputWorkspace='QLab', MaxPeaks=300, DensityThresholdFactor=10, PeakDistanceThreshold=1.0) # # Fewer peaks index if Centroiding is used. This indicates that there may be an error in the centroiding algorithm, # since the peaks seem to be less accurate.