def _get_run_details(self, run_number): # TODO once we migrate this to another format (i.e. not the if/elif/else) implement cached val cycle_dict = self._get_label_information(run_number=run_number) calibration_file, grouping_file, van_absorb, van_file =\ pearl_calib_factory.get_calibration_filename(cycle=cycle_dict["cycle"], tt_mode=self._tt_mode) cycle, instrument_version = pearl_cycle_factory.get_cycle_dir(run_number) calibration_dir = self.calibration_dir calibration_full_path = os.path.join(calibration_dir, calibration_file) grouping_full_path = os.path.join(calibration_dir, grouping_file) van_absorb_full_path = os.path.join(calibration_dir, van_absorb) van_file_full_path = os.path.join(calibration_dir, van_file) run_details = RunDetails(calibration_path=calibration_full_path, grouping_path=grouping_full_path, vanadium_runs=van_file_full_path, run_number=run_number) run_details.vanadium_absorption = van_absorb_full_path run_details.label = cycle run_details.instrument_version = instrument_version # TODO remove this when we move to saving splined van ws on PEARL run_details.splined_vanadium = run_details.vanadium return run_details
def _get_label_information(self, run_number): # TODO remove this when we move to combining CAL/RUN factories run_input = "" if isinstance(run_number, int) or run_number.isdigit(): run_input = int(run_number) else: # Only take first valid number as it is probably of the form 12345_12350 for character in run_number: if character.isdigit(): run_input += character else: break cycle, instrument_version = pearl_cycle_factory.get_cycle_dir(run_input) cycle_information = {'cycle': cycle, 'instrument_version': instrument_version} return cycle_information