Skip to content

Commit

Permalink
Update direct reduction script for cycle 23/5
Browse files Browse the repository at this point in the history
  • Loading branch information
mducle committed Jan 25, 2024
1 parent aced56c commit 75d0da2
Show file tree
Hide file tree
Showing 9 changed files with 1,204 additions and 58 deletions.
24 changes: 19 additions & 5 deletions direct_inelastic/ISIS/DG_monovan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

t = time.time() #start the clock

#!begin_params
#============================User Input===========================
# Assumes that the thickness of the vanadium and the sample are the same
monovan = 59138 #mono van run
Expand All @@ -37,22 +38,35 @@
# MAPS monitors: m2spec=41475, m3spec=41476 - fixei = False
# LET monitors: m2spec=98310, m3spec= None - fixei = True

config['default.instrument'] = 'INSTRUMENT_NAME'
inst = 'INSTRUMENT_NAME'
cycle = 'CYCLE_ID'
m2spec = 69636 #specID of monitor2 (post monochromator)
m3spec = 69640 #specID of monitor2 (post monochromator)
fixei = False #true for LET since no m3
powdermap = 'RINGS_MAP_XML' #rings mapping file
monovan_range = 0.1 #integration range (+/- fraction of Ei)
min_theta = 5. #minimum theta to avoid low Q detectors (SANS)
idebug = False #keep workspaces
#=================================================================
inst = config['default.instrument']
#!end_params

config['default.instrument'] = inst
if inst == 'MARI':
source = 'Moderator'
else:
m2spec = 2 # specID of monitor2 (pre-sample)
m3spec = 3 # specID of monitor3 (post-sample)
elif inst == 'MERLIN':
source = 'undulator'
m2spec = 69636 # specID of monitor2 (pre-sample)
m3spec = 69640 # specID of monitor3 (post-sample)
elif inst == 'MAPS':
source = 'undulator'
m2spec = 36867 # specID of monitor2 (pre-sample)
m3spec = 36868 # specID of monitor3 (post-sample)
elif inst == 'LET':
source = 'undulator'
m2spec = 98310 # specID of monitor2 (pre-sample)
m3spec = None # specID of monitor3 (post-sample)
else:
raise RuntimeError(f'Unrecognised instrument: {inst}')

if cycle.startswith('20'):
cycle = cycle[2:]
Expand Down
213 changes: 164 additions & 49 deletions direct_inelastic/ISIS/DG_reduction.py

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion direct_inelastic/ISIS/DG_whitevan.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

t = time.time() #start the clock

#!begin_params
#=======================User Inputs======================
whitevan = 78715 # white vanadium run
whitevan_bg = None # background for the white vanadium
Expand All @@ -34,6 +35,7 @@
idebug = False # keep itermediate workspaces for debugging
save_dir = f'/instrument/{inst}/RBNumber/USER_RB_FOLDER' # Set to None to avoid resetting
#========================================================
#!end_params

config['default.instrument'] = inst
if save_dir is not None:
Expand Down Expand Up @@ -100,7 +102,7 @@ def load_sum(run_list):
WV_normalised_integrals = Scale(WV_normalised_integrals, scale_factor, 'Multiply')

# ===========================output integrals file================================
wv_name = whitevan if (isinstance(whitevan, str) or len(whitevan)==1) else whitevan[0]
wv_name = whitevan if (isinstance(whitevan, (str, int, float)) or len(whitevan)==1) else whitevan[0]
ofile = f'WV_{wv_name}.txt'
print(f'WHITE_VAN {inst}: Saving integrals in {ofile}')
print(f'... average intensity = {1/scale_factor:.2f}')
Expand Down
Loading

0 comments on commit 75d0da2

Please sign in to comment.