Beispiel #1
0
 def action_background_args_changed(self):
     if self.view.auto_bkg.currentText() == "None":
         ConfigService.setString(self.AUTO_BACKGROUND, "")
     else:
         background_string = self.view.auto_bkg.currentText(
         ) + " " + self.view.background_args.text()
         ConfigService.setString(self.AUTO_BACKGROUND, background_string)
Beispiel #2
0
    def action_show_minor_ticks_changed(self, state):
        ConfigService.setString(PlotProperties.SHOW_MINOR_TICKS.value,
                                "On" if state == Qt.Checked else "Off")
        self.view.show_minor_gridlines.setEnabled(state == Qt.Checked)

        if not self.view.show_minor_gridlines.isEnabled():
            self.view.show_minor_gridlines.setChecked(False)
Beispiel #3
0
 def action_auto_background_changed(self, item_name):
     if item_name == "None":
         ConfigService.setString(FittingProperties.AUTO_BACKGROUND.value,
                                 "")
         return
     background_string = item_name + " " + self.view.background_args.text()
     ConfigService.setString(FittingProperties.AUTO_BACKGROUND.value,
                             background_string)
Beispiel #4
0
    def action_usage_data_changed(self, checkedState):
        if not checkedState:
            response = self.usage_reporting_verification_view.exec()

            if not response:
                # No was clicked, or no button was clicked
                # set the checkbox back to checked
                checkedState = Qt.Checked
                self.view.chkAllowUsageData.setCheckState(checkedState)

        ConfigService.setString(self.USAGE_REPORTING, "1" if checkedState == Qt.Checked else "0")
Beispiel #5
0
 def action_show_invisible_workspaces(self, state):
     ConfigService.setString(
         GeneralProperties.SHOW_INVISIBLE_WORKSPACES.value,
         str(bool(state)))
Beispiel #6
0
 def action_crystallography_convention(self, state):
     ConfigService.setString(
         GeneralProperties.CRYSTALLOGRAPY_CONV.value,
         "Crystallography" if state == Qt.Checked else "Inelastic")
Beispiel #7
0
 def action_time_between_recovery(self, value):
     ConfigService.setString(
         GeneralProperties.PR_TIME_BETWEEN_RECOVERY.value, str(value))
Beispiel #8
0
 def action_use_notifications_modified(self, state):
     ConfigService.setString(GeneralProperties.USE_NOTIFICATIONS.value,
                             "On" if bool(state) else "Off")
Beispiel #9
0
 def set_hidden_algorithms_string(self, _):
     categories_string = ';'.join(
         self._create_hidden_categories_string(
             self.view.algorithm_tree_widget))
     ConfigService.setString(self.HIDDEN_ALGORITHMS, categories_string)
Beispiel #10
0
 def action_total_number_checkpoints(self, value):
     ConfigService.setString(self.PR_NUMBER_OF_CHECKPOINTS, str(value))
Beispiel #11
0
 def action_capsize_changed(self, value):
     ConfigService.setString(PlotProperties.CAPSIZE.value, str(value))
Beispiel #12
0
 def action_show_title_changed(self, state):
     ConfigService.setString(PlotProperties.SHOW_TITLE.value,
                             "On" if state == Qt.Checked else "Off")
Beispiel #13
0
 def action_normalization_changed(self, state):
     ConfigService.setString(PlotProperties.NORMALIZATION.value,
                             "On" if state == Qt.Checked else "Off")
Beispiel #14
0
 def action_project_recovery_enabled(self, state):
     ConfigService.setString(self.PR_RECOVERY_ENABLED, str(bool(state)))
Beispiel #15
0
 def action_show_invisible_workspaces(self, state):
     ConfigService.setString(self.SHOW_INVISIBLE_WORKSPACES, str(bool(state)))
Beispiel #16
0
 def action_instrument_changed(self, new_instrument):
     ConfigService.setString(self.INSTRUMENT, new_instrument)
