Ticket #9459: verify9459.py

File verify9459.py, 2.3 KB (added by Wenduo Zhou, 6 years ago)
Line 
1wsname = "NOM_26140"
2efname = "NOM_26140_event.nxs"
3peaks = '0.8920,1.0758,1.2615,2.0599'
4minpeakheight = 5
5
6############################################################################
7# Generate a fit window table workspace
8############################################################################
9
10numspec = 101376
11windowws = CreateEmptyTableWorkspace(OutputWorkspace="NOM_26140_Window")
12
13windowws.addColumn("int", "spectrum") 
14windowws.addColumn("double", "peak0_left") 
15windowws.addColumn("double", "peak0_right") 
16windowws.addColumn("double", "peak1_left") 
17windowws.addColumn("double", "peak1_right") 
18windowws.addColumn("double", "peak2_left") 
19windowws.addColumn("double", "peak2_right") 
20windowws.addColumn("double", "peak3_left") 
21windowws.addColumn("double", "peak3_right") 
22
23# 0.892000, 1.075800, 1.261500, 2.06000
24
25peak0left = 0.872
26peak0right = 0.945
27
28peak1left = 1.050
29peak1right = 1.138
30
31peak2left = 1.218
32peak2right = 1.350
33
34peak3left = 1.91
35peak3right = 2.20
36
37for iws in xrange(numspec):
38    windowws.addRow([iws, peak0left, peak0right, peak1left, peak1right, peak2left, peak2right,
39        peak3left, peak3right])
40
41############################################################################
42# Create a workspace for resolution
43############################################################################
44Load(Filename = "NOM_26140_event.nxs", OutputWorkspace = "TempWS")
45EstimatePDDetectorResolution(
46        InputWorkspace = "TempWS",
47        OutputWorkspace = "NOM_Estimated_ResolutionWS",
48        DeltaTOF = 40.)
49DeleteWorkspace(Workspace = "TempWS")
50
51############################################################################
52# Calibreate rectangular detectors
53############################################################################
54CalibrateRectangularDetectors(
55        Instrument = "NOM",
56        RunNumber = 26140,
57        Extension = "_event.nxs",
58        MaxOffset = 1.,
59        CrossCorrelation = False,
60        PeakPositions = peaks,
61        MinimumPeakHeight = minpeakheight, 
62        FitwindowTableWorkspace = "NOM_26140_Window",
63        PeakFunction = "Gaussian",
64        BackgroundType = "Linear",
65        Binning = "0.5, -0.005, 5.",
66        FilterBadPulses = True,
67        SaveAs = "calibration",
68        OutputDirectory = "/tmp/",
69        DetectorResolutionWorkspace = "NOM_Estimated_ResolutionWS",
70        AllowedResRange = "0.25, 4.0")