def send_strain(self):
        try:
            if not self.fit_global_parameters is None:
                if not self.rho_function==1: congruence.checkStrictlyPositiveNumber(self.rho, "\u03c1")
                if not self.Re_function==1: congruence.checkStrictlyPositiveNumber(self.Re, "Re")
                if not self.mix_function==1: congruence.checkPositiveNumber(self.mix, "mix")
                if not self.b_function==1: congruence.checkStrictlyPositiveNumber(self.b, "b")

                self.fit_global_parameters.strain_parameters = [KrivoglazWilkensModel(rho=self.populate_parameter("rho", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      Re=self.populate_parameter("Re", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      Ae=self.populate_parameter("Ae", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      Be=self.populate_parameter("Be", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      As=self.populate_parameter("As", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      Bs=self.populate_parameter("Bs", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      mix=self.populate_parameter("mix", KrivoglazWilkensModel.get_parameters_prefix()),
                                                                                      b=self.populate_parameter("b", KrivoglazWilkensModel.get_parameters_prefix()))]

                self.send("Fit Global Parameters", self.fit_global_parameters)

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

            if self.IS_DEVELOP: raise e
示例#2
0
    def set_coordination_number(self, coordination_number):
        congruence.checkPositiveNumber(coordination_number,
                                       "Coordination Number")

        self.coordination_number = coordination_number

        if self.coordination_number > 0:
            self.nearest_neighbours = numpy.zeros(self.coordination_number)
        else:
            self.nearest_neighbours = None
示例#3
0
    def send_lorentz_polarization(self):
        try:
            if self.use_polarization_factor == 1:
                congruence.checkPositiveNumber(self.degree_of_polarization,
                                               "Deg. Pol.")
                congruence.checkLessOrEqualThan(self.degree_of_polarization,
                                                1.0, "Deg. Pol.", "1.0")

            if not self.fit_global_parameters is None:
                if self.use_polarization_factor == 1 and self.use_twotheta_mono == 1:
                    congruence.checkStrictlyPositiveAngle(
                        self.twotheta_mono, "2\u03B8 Monochromator")

                if self.fit_global_parameters.fit_initialization.thermal_polarization_parameters is None:
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters = \
                        [ThermalPolarizationParameters(debye_waller_factor=None,
                                                       use_lorentz_factor=self.use_lorentz_factor==1,
                                                       lorentz_formula = self.lorentz_formula,
                                                       use_polarization_factor=self.use_polarization_factor,
                                                       twotheta_mono=None if (self.use_polarization_factor==0 or self.use_twotheta_mono==0) else self.twotheta_mono,
                                                       beampath=self.beampath,
                                                       degree_of_polarization=self.degree_of_polarization)]
                else:
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].use_lorentz_factor = self.use_lorentz_factor == 1
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].lorentz_formula = self.lorentz_formula
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].use_polarization_factor = self.use_polarization_factor == 1
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].twotheta_mono = None if (
                            self.use_polarization_factor == 0
                            or self.use_twotheta_mono
                            == 0) else self.twotheta_mono
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].degree_of_polarization = self.degree_of_polarization
                    self.fit_global_parameters.fit_initialization.thermal_polarization_parameters[
                        0].beampath = self.beampath

                self.send("Fit Global Parameters", self.fit_global_parameters)

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

            if self.IS_DEVELOP: raise e
 def _check_attributes_congruence(self):
     if self.s is None:
         congruence.checkPositiveNumber(self.twotheta, "twotheta")
     if self.twotheta is None:
         congruence.checkPositiveNumber(self.s, "s")