Ejemplo n.º 1
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setValues([100.0])

        # Widgets
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(1, float("inf"), 0)
        self._widget.setEnabled(False)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 3
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(0, 1000, 0)
        self._widget.setValues([123])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 4
0
class RelativeUncertaintyTerminationField(TerminationFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(0.1, 100.0, 1)
        self._widget.setEnabled(True)
        self._widget.setValues([5.0])

        self._suffix.setChecked(True)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Relative uncertainty (%)"

    def description(self):
        return "Relative statistical uncertainty (3*sigma) of the intensity of the x-ray line"

    def widget(self):
        return self._widget

    def relativeUncertainties(self):
        if not self._suffix.isChecked():
            return []
        else:
            return tuple(value * 0.01 for value in self._widget.values())

    def setRelativeUncertainties(self, relative_uncertainties):
        self._suffix.setChecked(True)
        self._widget.setValues(
            [value * 100.0 for value in relative_uncertainties])
Ejemplo n.º 5
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        decimals = tolerance_to_decimals(math.degrees(SampleBase.AZIMUTH_TOLERANCE_rad))
        self._widget.setRange(0.0, 360.0, decimals)
        self._widget.setValues([0.0])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 6
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        decimals = tolerance_to_decimals(BeamBase.ENERGY_TOLERANCE_eV) + 3
        self._widget.setRange(0, 1000, decimals)
        self._widget.setValues([20.0])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 7
0
    def __init__(self, title):
        self._title = title
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(1, float("inf"), 0)
        self._widget.setValues([2])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 8
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(0.1, 100.0, 1)
        self._widget.setEnabled(True)
        self._widget.setValues([5.0])

        self._suffix.setChecked(True)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
Ejemplo n.º 9
0
class InclusionDiameterField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setValues([100.0])

        # Widgets
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Diameter(s) [nm]"

    def widget(self):
        return self._widget

    def toleranceMeter(self):
        return self._widget.bottom()

    def setToleranceMeter(self, tolerance_m):
        decimals = tolerance_to_decimals(tolerance_m * 1e9)
        self._widget.setRange(tolerance_m, float("inf"), decimals)

    def diametersMeter(self):
        return np.array(self._widget.values()) * 1e-9

    def setDiametersMeter(self, diameters_m):
        values = np.array(diameters_m) * 1e9
        self._widget.setValues(values)
Ejemplo n.º 10
0
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        tolerance = VerticalLayerSample.DEPTH_TOLERANCE_m * 1e9
        decimals = tolerance_to_decimals(tolerance)
        self._widget.setRange(tolerance, float("inf"), decimals)
        self._widget.setEnabled(False)

        self._suffix = QtWidgets.QCheckBox("infinite")
        self._suffix.setChecked(True)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
        self._suffix.stateChanged.connect(self._on_infinite_changed)
Ejemplo n.º 11
0
class NumberTrajectoriesTerminationField(TerminationFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(1, float("inf"), 0)
        self._widget.setEnabled(False)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Number of trajectories"

    def widget(self):
        return self._widget

    def numbersTrajectories(self):
        if not self._suffix.isChecked():
            return [1e38]
        else:
            return self._widget.values()

    def setNumbersTrajectories(self, numbers_trajectories):
        self._suffix.setChecked(True)
        self._widget.setValues(numbers_trajectories)
Ejemplo n.º 12
0
class TiltField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        decimals = tolerance_to_decimals(math.degrees(SampleBase.TILT_TOLERANCE_rad))
        self._widget.setRange(-180.0, 180.0, decimals)
        self._widget.setValues([0.0])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Tilt(s) [\u00b0]"

    def description(self):
        return "Tilt around the x-axis"

    def widget(self):
        return self._widget

    def tiltsDegree(self):
        return self._widget.values()

    def setTiltsDegree(self, tilts_deg):
        self._widget.setValues(tilts_deg)
Ejemplo n.º 13
0
class SimulationTimeTerminationField(TerminationFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(1, float("inf"), 0)
        self._widget.setEnabled(False)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Simulation time [s]"

    def widget(self):
        return self._widget

    def simulationTimesSecond(self):
        if not self._suffix.isChecked():
            return [1e38]
        else:
            return self._widget.values()

    def setSimulationTimesSecond(self, simulation_times):
        self._suffix.setChecked(True)
        self._widget.setValues(simulation_times)
Ejemplo n.º 14
0
class CField(MultiValueFieldBase):
    def __init__(self, title):
        self._title = title
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(0.0, 0.2, 2)
        self._widget.setValues([0.2])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return self._title

    def description(self):
        return "Elastic scattering parameter"

    def widget(self):
        return self._widget

    def setValues(self, c1s):
        self._widget.setValues(c1s)

    def values(self):
        return self._widget.values()
Ejemplo n.º 15
0
class DiameterField(MultiValueFieldBase, ToleranceMixin):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setValues([100.0])

        # Widgets
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Diameter(s) FWHM [nm]"

    def description(self):
        return "The diameter corresponds to the full width at half maximum (FWHM) of a two dimensional Gaussian distribution"

    def widget(self):
        return self._widget

    def setToleranceMeter(self, tolerance_m):
        super().setToleranceMeter(tolerance_m)
        decimals = tolerance_to_decimals(tolerance_m * 1e9)
        self._widget.setRange(tolerance_m, float("inf"), decimals)

    def diametersMeter(self):
        return np.array(self._widget.values()) * 1e-9

    def setDiametersMeter(self, diameters_m):
        values = np.array(diameters_m) * 1e9
        self._widget.setValues(values)
Ejemplo n.º 16
0
class EnergyField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        decimals = tolerance_to_decimals(BeamBase.ENERGY_TOLERANCE_eV) + 3
        self._widget.setRange(0, 1000, decimals)
        self._widget.setValues([20.0])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Energies [keV]"

    def widget(self):
        return self._widget

    def energiesEV(self):
        return np.array(self._widget.values()) * 1e3

    def setEnergiesEV(self, energies_eV):
        energies_eV = np.array(energies_eV) / 1e3
        self._widget.setValues(energies_eV)
Ejemplo n.º 17
0
class XraySplittingFactorField(MultiValueFieldBase):
    def __init__(self, title):
        self._title = title
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(1, float("inf"), 0)
        self._widget.setValues([2])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return self._title

    def widget(self):
        return self._widget

    def splittingFactors(self):
        return self._widget.values()
Ejemplo n.º 18
0
    def createEditor(self, parent, option, index):
        column = index.column()
        if column == 0:
            editor = MaterialListWidget(parent)

            editor.setMaximumHeight(parent.height())
            editor.setMinimumSize(editor.sizeHint())

            return editor

        elif column == 1:
            editor = ColoredMultiFloatLineEdit(parent)

            tolerance = Layer.THICKNESS_TOLERANCE_m * 1e9
            decimals = tolerance_to_decimals(tolerance)
            editor.setRange(tolerance, float("inf"), decimals)

            return editor
Ejemplo n.º 19
0
class FooField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(0, 1000, 0)
        self._widget.setValues([123])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Foo"

    def widget(self):
        return self._widget

    def foos(self):
        return self._widget.values()

    def setFoos(self, foos):
        self._widget.setValues(foos)
Ejemplo n.º 20
0
class NumberTrajectoriesField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # widgets
        self._widget = ColoredMultiFloatLineEdit()
        self._widget.setRange(25, 1e9, 0)
        self._widget.setValues([10000])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Number of trajectories"

    def widget(self):
        return self._widget

    def numbersTrajectories(self):
        return self._widget.values()

    def setNumbersTrajectories(self, numbers_trajectories):
        self._widget.setValues(numbers_trajectories)
Ejemplo n.º 21
0
class AzimuthField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        decimals = tolerance_to_decimals(math.degrees(SampleBase.AZIMUTH_TOLERANCE_rad))
        self._widget.setRange(0.0, 360.0, decimals)
        self._widget.setValues([0.0])

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)

    def title(self):
        return "Azimuth(s) [\u00b0]"

    def widget(self):
        return self._widget

    def azimuthsDegree(self):
        return self._widget.values()

    def setAzimuthsDegree(self, azimuths_deg):
        self._widget.setValues(azimuths_deg)
Ejemplo n.º 22
0
def coloredmultifloatlineedit():
    widget = ColoredMultiFloatLineEdit()
    widget.setRange(10.0, 50.0, 2)
    return widget
Ejemplo n.º 23
0
class DepthField(MultiValueFieldBase):
    def __init__(self):
        super().__init__()

        # Widgets
        self._widget = ColoredMultiFloatLineEdit()
        tolerance = VerticalLayerSample.DEPTH_TOLERANCE_m * 1e9
        decimals = tolerance_to_decimals(tolerance)
        self._widget.setRange(tolerance, float("inf"), decimals)
        self._widget.setEnabled(False)

        self._suffix = QtWidgets.QCheckBox("infinite")
        self._suffix.setChecked(True)

        # Signals
        self._widget.valuesChanged.connect(self.fieldChanged)
        self._suffix.stateChanged.connect(self._on_infinite_changed)

    def _on_infinite_changed(self):
        is_infinite = self._suffix.isChecked()
        self._widget.setValues([])
        self._widget.setEnabled(not is_infinite)
        self.fieldChanged.emit()

    def title(self):
        return "Depth(s) [nm]"

    def widget(self):
        return self._widget

    def suffixWidget(self):
        return self._suffix

    def isValid(self):
        if self._suffix.isChecked():
            return True
        return super().isValid()

    def depthsMeter(self):
        if self._suffix.isChecked():
            return (float("inf"), )
        else:
            return np.array(self._widget.values()) * 1e-9

    def setDepthsMeter(self, depths_m):
        values = np.array(depths_m) * 1e9
        self._widget.setValues(values)
        self._suffix.setChecked(False)