Beispiel #17
0
    def __init__(self, Ion, Symmetry, **kwargs):
        """
        Constructor.

        @param Ion: A rare earth ion. Possible values:
                    Ce, Pr, Nd, Pm, Sm, Eu, Gd, Tb, Dy, Ho, Er, Tm, Yb

        @param Symmetry: Symmetry of the field. Possible values:
                         C1, Ci, C2, Cs, C2h, C2v, D2, D2h, C4, S4, C4h, D4, C4v, D2d, D4h, C3,
                         S6, D3, C3v, D3d, C6, C3h, C6h, D6, C6v, D3h, D6h, T, Td, Th, O, Oh

        @param kwargs: Other field parameters and attributes. Acceptable values include:
                        ToleranceEnergy:     energy tolerance,
                        ToleranceIntensity:  intensity tolerance,
                        ResolutionModel:     A resolution model.
                        FWHMVariation:       Absolute value of allowed variation of a peak width during a fit.
                        FixAllPeaks:         A boolean flag that fixes all parameters of the peaks.

                        Field parameters:

                        BmolX: The x-component of the molecular field,
                        BmolY: The y-component of the molecular field,
                        BmolZ: The z-component of the molecular field,
                        BextX: The x-component of the external field,
                        BextY: The y-component of the external field,
                        BextZ: The z-component of the external field,
                        B20: Real part of the B20 field parameter,
                        B21: Real part of the B21 field parameter,
                        B22: Real part of the B22 field parameter,
                        B40: Real part of the B40 field parameter,
                        B41: Real part of the B41 field parameter,
                        B42: Real part of the B42 field parameter,
                        B43: Real part of the B43 field parameter,
                        B44: Real part of the B44 field parameter,
                        B60: Real part of the B60 field parameter,
                        B61: Real part of the B61 field parameter,
                        B62: Real part of the B62 field parameter,
                        B63: Real part of the B63 field parameter,
                        B64: Real part of the B64 field parameter,
                        B65: Real part of the B65 field parameter,
                        B66: Real part of the B66 field parameter,
                        IB21: Imaginary part of the B21 field parameter,
                        IB22: Imaginary part of the B22 field parameter,
                        IB41: Imaginary part of the B41 field parameter,
                        IB42: Imaginary part of the B42 field parameter,
                        IB43: Imaginary part of the B43 field parameter,
                        IB44: Imaginary part of the B44 field parameter,
                        IB61: Imaginary part of the B61 field parameter,
                        IB62: Imaginary part of the B62 field parameter,
                        IB63: Imaginary part of the B63 field parameter,
                        IB64: Imaginary part of the B64 field parameter,
                        IB65: Imaginary part of the B65 field parameter,
                        IB66: Imaginary part of the B66 field parameter,


                        Each of the following parameters can be either a single float or an array of floats.
                        They are either all floats or all arrays of the same size.

                        IntensityScaling: A scaling factor for the intensity of each spectrum.
                        FWHM: A default value for the full width at half maximum of the peaks.
                        Temperature: A temperature "of the spectrum" in Kelvin
        """
        # This is to make sure that Lorentzians get evaluated properly
        ConfigService.setString('curvefitting.peakRadius', str(100))

        from .function import PeaksFunction
        self._ion = Ion
        self._symmetry = Symmetry
        self._toleranceEnergy = 1e-10
        self._toleranceIntensity = 1e-1
        self._fieldParameters = {}
        self._fieldTies = {}
        self._fieldConstraints = []
        self._temperature = None
        self._FWHM = None
        self._intensityScaling = 1.0
        self._resolutionModel = None
        self._fwhmVariation = None
        self._fixAllPeaks = False

        for key in kwargs:
            if key == 'ToleranceEnergy':
                self._toleranceEnergy = kwargs[key]
            elif key == 'ToleranceIntensity':
                self._toleranceIntensity = kwargs[key]
            elif key == 'IntensityScaling':
                self._intensityScaling = kwargs[key]
            elif key == 'FWHM':
                self._FWHM = kwargs[key]
            elif key == 'ResolutionModel':
                self.ResolutionModel = kwargs[key]
            elif key == 'Temperature':
                self._temperature = kwargs[key]
            elif key == 'FWHMVariation':
                self._fwhmVariation = kwargs[key]
            elif key == 'FixAllPeaks':
                self._fixAllPeaks = kwargs[key]
            else:
                # Crystal field parameters
                self._fieldParameters[key] = kwargs[key]

        if isinstance(self._temperature, list) or isinstance(self._temperature, np.ndarray):
            self.peaks = [PeaksFunction(firstIndex=1) for _ in self._temperature]
        else:
            self.peaks = PeaksFunction()
        self.background = None

        # Eigensystem
        self._dirty_eigensystem = True
        self._eigenvalues = None
        self._eigenvectors = None
        self._hamiltonian = None

        # Peak lists
        self._dirty_peaks = True
        self._peakList = None

        # Spectra
        self._dirty_spectra = True
        self._spectra = {}
        self._plot_window = {}

        self._setDefaultTies()
        self.chi2 = None
