Ejemplo n.º 1
0
    def get_data_metadata_from_selection_tab(self):
        base_folder = Path(self.parent.working_dir)
        o_get = Get(parent=self.parent)

        index_axis, _ = o_get.specified_x_axis(xaxis='index')
        tof_axis, _ = o_get.specified_x_axis(xaxis='tof')
        lambda_axis, _ = o_get.specified_x_axis('lambda')
        fitting_peak_range = self.parent.bragg_edge_range
        distance_detector_sample = str(
            self.parent.ui.distance_detector_sample.text())
        detector_offset = str(self.parent.ui.detector_offset.text())
        kropff_fitting_values = self.collect_all_kropff_fitting_values()
        march_dollase_fitting_values = self.collect_all_march_dollase_fitting_values(
        )

        dict_regions = o_get.all_russian_doll_region_full_infos()
        metadata = ExportHandler.make_metadata(
            base_folder=base_folder,
            fitting_peak_range=fitting_peak_range,
            dict_regions=dict_regions,
            distance_detector_sample=distance_detector_sample,
            detector_offset=detector_offset,
            kropff_fitting_values=kropff_fitting_values,
            march_dollase_fitting_values=march_dollase_fitting_values)
        self.add_fitting_infos_to_metadata(metadata)

        metadata.append("#")
        metadata.append(
            "#File Index, TOF(micros), lambda(Angstroms), ROIs (see above)")
        data = ExportHandler.format_data(col1=index_axis,
                                         col2=tof_axis,
                                         col3=lambda_axis,
                                         dict_regions=dict_regions)

        return data, metadata
Ejemplo n.º 2
0
    def fit_that_selection_pushed_by_program(self, initialize_region=True):
        o_get = Get(parent=self)
        x_axis = o_get.all_x_axis()
        dict_regions = o_get.all_russian_doll_region_full_infos()

        o_init = PeakFittingInitialization(parent=self)
        fitting_input_dictionary = o_init.fitting_input_dictionary(nbr_rois=len(dict_regions))
        o_init.set_top_keys_values(fitting_input_dictionary,
                                   {'xaxis': x_axis,
                                    'bragg_edge_range': self.bragg_edge_range})
        self.append_dict_regions_to_fitting_input_dictionary(dict_regions, fitting_input_dictionary)

        # fitting_input_dictionary['xaxis'] = x_axis
        # fitting_input_dictionary['bragg_edge_range'] = self.bragg_edge_range

        self.fitting_input_dictionary = fitting_input_dictionary

        o_kropff = Kropff(parent=self)
        o_kropff.reset_all_table()

        o_march = MarchDollase(parent=self)
        o_march.reset_table()

        if initialize_region:
            self.initialize_default_peak_regions()
        else:
            if self.fitting_procedure_started['kropff']:
                o_kropff.fill_table_with_fitting_information()
        o_march.fill_tables_with_fitting_information()

        if initialize_region:
            o_march_fitting = MarchDollaseFittingJobHandler(parent=self)
            o_march_fitting.initialize_fitting_input_dictionary()

        self.ui.tabWidget.setTabEnabled(1, True)
        self.ui.actionExport.setEnabled(True)
        self.select_first_row_of_all_fitting_table()