Esempio n. 1
0
    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
Esempio n. 2
0
    def _get_run_details(self, run_number):
        if self._run_details_last_run_number == run_number:
            return self._run_details_cached_obj

        input_run_number_list = common.generate_run_numbers(run_number_string=run_number)
        configuration = polaris_calib_parser.get_calibration_dict(run_number=input_run_number_list[0])

        if self._chopper_on:
            chopper_config = configuration["chopper_on"]
        else:
            chopper_config = configuration["chopper_off"]

        empty_runs = chopper_config["empty_run_numbers"]
        vanadium_runs = chopper_config["vanadium_run_numbers"]
        solid_angle_file_name = self._generate_solid_angle_file_name(vanadium_run_string=vanadium_runs)
        splined_vanadium_name = self._generate_splined_van_name(vanadium_run_string=vanadium_runs)
        cycle = configuration["label"]

        calibration_dir = os.path.join(self.calibration_dir, cycle)
        calibration_full_path = os.path.join(calibration_dir, configuration["offset_file_name"])
        grouping_full_path = os.path.join(calibration_dir, configuration["offset_file_name"])
        solid_angle_file_path = os.path.join(calibration_dir, solid_angle_file_name)
        splined_vanadium = os.path.join(calibration_dir, splined_vanadium_name)

        calibration_details = RunDetails(calibration_path=calibration_full_path, grouping_path=grouping_full_path,
                                         vanadium_runs=vanadium_runs, run_number=run_number)
        calibration_details.label = cycle
        calibration_details.sample_empty = empty_runs
        calibration_details.splined_vanadium = splined_vanadium
        calibration_details.solid_angle_corr = solid_angle_file_path

        # Hold obj in case same run range is requested
        self._run_details_last_run_number = run_number
        self._run_details_cached_obj = calibration_details

        return calibration_details