Beispiel #18
0
 def action_error_every_changed(self, value):
     ConfigService.setString(PlotProperties.ERROR_EVERY.value, str(value))
Beispiel #19
0
 def action_error_width_changed(self, value):
     ConfigService.setString(PlotProperties.ERROR_WIDTH.value, str(value))
Beispiel #20
0
 def action_legend_size_changed(self, value):
     ConfigService.setString(PlotProperties.LEGEND_FONT_SIZE.value,
                             str(value))
Beispiel #21
0
 def action_cap_thickness_changed(self, value):
     ConfigService.setString(PlotProperties.CAP_THICKNESS.value, str(value))
Beispiel #22
0
 def action_time_between_recovery(self, value):
     ConfigService.setString(self.PR_TIME_BETWEEN_RECOVERY, str(value))
Beispiel #23
0
 def action_legend_location_changed(self, location):
     ConfigService.setString(PlotProperties.LEGEND_LOCATION.value,
                             str(location))
Beispiel #24
0
 def action_show_minor_gridlines_changed(self, state):
     ConfigService.setString(PlotProperties.SHOW_MINOR_GRIDLINES.value,
                             "On" if state == Qt.Checked else "Off")
Beispiel #25
0
    def action_default_colormap_changed(self):
        colormap = self.view.default_colormap_combo_box.currentText()
        if self.view.reverse_colormap_check_box.isChecked():
            colormap += '_r'

        ConfigService.setString(PlotProperties.COLORMAP.value, colormap)
Beispiel #26
0
 def action_default_y_axes_changed(self, axes_scale):
     ConfigService.setString(PlotProperties.Y_AXES_SCALE.value, axes_scale)
Beispiel #27
0
 def set_hidden_interfaces_string(self, _):
     categories_string = ';'.join(
         self._create_hidden_categories_string(
             self.view.interface_tree_widget))
     ConfigService.setString(self.HIDDEN_INTERFACES, categories_string)
Beispiel #28
0
 def action_line_style_changed(self, style):
     ConfigService.setString(PlotProperties.LINE_STYLE.value, style)
Beispiel #29
0
 def action_project_recovery_enabled(self, state):
     ConfigService.setString(GeneralProperties.PR_RECOVERY_ENABLED.value,
                             str(bool(state)))
Beispiel #30
0
 def action_draw_style_changed(self, style):
     ConfigService.setString(PlotProperties.DRAW_STYLE.value, style)
Beispiel #31
0
 def action_total_number_checkpoints(self, value):
     ConfigService.setString(
         GeneralProperties.PR_NUMBER_OF_CHECKPOINTS.value, str(value))
Beispiel #32
0
 def action_line_width_changed(self, value):
     ConfigService.setString(PlotProperties.LINE_WIDTH.value, str(value))
Beispiel #33
0
 def action_instrument_changed(self, new_instrument):
     current_value = ConfigService.getString(
         GeneralProperties.INSTRUMENT.value)
     if new_instrument != current_value:
         ConfigService.setString(GeneralProperties.INSTRUMENT.value,
                                 new_instrument)
Beispiel #34
0
 def action_marker_style_changed(self, style):
     ConfigService.setString(PlotProperties.MARKER_STYLE.value, style)
Beispiel #35
0
 def action_use_open_gl(self, state):
     ConfigService.setString(GeneralProperties.OPENGL.value,
                             "On" if bool(state) else "Off")
Beispiel #36
0
 def action_marker_size_changed(self, value):
     ConfigService.setString(PlotProperties.MARKER_SIZE.value, str(value))