Ejemplo n.º 1
0
    def set_data(self, data):
        if not data is None:
            try:
                if data.measured_dataset is None:
                    raise ValueError("Measured Dataset is missing")

                if data.measured_dataset.phases is None:
                    raise ValueError("Phases are missing")

                self.check_input_global_parameters(data)

                self.fit_global_parameters = data.duplicate()

                phases = self.fit_global_parameters.measured_dataset.phases

                tabs_to_remove = self.get_current_dimension() - len(phases)

                if tabs_to_remove > 0:
                    for index in range(tabs_to_remove):
                        self.parameter_tabs.removeTab(-1)
                        self.parameter_box_array.pop()

                for phase_index in range(len(phases)):
                    parameters = self.get_parameter_of_phase_item(phase_index)

                    if phase_index < self.get_current_dimension():
                        self.parameter_tabs.setTabText(
                            phase_index,
                            OWGenericWidget.phase_name(
                                self.fit_global_parameters, phase_index))

                        parameter_box = self.get_parameter_box(phase_index)

                        if not parameters is None:
                            parameter_box.set_data(parameters)
                    else:
                        parameter_box = self.get_empty_parameter_box_instance(
                            gui.createTabPage(
                                self.parameter_tabs,
                                OWGenericWidget.phase_name(
                                    self.fit_global_parameters, phase_index)),
                            phase_index)

                        if not parameters is None:
                            parameter_box.set_data(parameters)

                        self.parameter_box_array.append(parameter_box)

                self.dumpSettings()

                if self.is_automatic_run:
                    self.send_parameter()

            except Exception as e:
                QMessageBox.critical(self, "Error", str(e), QMessageBox.Ok)

                if self.IS_DEVELOP: raise e
 def set_data(self, thermal_parameters):
     for phase_index in range(len(self.debye_waller_of_phases_box_array)):
         debye_waller_of_phases_box = self.debye_waller_of_phases_box_array[
             phase_index]
         debye_waller_of_phases_box.set_data(thermal_parameters)
         self.debye_waller_of_phases_tabs.setTabText(
             phase_index,
             OWGenericWidget.phase_name(self.widget.fit_global_parameters,
                                        phase_index))
