Beispiel #1
0
    def populate(self, result):
        self.clear()

        if result is None:
            return

        MAPPINGS = (
            (self.scaleLineEdit, result.axes.scale),
            (self.normalizationComboBox, result.axes.normalization),
        )
        self.mappers = setMappings(MAPPINGS)

        self.xAxis.populate(result.axes.xaxis)
        self.axesTabWidget.setTabText(0, result.axes.xaxis.label)

        if result.experiment.isTwoDimensional:
            self.axesTabWidget.addTab(self.yAxis, None)
            self.axesTabWidget.setTabText(1, result.axes.yaxis.label)
            self.yAxis.populate(result.axes.yaxis)
        else:
            self.axesTabWidget.removeTab(1)

        model = result.model()
        self.spectraView.setModel(model)
        index = model.indexFromItem(result.spectra.toPlot)
        self.spectraView.setRootIndex(index)

        self.inputText.setPlainText(result.input)
        self.outputText.setPlainText(result.output)
        # self.summaryText.setPlainText(result.summary)

        if result.value is not None:
            title = f"Details for {result.value}"
            self.setWindowTitle(title)
Beispiel #2
0
    def populate(self, state):
        model = state.model()

        self.symbolComboBox.setItems(state.symbols, state.element.symbol)
        self.chargeComboBox.setItems(state.charges, state.element.charge)
        self.symmetryComboBox.setItems(state.symmetries, state.symmetry.value)
        self.experimentComboBox.setItems(state.experiments, state.experiment.value)
        self.edgeComboBox.setItems(state.edges, state.edge.value)

        if self.mappers:
            for mapper in self.mappers:
                mapper.clearMapping()

        MAPPINGS = (
            (self.temperatureLineEdit, state.temperature),
            (self.magneticFieldLineEdit, state.magneticField),
        )
        self.mappers = setMappings(MAPPINGS)

        self.xAxis.populate(state.axes.xaxis)
        self.axesTabWidget.setTabText(0, state.axes.xaxis.label)

        if state.experiment.isTwoDimensional:
            self.axesTabWidget.addTab(self.yAxis, None)
            self.axesTabWidget.setTabText(1, state.axes.yaxis.label)
            self.yAxis.populate(state.axes.yaxis)
        else:
            self.axesTabWidget.removeTab(1)

        self.spectraView.setModel(model)
        self.spectraView.setRootIndex(state.spectra.toCalculate.index())
        self.spectraView.hideColumn(1)
        self.spectraView.hideColumn(2)
        self.spectraView.setHeaderHidden(True)
        self.spectraView.expandAll()
Beispiel #3
0
    def populate(self, axis):
        self.clear()

        MAPPINGS = (
            (self.shiftLineEdit, axis.shift),
            (self.lorentzianLineEdit, axis.lorentzian),
            (self.gaussianLineEdit, axis.gaussian),
        )

        self.mappers = setMappings(MAPPINGS)
Beispiel #4
0
 def populate(self, axis):
     if self.mappers:
         for mapper in self.mappers:
             mapper.clearMapping()
     MAPPINGS = (
         (self.startLineEdit, axis.start),
         (self.stopLineEdit, axis.stop),
         (self.nPointsLineEdit, axis.npoints),
         (self.gaussianLineEdit, axis.gaussian),
         (self.lorentzianLineEdit, axis.lorentzian),
         (self.kLineEdit, axis.photon.k),
         (self.e1LineEdit, axis.photon.e1),
         (self.e2LineEdit, axis.photon.e2),
     )
     self.mappers = setMappings(MAPPINGS)
     # The Lorentzian tool button is not needed for the y-axis.
     if isinstance(axis, YAxis):
         self.lorentzianToolButton.setVisible(False)
Beispiel #5
0
    def populate(self, state):
        hamiltonian = state.hamiltonian
        self.hamiltonian = hamiltonian
        model = state.model()

        if self.mappers:
            for mapper in self.mappers:
                mapper.clearMapping()
        MAPPINGS = (
            (self.fkLineEdit, hamiltonian.fk),
            (self.gkLineEdit, hamiltonian.gk),
            (self.zetaLineEdit, hamiltonian.zeta),
            (self.syncParametersCheckBox, hamiltonian.synchronizeParameters),
            (self.nStatesLineEdit, hamiltonian.numberOfStates),
            (self.nStatesAutoCheckBox, hamiltonian.numberOfStates.auto),
            (self.nConfigurationsLineEdit, hamiltonian.numberOfConfigurations),
        )
        self.mappers = setMappings(MAPPINGS)

        self.termsView.setModel(model)

        # Set the root index of the terms view.
        terms = hamiltonian.terms
        index = model.indexFromItem(terms)
        self.termsView.setRootIndex(index)

        # Select the first Hamiltonian term.
        index = model.indexFromItem(terms.children()[0])
        selectionModel = self.termsView.selectionModel()
        selectionModel.setCurrentIndex(index, QItemSelectionModel.Select)
        selectionModel.selectionChanged.disconnect()
        selectionModel.selectionChanged.connect(self.updateParametersView)

        self.parametersView.setModel(model)
        self.parametersView.expandAll()
        # self.parametersView.setColumnWidth(0, 130)
        currentIndex = self.termsView.currentIndex()
        self.parametersView.setRootIndex(currentIndex)

        value = hamiltonian.numberOfStates.auto.value
        self.nStatesLineEdit.setEnabled(not value)
        self.nStatesAutoCheckBox.stateChanged.disconnect()
        self.nStatesAutoCheckBox.stateChanged.connect(self.updateAutoStates)