Skip to content
Snippets Groups Projects
Commit eec0f371 authored by Conor Finn's avatar Conor Finn
Browse files

RE #26849 Simplify GSAS file generation

parent 2712dad8
No related branches found
No related tags found
No related merge requests found
...@@ -284,46 +284,38 @@ class CalibrationModel(object): ...@@ -284,46 +284,38 @@ class CalibrationModel(object):
:param bank: Optional parameter to crop by bank :param bank: Optional parameter to crop by bank
:param spectrum_numbers: Optional parameter to crop using spectrum numbers. :param spectrum_numbers: Optional parameter to crop using spectrum numbers.
""" """
def generate_both_banks_file(difc_list, tzero_list): kwargs = {"ceria_run": sample_path, "vanadium_run": vanadium_path}
file_path = calibration_dir + self._generate_output_file_name(
vanadium_path, sample_path, instrument, bank="all") def south_kwargs():
write_ENGINX_GSAS_iparam_file(file_path, kwargs["template_file"] = SOUTH_BANK_TEMPLATE_FILE
difc_list, kwargs["bank_names"] = ["South"]
tzero_list,
ceria_run=sample_path, def north_kwargs():
vanadium_run=vanadium_path) kwargs["template_file"] = NORTH_BANK_TEMPLATE_FILE
kwargs["bank_names"] = ["North"]
def generate_north_or_custom_bank_file(difc_north, tzero_north, bank_name="north"):
file_path = calibration_dir + self._generate_output_file_name( def generate_output_file(difc_list, tzero_list, bank_name, kwargs_to_pass):
vanadium_path, sample_path, instrument, bank=bank_name) file_path = calibration_dir + self._generate_output_file_name(vanadium_path, sample_path, instrument, bank=bank_name)
write_ENGINX_GSAS_iparam_file(file_path, [difc_north], [tzero_north], write_ENGINX_GSAS_iparam_file(file_path, difc_list, tzero_list, **kwargs_to_pass)
ceria_run=sample_path,
vanadium_run=vanadium_path,
template_file=NORTH_BANK_TEMPLATE_FILE,
bank_names=["North"])
def generate_south_bank_file(difc_south, tzero_south):
file_path = calibration_dir + self._generate_output_file_name(
vanadium_path, sample_path, instrument, bank="south")
write_ENGINX_GSAS_iparam_file(file_path, [difc_south], [tzero_south],
ceria_run=sample_path,
vanadium_run=vanadium_path,
template_file=SOUTH_BANK_TEMPLATE_FILE,
bank_names=["South"])
if not path.exists(calibration_dir): if not path.exists(calibration_dir):
makedirs(calibration_dir) makedirs(calibration_dir)
if bank is None and spectrum_numbers is None: if bank is None and spectrum_numbers is None:
generate_both_banks_file(difc, tzero) generate_output_file(difc, tzero, "all", kwargs)
generate_north_or_custom_bank_file(difc[0], tzero[0]) north_kwargs()
generate_south_bank_file(difc[1], tzero[1]) generate_output_file([difc[0]], [tzero[0]], "north", kwargs)
south_kwargs()
generate_output_file([difc[1]], [tzero[1]], "south", kwargs)
elif bank == "1": elif bank == "1":
generate_north_or_custom_bank_file(difc[0], tzero[0]) north_kwargs()
generate_output_file([difc[0]], [tzero[0]], "north", kwargs)
elif bank == "2": elif bank == "2":
generate_south_bank_file(difc[0], tzero[0]) south_kwargs()
elif bank is None: generate_output_file([difc[0]], [tzero[0]], "south", kwargs)
generate_north_or_custom_bank_file(difc[0], tzero[0], "cropped") elif bank is None: # Custom cropped files use the north bank template.
north_kwargs()
generate_output_file([difc[0]], [tzero[0]], "cropped", kwargs)
@staticmethod @staticmethod
def get_info_from_file(file_path): def get_info_from_file(file_path):
......
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