diff --git a/RefRed/calculations/lr_data.py b/RefRed/calculations/lr_data.py index d1a9f271..6da75071 100644 --- a/RefRed/calculations/lr_data.py +++ b/RefRed/calculations/lr_data.py @@ -127,26 +127,29 @@ def __init__( # chopper settings use_emission_delay = False if "BL4B:Chop:Skf2:ChopperModerator" in mt_run: + base_path = mt_run.getProperty("BL4B:Det:TH:DlyDet:BasePath").value[0] moderator_calc = mt_run.getProperty("BL4B:Chop:Skf2:ChopperModerator").value[0] t_mult = mt_run.getProperty("BL4B:Chop:Skf2:ChopperMultiplier").value[0] t_off = mt_run.getProperty("BL4B:Chop:Skf2:ChopperOffset").value[0] use_emission_delay = moderator_calc == 1 - wl_half_width = 1.7 * 60 / self.frequency + wl_half_width = 1.6 * 60 / self.frequency wl_delta_full_range = 0.8 * 60 / self.frequency # Calculate the TOF range to select if use_emission_delay: - # We cut 5% on each side compared to the case without correction to avoid the shoulders - tmin = (self.dMD * (self.lambda_requested - wl_half_width * 0.95) / H_OVER_M_NEUTRON * 1e-4 + t_off) / ( - 1 - t_mult / 1000 - ) - tmax = (self.dMD * (self.lambda_requested + wl_half_width * 0.95) / H_OVER_M_NEUTRON * 1e-4 + t_off) / ( - 1 - t_mult / 1000 - ) - else: - tmin = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested - wl_half_width) * 1e-4 - tmax = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested + wl_half_width) * 1e-4 + self.dMD = base_path + + tmin = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested - wl_half_width) * 1e-4 + tmax = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested + wl_half_width) * 1e-4 + + if use_emission_delay: + wl_min = self.lambda_requested - wl_half_width + wl_max = self.lambda_requested + wl_half_width + # Empirical additional delay to get rid of the ramp + ramp_delay = -750 + 125.0 * (self.lambda_requested - 4) + tmin += t_off + t_mult * wl_min + ramp_delay + tmax += t_off + t_mult * wl_max if lconfig is not None: autotmin = float(lconfig.tof_range[0]) diff --git a/RefRed/sf_calculator/lr_data.py b/RefRed/sf_calculator/lr_data.py index 9296bc8a..87144763 100644 --- a/RefRed/sf_calculator/lr_data.py +++ b/RefRed/sf_calculator/lr_data.py @@ -76,25 +76,28 @@ def __init__(self, workspace, read_options): # chopper settings use_emission_delay = False if "BL4B:Chop:Skf2:ChopperModerator" in mt_run: + base_path = mt_run.getProperty("BL4B:Det:TH:DlyDet:BasePath").value[0] moderator_calc = mt_run.getProperty("BL4B:Chop:Skf2:ChopperModerator").value[0] t_mult = mt_run.getProperty("BL4B:Chop:Skf2:ChopperMultiplier").value[0] t_off = mt_run.getProperty("BL4B:Chop:Skf2:ChopperOffset").value[0] use_emission_delay = moderator_calc == 1 - wl_half_width = 1.7 * 60 / self.frequency + wl_half_width = 1.6 * 60 / self.frequency # Calculate the TOF range to select if use_emission_delay: - # We cut 5% on each side compared to the case without correction to avoid the shoulders - tmin = (self.dMD * (self.lambda_requested - wl_half_width * 0.95) / H_OVER_M_NEUTRON * 1e-4 + t_off) / ( - 1 - t_mult / 1000 - ) - tmax = (self.dMD * (self.lambda_requested + wl_half_width * 0.95) / H_OVER_M_NEUTRON * 1e-4 + t_off) / ( - 1 - t_mult / 1000 - ) - else: - tmax = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested + wl_half_width) * 1e-4 - tmin = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested - wl_half_width) * 1e-4 + self.dMD = base_path + + tmax = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested + wl_half_width) * 1e-4 + tmin = self.dMD / H_OVER_M_NEUTRON * (self.lambda_requested - wl_half_width) * 1e-4 + + if use_emission_delay: + wl_min = self.lambda_requested - wl_half_width + wl_max = self.lambda_requested + wl_half_width + # Empirical additional delay to get rid of the ramp + ramp_delay = -750 + 125.0 * (self.lambda_requested - 4) + tmin += t_off + t_mult * wl_min + ramp_delay + tmax += t_off + t_mult * wl_max if self.read_options['is_auto_tof_finder'] or self.tof_range is None: autotmin = tmin