Ticket #9539: sample.py

File sample.py, 1.6 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
32PeaksLattice_Integrated_Clusters, ClusterImages = IntegratePeaksHybrid(InputWorkspace=LabQ, PeaksWorkspace=PeaksLattice, BackgroundOuterRadius=0.4)
33
34svw = plotSlice(ClusterImage)
35sv = svw.getSlicer()
36pp_all = sv.setPeaksWorkspaces([PeaksLattice_Integrated_Clusters,PeaksLattice_Integrated])
37pp = pp_all.getPeaksPresenter(PeaksLattice_Integrated_Clusters)