| 1 | # Basic parameters for Triphylite Crystal |
|---|
| 2 | #Name of the workspaces to create |
|---|
| 3 | ws_name = "TOPAZ_3132" |
|---|
| 4 | filename = ws_name +"_event.nxs" |
|---|
| 5 | ws = LoadEventNexus(Filename=filename,FilterByTofMin=3000, FilterByTofMax=16000) |
|---|
| 6 | |
|---|
| 7 | # ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|---|
| 8 | # Part 1. Basic Reduction |
|---|
| 9 | |
|---|
| 10 | # Spherical Absorption and Lorentz Corrections |
|---|
| 11 | ws = AnvredCorrection(InputWorkspace=ws, LinearScatteringCoef=0.451, LinearAbsorptionCoef=0.993, Radius=0.14) |
|---|
| 12 | |
|---|
| 13 | # Convert to Q space |
|---|
| 14 | LabQ = ConvertToDiffractionMDWorkspace(InputWorkspace=ws, LorentzCorrection='0', |
|---|
| 15 | OutputDimensions='Q (lab frame)', SplitInto=2, SplitThreshold=150) |
|---|
| 16 | |
|---|
| 17 | # Find peaks |
|---|
| 18 | PeaksLattice = FindPeaksMD(InputWorkspace=LabQ,MaxPeaks=100) |
|---|
| 19 | |
|---|
| 20 | # 3d integration to centroid peaks |
|---|
| 21 | PeaksLattice = CentroidPeaksMD(InputWorkspace=LabQ, |
|---|
| 22 | PeakRadius=0.12, PeaksWorkspace=PeaksLattice) |
|---|
| 23 | |
|---|
| 24 | # Find the UB matrix using the peaks and known lattice parameters |
|---|
| 25 | FindUBUsingLatticeParameters(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 |
|---|
| 29 | IndexPeaks(PeaksWorkspace=PeaksLattice, Tolerance=0.12) |
|---|
| 30 | |
|---|
| 31 | # Integrate peaks in Q space using spheres |
|---|
| 32 | PeaksLattice_Integrated = IntegratePeaksMD(InputWorkspace=LabQ,PeakRadius=0.12, |
|---|
| 33 | PeaksWorkspace=PeaksLattice) |
|---|
| 34 | |
|---|
| 35 | HistoMDQLab = 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 | |
|---|
| 37 | PeaksLattice_Integrated_Clusters, ClusterImage = IntegratePeaksUsingClusters(InputWorkspace=HistoMDQLab, PeaksWorkspace=PeaksLattice, Threshold=1000000) |
|---|
| 38 | |
|---|
| 39 | svw = plotSlice(ClusterImage) |
|---|
| 40 | sv = svw.getSlicer() |
|---|
| 41 | pp_all = sv.setPeaksWorkspaces([PeaksLattice_Integrated_Clusters,PeaksLattice_Integrated]) |
|---|
| 42 | pp = pp_all.getPeaksPresenter(PeaksLattice_Integrated_Clusters) |
|---|
| 43 | |
|---|