Skip to content
Snippets Groups Projects
Commit 64a861a0 authored by David Fairbrother's avatar David Fairbrother
Browse files

Re #18108 Add cropping to processed vanadium

parent f7ac817b
No related branches found
No related tags found
No related merge requests found
Showing with 33 additions and 9 deletions
...@@ -128,9 +128,12 @@ class AbstractInst(object): ...@@ -128,9 +128,12 @@ class AbstractInst(object):
def output_focused_ws(self, processed_spectra, run_details, output_mode=None): def output_focused_ws(self, processed_spectra, run_details, output_mode=None):
return None return None
def crop_short_long_mode(self, ws_to_crop): def crop_raw_to_expected_tof_range(self, ws_to_crop):
return ws_to_crop return ws_to_crop
def crop_van_to_expected_tof_range(self, van_ws_to_crop):
return van_ws_to_crop
def spline_vanadium_ws(self, focused_vanadium_ws): def spline_vanadium_ws(self, focused_vanadium_ws):
return None return None
......
...@@ -111,11 +111,16 @@ class Pearl(AbstractInst): ...@@ -111,11 +111,16 @@ class Pearl(AbstractInst):
def crop_banks_to_user_tof(self, focused_banks): def crop_banks_to_user_tof(self, focused_banks):
return common.crop_banks_in_tof(focused_banks, self._inst_settings.tof_cropping_values) return common.crop_banks_in_tof(focused_banks, self._inst_settings.tof_cropping_values)
def crop_short_long_mode(self, ws_to_crop): def crop_raw_to_expected_tof_range(self, ws_to_crop):
out_ws = common.crop_in_tof(ws_to_crop=ws_to_crop, x_min=self._inst_settings.raw_data_crop_vals[0], out_ws = common.crop_in_tof(ws_to_crop=ws_to_crop, x_min=self._inst_settings.raw_data_crop_vals[0],
x_max=self._inst_settings.raw_data_crop_vals[-1]) x_max=self._inst_settings.raw_data_crop_vals[-1])
return out_ws return out_ws
def crop_van_to_expected_tof_range(self, van_ws_to_crop):
cropped_ws = common.crop_in_tof(ws_to_crop=van_ws_to_crop, x_min=self._inst_settings.van_tof_cropping[0],
x_max=self._inst_settings.van_tof_cropping[-1])
return cropped_ws
def generate_vanadium_absorb_corrections(self, run_details, ws_to_match): def generate_vanadium_absorb_corrections(self, run_details, ws_to_match):
return pearl_algs.generate_vanadium_absorb_corrections(van_ws=ws_to_match) return pearl_algs.generate_vanadium_absorb_corrections(van_ws=ws_to_match)
......
...@@ -18,6 +18,7 @@ long_mode_off_params = { ...@@ -18,6 +18,7 @@ long_mode_off_params = {
"monitor_integration_range": (0.6, 5.0), "monitor_integration_range": (0.6, 5.0),
# This needs to be greater than the bank TOF cropping values or you will get data that divides to 0/inf # This needs to be greater than the bank TOF cropping values or you will get data that divides to 0/inf
"raw_data_tof_cropping": (0, 19995), "raw_data_tof_cropping": (0, 19995),
"vanadium_tof_cropping": (1400, 19990),
"tof_cropping_ranges": [ "tof_cropping_ranges": [
(1500, 19900), # Bank 1 (1500, 19900), # Bank 1
(1500, 19900), # Bank 2 (1500, 19900), # Bank 2
...@@ -40,7 +41,8 @@ long_mode_on_params = { ...@@ -40,7 +41,8 @@ long_mode_on_params = {
"monitor_lambda_crop_range": (5.9, 12.0), "monitor_lambda_crop_range": (5.9, 12.0),
"monitor_integration_range": (6, 10), "monitor_integration_range": (6, 10),
# This needs to be greater than the bank TOF cropping values or you will get data that divides to 0/inf # This needs to be greater than the bank TOF cropping values or you will get data that divides to 0/inf
"raw_data_tof_cropping": (20295, 39995), "raw_data_tof_cropping": (20280, 39995),
"vanadium_tof_cropping": (20295, 39993),
"tof_cropping_ranges": [ "tof_cropping_ranges": [
(20300, 39990), # Bank 1 (20300, 39990), # Bank 1
(20300, 39990), # Bank 2 (20300, 39990), # Bank 2
......
...@@ -23,4 +23,5 @@ attr_mapping = [("attenuation_file_name", "attenuation_file_name"), ...@@ -23,4 +23,5 @@ attr_mapping = [("attenuation_file_name", "attenuation_file_name"),
("tt_mode", "tt_mode"), ("tt_mode", "tt_mode"),
("user_name", "user_name"), ("user_name", "user_name"),
("vanadium_absorb_file", "van_absorb_file"), ("vanadium_absorb_file", "van_absorb_file"),
("vanadium_tof_cropping", "van_tof_cropping"),
("vanadium_normalisation", "van_norm")] ("vanadium_normalisation", "van_norm")]
...@@ -111,11 +111,16 @@ class Polaris(AbstractInst): ...@@ -111,11 +111,16 @@ class Polaris(AbstractInst):
return d_spacing_group return d_spacing_group
def crop_short_long_mode(self, ws_to_crop): def crop_raw_to_expected_tof_range(self, ws_to_crop):
cropped_ws = common.crop_in_tof(ws_to_crop=ws_to_crop, x_min=self._inst_settings.raw_data_crop_values[0], cropped_ws = common.crop_in_tof(ws_to_crop=ws_to_crop, x_min=self._inst_settings.raw_data_crop_values[0],
x_max=self._inst_settings.raw_data_crop_values[1]) x_max=self._inst_settings.raw_data_crop_values[1])
return cropped_ws return cropped_ws
def crop_van_to_expected_tof_range(self, van_ws_to_crop):
cropped_ws = common.crop_in_tof(ws_to_crop=van_ws_to_crop, x_min=self._inst_settings.van_crop_values[0],
x_max=self._inst_settings.van_crop_values[-1])
return cropped_ws
def crop_banks_to_user_tof(self, focused_banks): def crop_banks_to_user_tof(self, focused_banks):
return common.crop_banks_in_tof(focused_banks, self._inst_settings.tof_cropping_values) return common.crop_banks_in_tof(focused_banks, self._inst_settings.tof_cropping_values)
......
...@@ -4,8 +4,9 @@ file_names = { ...@@ -4,8 +4,9 @@ file_names = {
script_params = { script_params = {
"apply_solid_angle": False, "apply_solid_angle": False,
"raw_data_cropping_values": (800, 20000), "raw_data_cropping_values": (750, 20000),
"spline_coefficient": 100 "spline_coefficient": 100,
"vanadium_cropping_values": (800, 19995)
} }
tof_cropping_ranges = [ tof_cropping_ranges = [
......
...@@ -178,4 +178,7 @@ def _read_masking_file(masking_file_path): ...@@ -178,4 +178,7 @@ def _read_masking_file(masking_file_path):
else: else:
line.rstrip() line.rstrip()
bank_masking_list.append(line.split()) bank_masking_list.append(line.split())
if bank_masking_list:
all_banks_masking_list.append(bank_masking_list)
return all_banks_masking_list return all_banks_masking_list
...@@ -14,4 +14,5 @@ attr_mapping = [("apply_solid_angle", "solid_angle_on"), ...@@ -14,4 +14,5 @@ attr_mapping = [("apply_solid_angle", "solid_angle_on"),
("spline_coefficient", "spline_coeff"), ("spline_coefficient", "spline_coeff"),
("tof_cropping_ranges", "tof_cropping_values"), ("tof_cropping_ranges", "tof_cropping_values"),
("output_directory", "output_dir"), ("output_directory", "output_dir"),
("user_name", "user_name")] ("user_name", "user_name"),
("vanadium_cropping_values", "van_crop_values")]
...@@ -16,7 +16,7 @@ def create_van(instrument, van, empty, absorb, gen_absorb): ...@@ -16,7 +16,7 @@ def create_van(instrument, van, empty, absorb, gen_absorb):
instrument=instrument) instrument=instrument)
# Crop the tail end of the data on PEARL if they are not capturing slow neutrons # Crop the tail end of the data on PEARL if they are not capturing slow neutrons
corrected_van_ws = instrument.crop_short_long_mode(ws_to_crop=corrected_van_ws) corrected_van_ws = instrument.crop_raw_to_expected_tof_range(ws_to_crop=corrected_van_ws)
corrected_van_ws = mantid.AlignDetectors(InputWorkspace=corrected_van_ws, corrected_van_ws = mantid.AlignDetectors(InputWorkspace=corrected_van_ws,
CalibrationFile=run_details.calibration_file_path) CalibrationFile=run_details.calibration_file_path)
...@@ -32,6 +32,9 @@ def create_van(instrument, van, empty, absorb, gen_absorb): ...@@ -32,6 +32,9 @@ def create_van(instrument, van, empty, absorb, gen_absorb):
GroupingFileName=run_details.grouping_file_path) GroupingFileName=run_details.grouping_file_path)
focused_spectra = common.extract_ws_spectra(focused_vanadium) focused_spectra = common.extract_ws_spectra(focused_vanadium)
# Crop back to sane TOF as for PEARL at least 20,000-40,000 microseconds is extrapolated
# to 0-60,000 microseconds
focused_spectra = instrument.crop_van_to_expected_tof_range(focused_spectra)
d_spacing_group = _save_focused_vanadium(instrument=instrument, run_details=run_details, d_spacing_group = _save_focused_vanadium(instrument=instrument, run_details=run_details,
van_spectra=focused_spectra) van_spectra=focused_spectra)
_create_vanadium_splines(focused_spectra, instrument, run_details) _create_vanadium_splines(focused_spectra, instrument, run_details)
......
...@@ -33,7 +33,7 @@ def _focus_one_ws(ws, run_number, instrument, perform_vanadium_norm): ...@@ -33,7 +33,7 @@ def _focus_one_ws(ws, run_number, instrument, perform_vanadium_norm):
# Compensate for empty sample if specified # Compensate for empty sample if specified
input_workspace = common.subtract_sample_empty(ws_to_correct=ws, instrument=instrument, input_workspace = common.subtract_sample_empty(ws_to_correct=ws, instrument=instrument,
empty_sample_ws_string=run_details.empty_runs) empty_sample_ws_string=run_details.empty_runs)
input_workspace = instrument.crop_short_long_mode(ws_to_crop=input_workspace) input_workspace = instrument.crop_raw_to_expected_tof_range(ws_to_crop=input_workspace)
# Align / Focus # Align / Focus
input_workspace = mantid.AlignDetectors(InputWorkspace=input_workspace, input_workspace = mantid.AlignDetectors(InputWorkspace=input_workspace,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment