Ticket #9257: IntegrateTopaz.py

File IntegrateTopaz.py, 1.9 KB (added by Owen Arnold, 6 years ago)
Line 
1# Basic parameters  for  Triphylite Crystal
2#Name of the workspaces to create
3ws_name = "TOPAZ_3132"
4filename = ws_name +"_event.nxs"
5ws = LoadEventNexus(Filename=filename,FilterByTofMin=3000, FilterByTofMax=16000)
6
7# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
8# Part 1. Basic Reduction
9
10# Spherical Absorption and Lorentz Corrections
11ws = AnvredCorrection(InputWorkspace=ws, LinearScatteringCoef=0.451, LinearAbsorptionCoef=0.993, Radius=0.14)
12
13# Convert to Q space
14LabQ = ConvertToDiffractionMDWorkspace(InputWorkspace=ws, LorentzCorrection='0',
15        OutputDimensions='Q (lab frame)', SplitInto=2, SplitThreshold=150)
16       
17# Find peaks
18PeaksLattice = FindPeaksMD(InputWorkspace=LabQ,MaxPeaks=100)
19
20# 3d integration to centroid peaks
21PeaksLattice = CentroidPeaksMD(InputWorkspace=LabQ,
22        PeakRadius=0.12, PeaksWorkspace=PeaksLattice)
23       
24# Find the UB matrix using the peaks and known lattice parameters
25FindUBUsingLatticeParameters(PeaksWorkspace=PeaksLattice, a=10.3522, b=6.0768, c=4.7276,
26                alpha=90, beta=90, gamma=90, NumInitial=20, Tolerance=0.12)
27               
28# And index to HKL           
29IndexPeaks(PeaksWorkspace=PeaksLattice, Tolerance=0.12)
30
31# Integrate peaks in Q space using spheres
32PeaksLattice_Integrated = IntegratePeaksMD(InputWorkspace=LabQ,PeakRadius=0.12,
33        PeaksWorkspace=PeaksLattice)
34       
35HistoMDQLab = BinMD(InputWorkspace=LabQ,AlignedDim0='Q_lab_x, 0, 8, 700',AlignedDim1='Q_lab_y, -10, 10, 700',AlignedDim2='Q_lab_z, 0, 10,  700')       
36
37PeaksLattice_Integrated_Clusters, ClusterImage = IntegratePeaksUsingClusters(InputWorkspace=HistoMDQLab, PeaksWorkspace=PeaksLattice, Threshold=1000000)
38
39svw = plotSlice(ClusterImage)
40sv = svw.getSlicer()
41pp_all = sv.setPeaksWorkspaces([PeaksLattice_Integrated_Clusters,PeaksLattice_Integrated])
42pp = pp_all.getPeaksPresenter(PeaksLattice_Integrated_Clusters)
43