Skip to content

Commit 5f81684

Browse files
Merge pull request #128 from mantidproject/make-analysis-reduction-algorithm
Make analysis reduction an algorithm object
2 parents d3fac28 + f10fbf3 commit 5f81684

File tree

8 files changed

+1252
-1127
lines changed

8 files changed

+1252
-1127
lines changed

legacy/examples/run_routine.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
2+
from mvesuvio.oop.analysis_helpers import loadRawAndEmptyWsFromUserPath, cropAndMaskWorkspace
3+
from mvesuvio.oop.AnalysisRoutine import AnalysisRoutine
4+
from mvesuvio.oop.NeutronComptonProfile import NeutronComptonProfile
5+
import numpy as np
6+
7+
8+
def run_analysis():
9+
10+
ws = loadRawAndEmptyWsFromUserPath(
11+
userWsRawPath='/home/ljg28444/Documents/user_0/some_new_experiment/some_new_exp/input_ws/some_new_exp_raw_forward.nxs',
12+
userWsEmptyPath='/home/ljg28444/Documents/user_0/some_new_experiment/some_new_exp/input_ws/some_new_exp_empty_forward.nxs',
13+
tofBinning = "110.,1.,420",
14+
name='exp',
15+
scaleRaw=1,
16+
scaleEmpty=1,
17+
subEmptyFromRaw=False
18+
)
19+
20+
cropedWs = cropAndMaskWorkspace(ws, firstSpec=144, lastSpec=182,
21+
maskedDetectors=[173, 174, 179],
22+
maskTOFRange='120, 160')
23+
24+
25+
AR = AnalysisRoutine(cropedWs,
26+
ip_file='/home/ljg28444/.mvesuvio/ip_files/ip2018_3.par',
27+
number_of_iterations=1,
28+
mask_spectra=[173, 174, 179],
29+
multiple_scattering_correction=True,
30+
vertical_width=0.1, horizontal_width=0.1, thickness=0.001,
31+
gamma_correction=True,
32+
mode_running='FORWARD',
33+
transmission_guess=0.853,
34+
multiple_scattering_order=2,
35+
number_of_events=1.0e5)
36+
37+
H = NeutronComptonProfile('H', mass=1.0079, intensity=1, width=4.7, center=0,
38+
intensity_bounds=[0, np.nan], width_bounds=[3, 6], center_bounds=[-3, 1])
39+
C = NeutronComptonProfile('C', mass=12, intensity=1, width=12.71, center=0,
40+
intensity_bounds=[0, np.nan], width_bounds=[12.71, 12.71], center_bounds=[-3, 1])
41+
S = NeutronComptonProfile('S', mass=16, intensity=1, width=8.76, center=0,
42+
intensity_bounds=[0, np.nan], width_bounds=[8.76, 8.76], center_bounds=[-3, 1])
43+
Co = NeutronComptonProfile('Co', mass=27, intensity=1, width=13.897, center=0,
44+
intensity_bounds=[0, np.nan], width_bounds=[13.897, 13.897], center_bounds=[-3, 1])
45+
46+
AR.add_profiles(H, C, S, Co)
47+
AR.run()
48+
49+
50+
run_analysis()

0 commit comments

Comments
 (0)