Ejemplo n.º 1
0
    def update_fitting_plot(self):
        o_gui = GuiUtility(parent=self)
        algorithm_tab_selected = o_gui.get_tab_selected(tab_ui=self.ui.tab_algorithm)

        if algorithm_tab_selected == 'Kropff':
            o_kropff = Kropff(parent=self)
            o_kropff.update_fitting_plot()

        elif algorithm_tab_selected == 'March-Dollase':
            o_march = MarchDollase(parent=self)
            o_march.update_fitting_plot()
Ejemplo n.º 2
0
    def march_dollase_fitting_range_changed(self):
        o_march = MarchDollase(parent=self)
        o_march.update_roi_labels()

        o_fit = MarchDollaseFittingJobHandler(parent=self)
        o_fit.initialize_d_spacing()
        o_march.fill_history_table_with_fitting_information()
Ejemplo n.º 3
0
    def march_dollase_table_state_changed(self, state=None, row=None, column=None):
        o_march = MarchDollase(parent=self)
        if row == 0:
            _widget = self.ui.march_dollase_user_input_table.cellWidget(row, column).children()[-1]
            if (column == 1) or (column == 2):
                _textedit = _widget
                _textedit.setText(o_march.get_initial_parameter_value(column=column))
                _textedit.setVisible(not state)
            elif column == 0:
                _label = _widget
                _label.setText("{:0.6f}".format(np.float(o_march.get_initial_parameter_value(column=column))))
                _label.setVisible(not state)
            else:
                _label = _widget
                _label.setText("Row dependent")
                _label.setVisible(not state)

        o_march.save_table_history_and_initial_parameters()
Ejemplo n.º 4
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()
Ejemplo n.º 5
0
 def march_dollase_result_table_right_clicked(self, point):
     o_march = MarchDollase(parent=self)
     o_march.result_table_right_click()
Ejemplo n.º 6
0
 def march_dollase_advanced_mode_clicked(self):
     o_march = MarchDollase(parent=self)
     o_march.advanced_mode_clicked()
     o_fit = MarchDollaseFittingJobHandler(parent=self)
     o_fit.initialize_fitting_input_dictionary()
     o_march.fill_history_table_with_fitting_information()
Ejemplo n.º 7
0
 def march_dollase_table_right_clicked(self):
     o_march = MarchDollase(parent=self)
     o_march.table_right_clicked()
Ejemplo n.º 8
0
 def march_dollase_move_row_down_clicked(self):
     o_march = MarchDollase(parent=self)
     o_march.move_row_down()
Ejemplo n.º 9
0
 def march_dollase_table_clicked(self, row, column):
     o_march = MarchDollase(parent=self)
     o_march.table_clicked(row=row, column=column)
Ejemplo n.º 10
0
 def march_dollase_table_init_value_changed(self, column):
     o_march = MarchDollase(parent=self)
     o_march.save_table_history_and_initial_parameters()
Ejemplo n.º 11
0
    def run(self):
        working_dir = str(Path(self.parent.working_dir).parent)
        ascii_file = QFileDialog.getOpenFileName(self.parent,
                                                 caption="Select ASCII file",
                                                 directory=working_dir,
                                                 filter="ASCII (*.txt)")

        if ascii_file[0]:

            self.parent.full_reset_of_ui()
            self.parent.block_table_ui(True)
            self.parent.is_file_imported = True
            result_of_import = read_bragg_edge_fitting_ascii_format(
                full_file_name=str(ascii_file[0]))
            self.save_initial_roi_dimension_from_config_file(
                result_of_import['metadata']['columns']['3'])
            self.save_march_dollase_parameters(result_of_import['metadata'])
            self.parent.bragg_edge_range = result_of_import['metadata'][
                'bragg_edge_range']
            self.parent.bragg_peak_selection_range = result_of_import[
                'metadata']['bragg_peak_selection_range']

            self.update_selection_tab(result_of_import=result_of_import)
            self.update_interface(result_of_import=result_of_import)

            self.parent.ui.statusbar.showMessage(
                "{} has been imported!".format(ascii_file[0]), 10000)  # 10s
            self.parent.ui.statusbar.setStyleSheet("color: green")

            o_selection = BraggEdgeSelectionTab(parent=self.parent)
            o_selection.update_profile_of_bin_slider_widget()
            o_selection.update_selection_plot()

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

            self.parent.fitting_procedure_started[
                'kropff'] = result_of_import.get('metadata').get(
                    'kropff fitting '
                    'procedure '
                    'started', False)
            self.parent.fitting_procedure_started[
                'march-dollase'] = result_of_import.get('metadata').get(
                    'march-dollase fitting procedure started', False)

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

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

            if result_of_import.get('metadata').get(
                    'kropff fitting procedure started', False):
                # fill tables with minimum contains
                o_kropff.fill_table_with_fitting_information()

            if result_of_import.get('metadata').get(
                    'march-dollase fitting procedure started', False):
                # fill tables with minimum contains
                o_march.fill_tables_with_fitting_information()
            o_march.fill_history_table_with_fitting_information()

            self.parent.select_first_row_of_all_fitting_table()

            # self.parent.initialize_default_peak_regions()

            self.parent.block_table_ui(False)
            self.parent.update_vertical_line_in_profile_plot()
            self.parent.update_fitting_plot()
            self.parent.kropff_fitting_range_changed()

            o_gui = GuiUtility(parent=self.parent)
            o_gui.check_status_of_kropff_fitting_buttons()