-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoriginal_inputs.py
163 lines (118 loc) · 5.03 KB
/
original_inputs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import time
import numpy as np
from pathlib import Path
from vesuvio_analysis.core_functions.bootstrap import runBootstrap
from vesuvio_analysis.core_functions.bootstrap_analysis import runAnalysisOfStoredBootstrap
from vesuvio_analysis.core_functions.run_script import runScript
from mantid.api import AnalysisDataService
scriptName = Path(__file__).name.split(".")[0] # Take out .py
experimentPath = Path(__file__).absolute().parent / "experiments" / scriptName # Path to the repository
ipFilesPath = Path(__file__).absolute().parent / "vesuvio_analysis" / "ip_files"
class LoadVesuvioBackParameters:
runs="43066-43076" # 77K # The numbers of the runs to be analysed
empty_runs="41876-41923" # 77K # The numbers of the empty runs to be subtracted
spectra='3-134' # Spectra to be analysed
mode='DoubleDifference'
ipfile=ipFilesPath / "ip2019.par"
subEmptyFromRaw = True # Flag to control wether empty ws gets subtracted from raw
scaleEmpty = 1 # None or scaling factor
scaleRaw = 1
class LoadVesuvioFrontParameters:
runs='43066-43076' # 100K # The numbers of the runs to be analysed
empty_runs='43868-43911' # 100K # The numbers of the empty runs to be subtracted
spectra='144-182' # Spectra to be analysed
mode='SingleDifference'
ipfile=ipFilesPath / "ip2018_3.par"
subEmptyFromRaw = False # Flag to control wether empty ws gets subtracted from raw
scaleEmpty = 1 # None or scaling factor
scaleRaw = 1
class GeneralInitialConditions:
"""Used to define initial conditions shared by both Back and Forward scattering"""
transmission_guess = 0.8537 # Experimental value from VesuvioTransmission
multiple_scattering_order, number_of_events = 2, 1.e5
# Sample slab parameters
vertical_width, horizontal_width, thickness = 0.1, 0.1, 0.001 # Expressed in meters
class BackwardInitialConditions(GeneralInitialConditions):
InstrParsPath = ipFilesPath / "ip2018_3.par"
HToMassIdxRatio = 19.0620008206 # Set to zero or None when H is not present
massIdx = 0
# Masses, instrument parameters and initial fitting parameters
masses = np.array([12, 16, 27])
# noOfMasses = len(masses)
initPars = np.array([
# Intensities, NCP widths, NCP centers
1, 12, 0.,
1, 12, 0.,
1, 12.5, 0.
])
bounds = np.array([
[0, np.nan], [8, 16], [-3, 1],
[0, np.nan], [8, 16], [-3, 1],
[0, np.nan], [11, 14], [-3, 1]
])
constraints = ()
noOfMSIterations = 3 #4
firstSpec = 3 #3
lastSpec = 134 #134
maskedSpecAllNo = np.array([18, 34, 42, 43, 59, 60, 62, 118, 119, 133])
# Boolean Flags to control script
MSCorrectionFlag = True
GammaCorrectionFlag = False
# # Parameters of workspaces in input_ws
tofBinning='275.,1.,420' # Binning of ToF spectra
maskTOFRange = None
# Original data uses histogram data instead of point data
runHistData = True
normVoigt = False
class ForwardInitialConditions(GeneralInitialConditions):
masses = np.array([1.0079, 12, 16, 27])
initPars = np.array([
# Intensities, NCP widths, NCP centers
1, 4.7, 0,
1, 12.71, 0.,
1, 8.76, 0.,
1, 13.897, 0.
])
bounds = np.array([
[0, np.nan], [3, 6], [-3, 1],
[0, np.nan], [12.71, 12.71], [-3, 1],
[0, np.nan], [8.76, 8.76], [-3, 1],
[0, np.nan], [13.897, 13.897], [-3, 1]
])
constraints = ()
noOfMSIterations = 3 #4
firstSpec = 144 #144
lastSpec = 182 #182
# Boolean Flags to control script
MSCorrectionFlag = True
GammaCorrectionFlag = True
maskedSpecAllNo = np.array([173, 174, 179])
tofBinning="110,1,430" # Binning of ToF spectra
maskTOFRange = None
# Original data uses histogram data instead of point data
runHistData = True
normVoigt = False
class YSpaceFitInitialConditions:
anything = True
class UserScriptControls:
runRoutine = True
# Choose main procedure to run
procedure = "BACKWARD" # Options: None, "BACKWARD", "FORWARD", "JOINT"
# Choose on which ws to perform the fit in y space
fitInYSpace = None # Options: None, "BACKWARD", "FORWARD", "JOINT"
class BootstrapInitialConditions:
runBootstrap = False
start_time = time.time()
wsBackIC = LoadVesuvioBackParameters
wsFrontIC = LoadVesuvioFrontParameters
bckwdIC = BackwardInitialConditions
fwdIC = ForwardInitialConditions
yFitIC = YSpaceFitInitialConditions
bootIC = BootstrapInitialConditions
userCtr = UserScriptControls
runScript(userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC)
AnalysisDataService.clear()
userCtr.procedure = "FORWARD"
runScript(userCtr, scriptName, wsBackIC, wsFrontIC, bckwdIC, fwdIC, yFitIC, bootIC)
end_time = time.time()
print("\nRunning time: ", end_time-start_time, " seconds")