diff --git a/direct_inelastic/ISIS/DG_reduction.py b/direct_inelastic/ISIS/DG_reduction.py index c09fdb6..9577f98 100644 --- a/direct_inelastic/ISIS/DG_reduction.py +++ b/direct_inelastic/ISIS/DG_reduction.py @@ -61,7 +61,7 @@ #==================Local Contact Inputs================== inst = 'INSTRUMENT_NAME' cycle = 'CYCLE_ID' # cycle number -fixei = True # True for LET since no monitor 3 +fixei = FIXEIVAL # True for LET since no monitor 3 powdermap = 'RINGS_MAP_XML' # rings mapping file - must be .xml format file_wait = 30 # wait for data file to appear (seconds) keepworkspaces = False # should be false for Horace scans @@ -230,6 +230,7 @@ def load_sum(run_list, block_name=None): # https://github.com/mantidproject/mantid/issues/36194 sumruns = False ws_full, bval = load_sum(sample, cs_block) + ws = ws_full # So that auto-ei works (it assumes the workspace variable is "ws") ws_monitors = CloneWorkspace('ws_full_monitors') bval_range = max(bval) - min(bval) bval_nbins = int(bval_range / cs_bin_size) diff --git a/direct_inelastic/ISIS/reduction_utils.py b/direct_inelastic/ISIS/reduction_utils.py index 30bae55..3bcf03b 100644 --- a/direct_inelastic/ISIS/reduction_utils.py +++ b/direct_inelastic/ISIS/reduction_utils.py @@ -363,10 +363,21 @@ def inrange(tf, l): freq = mode(getLog('Fermi_Speed')) except ValueError: return [] - phase1, phase2 = (mode(getLog(nam)) for nam in ['Phase_Thick_1', 'Phase_Thick_2']) delay = getfracLog('Fermi_delay') lmc = 10.04 # Moderator-Fermi distance period = 1.e6 / freq + try: + phase1, phase2 = (mode(getLog(nam)) for nam in ['Phase_Thick_1', 'Phase_Thick_2']) + except RuntimeError: + # Pre-upgrade MARI - single slot disk + phase_disk = mode(getLog('Phase_Thick')) + 500 # Offset used in mari_utils.gcl + eis_disk = ((2286.26*7.05) / (phase_disk))**2 + if mode(getLog('Freq_Thick')) > 0 or (run.hasProperty('nchannels') and run.getProperty('nchannels').value > 1000): + return [eis_disk] + else: + delay_calc = ((2286.26 * lmc) / np.sqrt(eis_disk)) + eis = list({((2286.26*lmc) / (delay_calc + s*period))**2 for s in range(-10, 10)}) + return [roundlog10(ei) for ei in np.sort(eis)[::-1] if ei > 10] try: ei_nominal = mode(getLog('Ei_nominal')) except RuntimeError: # Old file @@ -381,10 +392,10 @@ def inrange(tf, l): disk_delta = delt_disk2 - delt_disk1 slots_delta = np.round(disk_delta / 202.11) / 10 assert slots_delta % 1.0 < 0.2, 'Bad slots calculation' - slots = {0:[0,1,2,4], 1:[0,1], 2:[0,2], 4:[0]}[abs(int(slots_delta))] + slots = {0:[0,1,2,4], 1:[0,1], 2:[0,2], 3:[0], 4:[0]}[abs(int(slots_delta))] disk_ref = 6 - (np.round(delt_disk1 / 202.11) / 10) assert disk_ref % 1.0 < 0.2, f'Bad disk calculation' - disk = {0:disk_ref, 1:disk_ref-1, 2:1 if disk_ref==2 else 0, 4:0}[abs(int(slots_delta))] + disk = {0:disk_ref, 1:disk_ref-1, 2:1 if disk_ref==2 else 0, 3:0, 4:0}[abs(int(slots_delta))] reps = [d-disk for d in slots] eis_disk = {((2286.26*lmc) / (delay_calc + s*2500.))**2 for s in reps} period = period / 2. if 'G' in chopper_type.upper() else period @@ -432,9 +443,11 @@ def inrange(tf, l): ldc = 9.2176 # Mod-Disk distance if not rrm_mode: return [roundlog10(((2286.26*ldc) / disk_delay)**2)] - else: # Assume using Gd chopper (t_offset = 2000/freq-5, for 'S' it is 300/freq-8) + else: # Assume using Gd chopper (t_offset = 2000/freq-5, for 'S' it is 300/freq-8.1) + # The opto on the Fermi was replaced on 28/11/24 - need to use different constants + m, c = (2000, -5) if run.endTime().to_datetime64() < np.datetime64('2024-11-27') else (6483, -5.5) period = 20000 * (25. / freq) - tof = (2286.26 * lmc) / np.sqrt(roundlog10(((2286.26 * lmc) / (delay - 2000/freq - 2))**2)) + tof = (2286.26 * lmc) / np.sqrt(roundlog10(((2286.26 * lmc) / (delay - m/freq - c))**2)) tfmx = 7500 if np.abs(disk_delay - 12400) < 10 else 8500 return [roundlog10(((2286.26*lmc) / tf)**2) for tf in [(tof + s*period) for s in range(-10, 10)] if tf > 1500 and tf < tfmx] diff --git a/direct_inelastic/LET/USER_Files_description.xml b/direct_inelastic/LET/USER_Files_description.xml index d1028c6..c5f0133 100644 --- a/direct_inelastic/LET/USER_Files_description.xml +++ b/direct_inelastic/LET/USER_Files_description.xml @@ -34,6 +34,7 @@ + diff --git a/direct_inelastic/MAPS/USER_Files_description.xml b/direct_inelastic/MAPS/USER_Files_description.xml index 084b700..0d11f4b 100644 --- a/direct_inelastic/MAPS/USER_Files_description.xml +++ b/direct_inelastic/MAPS/USER_Files_description.xml @@ -39,6 +39,7 @@ + diff --git a/direct_inelastic/MARI/DG_reduction.py b/direct_inelastic/MARI/DG_reduction.py index a2c44a3..081fc7c 100644 --- a/direct_inelastic/MARI/DG_reduction.py +++ b/direct_inelastic/MARI/DG_reduction.py @@ -232,6 +232,7 @@ def load_sum(run_list, block_name=None): # https://github.com/mantidproject/mantid/issues/36194 sumruns = False ws_full, bval = load_sum(sample, cs_block) + ws = ws_full # So that auto-ei works (it assumes the workspace variable is "ws") ws_monitors = CloneWorkspace('ws_full_monitors') bval_range = max(bval) - min(bval) bval_nbins = int(bval_range / cs_bin_size) diff --git a/direct_inelastic/MARI/USER_Files_description.xml b/direct_inelastic/MARI/USER_Files_description.xml index d28b0ca..9a7aaca 100644 --- a/direct_inelastic/MARI/USER_Files_description.xml +++ b/direct_inelastic/MARI/USER_Files_description.xml @@ -47,6 +47,7 @@ + diff --git a/direct_inelastic/MERLIN/USER_Files_description.xml b/direct_inelastic/MERLIN/USER_Files_description.xml index 3c5b607..44f7e64 100644 --- a/direct_inelastic/MERLIN/USER_Files_description.xml +++ b/direct_inelastic/MERLIN/USER_Files_description.xml @@ -34,6 +34,7 @@ +