Ejemplo n.º 3
0
    def set_data(self, data):
        if not data is None:
            try:
                self.fit_global_parameters = data.duplicate()

                diffraction_patterns = self.fit_global_parameters.measured_dataset.diffraction_patterns
                phases = self.fit_global_parameters.measured_dataset.phases

                if diffraction_patterns is None:
                    raise ValueError("No Diffraction Pattern in input data!")

                if not phases is None:
                    if (len(phases) != len(self.phases_box_array)):
                        self.phases_tabs.clear()
                        self.phases_box_array = []

                        for index in range(len(phases)):
                            phase_tab = gui.createTabPage(
                                self.phases_tabs,
                                OWGenericWidget.phase_name(
                                    self.fit_global_parameters, index))

                            if index < len(self.a):  # keep the existing
                                phase_box = self.get_phase_box_instance(
                                    index, phase_tab)
                            else:
                                phase_box = self.get_empty_phase_box_instance(
                                    index, phase_tab)

                            self.phases_box_array.append(phase_box)
                    else:
                        for index in range(len(phases)):
                            self.phases_box_array[index].set_data(
                                phases[index])

                self.dumpSettings()

                if self.is_automatic_run:
                    self.send_phases()

            except Exception as e:
                QMessageBox.critical(self, "Error", str(e), QMessageBox.Ok)

                if self.IS_DEVELOP: raise e
    def __init__(self,
                 widget=None,
                 parent=None,
                 diffraction_pattern_index=0,
                 use_debye_waller_factors=[],
                 debye_waller_factors=[],
                 debye_waller_factors_fixed=[],
                 debye_waller_factors_has_min=[],
                 debye_waller_factors_min=[],
                 debye_waller_factors_has_max=[],
                 debye_waller_factors_max=[],
                 debye_waller_factors_function=[],
                 debye_waller_factors_function_value=[]):
        super(DebyeWallerBox, self).__init__()

        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 35)
        self.setFixedHeight(140)

        self.widget = widget
        self.diffraction_pattern_index = diffraction_pattern_index

        self.use_debye_waller_factors = use_debye_waller_factors
        self.debye_waller_factors = debye_waller_factors
        self.debye_waller_factors_fixed = debye_waller_factors_fixed
        self.debye_waller_factors_has_min = debye_waller_factors_has_min
        self.debye_waller_factors_min = debye_waller_factors_min
        self.debye_waller_factors_has_max = debye_waller_factors_has_max
        self.debye_waller_factors_max = debye_waller_factors_max
        self.debye_waller_factors_function = debye_waller_factors_function
        self.debye_waller_factors_function_value = debye_waller_factors_function_value

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH - 45

        parent.layout().addWidget(self)
        container = self

        self.debye_waller_of_phases_tabs = gui.tabWidget(container)
        self.debye_waller_of_phases_box_array = []

        for phase_index in range(len(self.debye_waller_factors)):
            debye_waller_of_phase_tab = gui.createTabPage(
                self.debye_waller_of_phases_tabs,
                OWGenericWidget.phase_name(self.widget.fit_global_parameters,
                                           phase_index))

            debye_waller_of_phase_box = DebyeWallerOfPhaseBox(
                widget=widget,
                widget_container=self,
                parent=debye_waller_of_phase_tab,
                diffraction_pattern_index=diffraction_pattern_index,
                phase_index=phase_index,
                use_debye_waller_factor=self.
                use_debye_waller_factors[phase_index],
                debye_waller_factor=self.debye_waller_factors[phase_index],
                debye_waller_factor_fixed=self.
                debye_waller_factors_fixed[phase_index],
                debye_waller_factor_has_min=self.
                debye_waller_factors_has_min[phase_index],
                debye_waller_factor_min=self.
                debye_waller_factors_min[phase_index],
                debye_waller_factor_has_max=self.
                debye_waller_factors_has_max[phase_index],
                debye_waller_factor_max=self.
                debye_waller_factors_max[phase_index],
                debye_waller_factor_function=self.
                debye_waller_factors_function[phase_index],
                debye_waller_factor_function_value=self.
                debye_waller_factors_function_value[phase_index])

            self.debye_waller_of_phases_box_array.append(
                debye_waller_of_phase_box)
 def set_data(self, line_profile):
     for phase_index in range(len(self.reflections_of_phases_box_array)):
         reflections_of_phases_box = self.reflections_of_phases_box_array[phase_index]
         reflections_of_phases_box.set_data(line_profile)
         self.reflections_of_phases_tabs.setTabText(phase_index, OWGenericWidget.phase_name(self.widget.fit_global_parameters, phase_index))
    def __init__(self,
                 widget=None,
                 parent=None,
                 diffraction_pattern_index=0,
                 reflections_of_phases=[],
                 limits=[],
                 limit_types=[]):

        super(LineProfileBox, self).__init__()

        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)
        self.setFixedWidth(widget.CONTROL_AREA_WIDTH - 35)
        self.setFixedHeight(480)

        self.widget = widget
        self.diffraction_pattern_index = diffraction_pattern_index

        self.reflections_of_phases = reflections_of_phases
        self.limits = limits
        self.limit_types = limit_types

        self.CONTROL_AREA_WIDTH = widget.CONTROL_AREA_WIDTH-45

        parent.layout().addWidget(self)
        container = self

        self.reflections_of_phases_tabs = gui.tabWidget(container)
        self.reflections_of_phases_box_array = []

        for phase_index in range(len(self.reflections_of_phases)):
            reflections_of_phase_tab = gui.createTabPage(self.reflections_of_phases_tabs, OWGenericWidget.phase_name(self.widget.fit_global_parameters, phase_index))

            reflections_of_phase_box = ReflectionsOfPhaseBox(widget=widget,
                                                             widget_container=self,
                                                             parent=reflections_of_phase_tab,
                                                             diffraction_pattern_index = diffraction_pattern_index,
                                                             phase_index=phase_index,
                                                             reflections_of_phase = self.reflections_of_phases[phase_index],
                                                             limit                = self.limits[phase_index],
                                                             limit_type           = self.limit_types[phase_index])

            self.reflections_of_phases_box_array.append(reflections_of_phase_box)