def __init__(self, parent): super().__init__(parent) self.rmsForCaPOCorrection = [] for rm in data.referenceMaterialNames(): a = QtGui.QWidgetAction(self) cb = QtGui.QCheckBox(rm, self) cb.setStyleSheet('QCheckBox { padding-left: 5px; margin: 3px; }') a.setDefaultWidget(cb) self.addAction(a) cb.clicked.connect(partial(self.updateChannels, rm)) self.aboutToShow.connect(self.updateMenu)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if timeSeriesNames: defaultChannelName = timeSeriesNames[0] drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 100000.0) drs.setSetting("MaskTrim", 0.0) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(data.timeSeriesNames(data.Input)) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect( lambda t: drs.setSetting("IndexChannel", t)) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect( lambda t: drs.setSetting("MaskChannel", t)) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskCutoff", float(t))) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Index channel", indexComboBox) formLayout.addRow("Mask channel", maskComboBox) formLayout.addRow("Mask cutoff", maskLineEdit) formLayout.addRow("Mask trim", maskTrimLineEdit) drs.setSettingsWidget(widget)
def settingsWidget(): widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) formLayout.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) widget.setLayout(formLayout) rmComboBox = QtGui.QComboBox(widget) rmComboBox.setFixedWidth(150) rmComboBox.addItems(data.referenceMaterialNames()) rmComboBox.currentTextChanged.connect( lambda s: drs.setSetting("ReferenceMaterial", str(s))) formLayout.addRow("Reference material", rmComboBox) startLineEdit = QtGui.QLineEdit(widget) startLineEdit.setFixedWidth(150) formLayout.addRow("Start trim (s)", startLineEdit) startLineEdit.textEdited.connect( lambda s: drs.setSetting("StartTrim", float(s))) endLineEdit = QtGui.QLineEdit(widget) endLineEdit.setFixedWidth(150) formLayout.addRow("End trim (s)", endLineEdit) endLineEdit.textEdited.connect( lambda s: drs.setSetting("EndTrim", float(s))) tabWidget = QtGui.QTabWidget(widget) tabWidget.setFixedSize(500, 400) formLayout.addRow('Down-hole fits', tabWidget) drs.setSetting('FitsWidget', tabWidget) # Restore settings try: settings = drs.settings() print('Restoring settings...') print(settings) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) startLineEdit.setText(str(settings['StartTrim'])) endLineEdit.setText(str(settings['EndTrim'])) except KeyError: pass drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if 'TotalBeam' in timeSeriesNames: defaultChannelName = 'TotalBeam' elif timeSeriesNames: defaultChannelName = timeSeriesNames[0] rmNames = data.selectionGroupNames(data.ReferenceMaterial) drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("ReferenceMaterial", "CO3_shell") drs.setSetting("Mask", True) drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 0.05) drs.setSetting("MaskTrim", 0.0) drs.setSetting("Age", 0.) drs.setSetting("Dy_Er", 1.8) drs.setSetting("RbBias", 0.) drs.setSetting("CaArBias", 0.) drs.setSetting("Sr88_86_reference", 8.37520938) #Konter & Storm (2014) drs.setSetting("Rb87_85_reference", 0.385710) #Konter & Storm (2014) drs.setSetting("PropagateError", False) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect(lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) rmComboBox = QtGui.QComboBox(widget) rmComboBox.addItems(rmNames) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) rmComboBox.currentTextChanged.connect(lambda t: drs.setSetting("ReferenceMaterial", t)) formLayout.addRow("Reference material", rmComboBox) verticalSpacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer) maskCheckBox = QtGui.QCheckBox(widget) maskCheckBox.setChecked(settings["Mask"]) maskCheckBox.toggled.connect(lambda t: drs.setSetting("Mask", bool(t))) formLayout.addRow("Mask", maskCheckBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect(lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect(lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect(lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Mask trim", maskTrimLineEdit) verticalSpacer2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer2) ageLineEdit = QtGui.QLineEdit(widget) ageLineEdit.setText(settings["Age"]) ageLineEdit.textChanged.connect(lambda t: drs.setSetting("Age", float(t))) formLayout.addRow("Age", ageLineEdit) rbBiasLineEdit = QtGui.QLineEdit(widget) rbBiasLineEdit.setText(settings["RbBias"]) rbBiasLineEdit.textChanged.connect(lambda t: drs.setSetting("RbBias", float(t))) formLayout.addRow("Rb Bias Adjustment", rbBiasLineEdit) caArBiasLineEdit = QtGui.QLineEdit(widget) caArBiasLineEdit.setText(settings["CaArBias"]) caArBiasLineEdit.textChanged.connect(lambda t: drs.setSetting("CaArBias", float(t))) formLayout.addRow("CaAr Bias Adjustment", caArBiasLineEdit) dyErLineEdit = QtGui.QLineEdit(widget) dyErLineEdit.setText(settings["Dy_Er"]) dyErLineEdit.textChanged.connect(lambda t: drs.setSetting("Dy_Er", float(t))) formLayout.addRow("Dy/Er ratio", dyErLineEdit) sr88_86_refLineEdit = QtGui.QLineEdit(widget) sr88_86_refLineEdit.setText(settings["Sr88_86_reference"]) sr88_86_refLineEdit.textChanged.connect(lambda t: drs.setSetting("Sr88_86_reference", float(t))) formLayout.addRow("Reference Sr88/Sr86 value", sr88_86_refLineEdit) rb87_85_refLineEdit = QtGui.QLineEdit(widget) rb87_85_refLineEdit.setText(settings["Rb87_85_reference"]) rb87_85_refLineEdit.textChanged.connect(lambda t: drs.setSetting("Rb87_85_reference", float(t))) formLayout.addRow("Reference Rb87/Rb85 value", rb87_85_refLineEdit) propCheckBox = QtGui.QCheckBox(widget) propCheckBox.setChecked(settings["PropagateError"]) propCheckBox.toggled.connect(lambda t: drs.setSetting("PropagateError", bool(t))) formLayout.addRow("Propagate Errors?", propCheckBox) drs.setSettingsWidget(widget)
def settingsWidget(): widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.FieldsStayAtSizeHint) formLayout.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) widget.setLayout(formLayout) rmComboBox = QtGui.QComboBox(widget) rmComboBox.addItems(data.referenceMaterialNames()) rmComboBox.currentTextChanged.connect( lambda s: drs.setSetting("External", str(s))) formLayout.addRow("External reference material", rmComboBox) elementsList = QtGui.QListWidget(widget) elementsList.addItems( [c for c in data.timeSeriesNames(data.Input) if 'TotalBeam' not in c]) elementsList.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection) def updateElements(): elements = [wi.text() for wi in elementsList.selectedItems()] drs.setSetting("Elements", elements) elementsList.itemSelectionChanged.connect(updateElements) formLayout.addRow("Elements to normalize", elementsList) oxideCheckBox = QtGui.QCheckBox(widget) oxideCheckBox.toggled.connect(lambda b: drs.setSetting("Oxides", bool(b))) formLayout.addRow("Oxides?", oxideCheckBox) valueLineEdit = QtGui.QLineEdit(widget) valueLineEdit.textChanged.connect( lambda v: drs.setSetting("Value", float(v))) formLayout.addRow("Value (wt. %)", valueLineEdit) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames()) maskComboBox.currentTextChanged.connect( lambda s: drs.setSetting("MaskChannel", str(s))) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.textChanged.connect( lambda v: drs.setSetting("MaskValue", float(v))) formLayout.addRow("Mask value", maskLineEdit) # Restore settings try: settings = drs.settings() rmComboBox.setCurrentText(settings["External"]) elementsList.selectionModel().clear() for el in settings["Elements"]: matches = elementsList.findItems(el, Qt.MatchFixedString) if matches: matches[0].setSelected(True) oxideCheckBox.setChecked(settings["Oxides"]) valueLineEdit.setText(str(float(settings["Value"]))) maskComboBox.setCurrentText(settings["MaskChannel"]) maskLineEdit.setText(str(float(settings["MaskValue"]))) except KeyError: pass drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() formLayout.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow) formLayout.setFormAlignment(Qt.AlignHCenter | Qt.AlignTop) widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if timeSeriesNames: defaultChannelName = timeSeriesNames[0] rmNames = data.selectionGroupNames(data.ReferenceMaterial) drs.setSetting("IndexChannel", "Nd146") drs.setSetting("ReferenceMaterial", "M_STK") drs.setSetting("MaskChannel", "Nd146") drs.setSetting("MaskCutoff", 0.1) drs.setSetting("MaskTrim", 0.0) drs.setSetting("StartTrim", 0.1) drs.setSetting("EndTrim", 0.1) drs.setSetting("NdTrue", 0.7219) drs.setSetting("Sm147_149", 1.08680) drs.setSetting("Sm144_149", 0.22332) drs.setSetting("Sm148_149", 0.81419) drs.setSetting("Sm150_149", 0.53366) #drs.setSetting("Age", 0) drs.setSetting("BeamSecondsMethod", "Laser log") drs.setSetting("BeamSecondsChannel", "Nd146") drs.setSetting("BeamSecondsValue", 50) drs.setSetting("PropagateError", True) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.setFixedWidth(150) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect( lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) rmComboBox = QtGui.QComboBox(widget) rmComboBox.setFixedWidth(150) rmComboBox.addItems(data.referenceMaterialNames()) rmComboBox.currentTextChanged.connect( lambda s: drs.setSetting("ReferenceMaterial", str(s))) formLayout.addRow("Reference material", rmComboBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.setFixedWidth(150) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect( lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setFixedWidth(150) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) #maskTrimLineEdit = QtGui.QLineEdit(widget) #maskTrimLineEdit.setText(settings["MaskTrim"]) #maskTrimLineEdit.textChanged.connect(lambda t: drs.setSetting("MaskTrim", float(t))) #formLayout.addRow("Mask trim", maskTrimLineEdit) startLineEdit = QtGui.QLineEdit(widget) startLineEdit.setFixedWidth(150) formLayout.addRow("Start trim (s)", startLineEdit) startLineEdit.textEdited.connect( lambda s: drs.setSetting("StartTrim", float(s))) endLineEdit = QtGui.QLineEdit(widget) endLineEdit.setFixedWidth(150) formLayout.addRow("End trim (s)", endLineEdit) endLineEdit.textEdited.connect( lambda s: drs.setSetting("EndTrim", float(s))) ndTrueLineEdit = QtGui.QLineEdit(widget) ndTrueLineEdit.setFixedWidth(150) ndTrueLineEdit.setText(settings["NdTrue"]) ndTrueLineEdit.textChanged.connect( lambda t: drs.setSetting("NdTrue", float(t))) formLayout.addRow("NdTrue", ndTrueLineEdit) Sm147_149LineEdit = QtGui.QLineEdit(widget) Sm147_149LineEdit.setFixedWidth(150) Sm147_149LineEdit.setText(settings["Sm147_149"]) Sm147_149LineEdit.textChanged.connect( lambda t: drs.setSetting("Sm147_149", float(t))) formLayout.addRow("Sm147_149", Sm147_149LineEdit) Sm144_149LineEdit = QtGui.QLineEdit(widget) Sm144_149LineEdit.setFixedWidth(150) Sm144_149LineEdit.setText(settings["Sm144_149"]) Sm144_149LineEdit.textChanged.connect( lambda t: drs.setSetting("Sm144_149", float(t))) formLayout.addRow("Sm144_149", Sm144_149LineEdit) Sm148_149LineEdit = QtGui.QLineEdit(widget) Sm148_149LineEdit.setFixedWidth(150) Sm148_149LineEdit.setText(settings["Sm148_149"]) Sm148_149LineEdit.textChanged.connect( lambda t: drs.setSetting("Sm148_149", float(t))) formLayout.addRow("Sm148_149", Sm148_149LineEdit) Sm150_149LineEdit = QtGui.QLineEdit(widget) Sm150_149LineEdit.setFixedWidth(150) Sm150_149LineEdit.setText(settings["Sm150_149"]) Sm150_149LineEdit.textChanged.connect( lambda t: drs.setSetting("Sm150_149", float(t))) formLayout.addRow("Sm150_149", Sm150_149LineEdit) #ageLineEdit = QtGui.QLineEdit(widget) #ageLineEdit.setText(settings["Age"]) #ageLineEdit.textChanged.connect(lambda t: drs.setSetting("Age", float(t))) #formLayout.addRow("Age", ageLineEdit) bsMethodComboBox = QtGui.QComboBox(widget) bsMethodComboBox.setFixedWidth(150) bsMethodComboBox.addItems([ 'Laser log', 'Gaps between samples', 'Cutoff threshold', 'Rate of change' ]) bsMethodComboBox.activated.connect(lambda v: drs.setSetting( 'BeamSecondsMethod', bsMethodComboBox.currentText)) bsMethodComboBox.setCurrentText(drs.setting('BeamSecondsMethod')) formLayout.addRow('Beam seconds method', bsMethodComboBox) bsChannelComboBox = QtGui.QComboBox(widget) bsChannelComboBox.setFixedWidth(150) bsChannelComboBox.addItems(data.timeSeriesNames(data.Input)) bsChannelComboBox.activated.connect(lambda v: drs.setSetting( 'BeamSecondsChannel', bsChannelComboBox.currentText)) bsChannelComboBox.setCurrentText(drs.setting('BeamSecondsChannel')) formLayout.addRow('Beam seconds channel', bsChannelComboBox) bsValueLineEdit = QtGui.QLineEdit(widget) bsValueLineEdit.setFixedWidth(150) bsValueLineEdit.textEdited.connect( lambda v: drs.setSetting('BeamSecondsValue', float(v))) bsValueLineEdit.setText(drs.setting('BeamSecondsValue')) formLayout.addRow('Beam seconds value', bsValueLineEdit) plotWidget = Plot(widget) plotWidget.setFixedSize(500, 400) formLayout.addRow('Down-hole fit', plotWidget) drs.setSetting('FitWidget', plotWidget) propCheckBox = QtGui.QCheckBox(widget) propCheckBox.setChecked(settings["PropagateError"]) propCheckBox.toggled.connect( lambda t: drs.setSetting("PropagateError", bool(t))) formLayout.addRow("PropagateError", propCheckBox) # Restore settings try: settings = drs.settings() print('Restoring settings...') print(settings) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) startLineEdit.setText(str(settings['StartTrim'])) endLineEdit.setText(str(settings['EndTrim'])) bsMethodComboBox.setCurrentText(settings['BeamSecondsMethod']) bsChannelComboBox.setCurrentText(settings['BeamSecondsChannel']) bsValueLineEdit.setText(str(settings['BeamSecondsValue'])) except KeyError: pass drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if timeSeriesNames: defaultChannelName = timeSeriesNames[0] rmNames = data.selectionGroupNames(data.ReferenceMaterial) drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("ReferenceMaterial", "C_MMC") drs.setSetting("Mask", False) drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 0.1) drs.setSetting("MaskTrim", 0.0) #drs.setSetting("Lambda87", 1.42e-11) #drs.setSetting("Age", 0.) drs.setSetting("RbBias", 1.) drs.setSetting("CaArBias", 1.) drs.setSetting("PropagateError", False) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect(lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) rmComboBox = QtGui.QComboBox(widget) rmComboBox.addItems(rmNames) if settings["ReferenceMaterial"] in rmNames: rmComboBox.setCurrentText(settings["ReferenceMaterial"]) else: rmComboBox.setCurrentText(rmNames[0]) drs.setSetting("ReferenceMaterial", rmNames[0]) rmComboBox.currentTextChanged.connect(lambda t: drs.setSetting("ReferenceMaterial", t)) formLayout.addRow("Reference material", rmComboBox) verticalSpacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer) maskCheckBox = QtGui.QCheckBox(widget) maskCheckBox.setChecked(settings["Mask"]) maskCheckBox.toggled.connect(lambda t: drs.setSetting("Mask", bool(t))) formLayout.addRow("Mask", maskCheckBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect(lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect(lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect(lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Mask trim", maskTrimLineEdit) verticalSpacer2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer2) # lambda87LineEdit = QtGui.QLineEdit(widget) # lambda87LineEdit.setText(settings["Lambda87"]) # lambda87LineEdit.textChanged.connect(lambda t: drs.setSetting("Lambda87", float(t))) # formLayout.addRow("Lambda87", lambda87LineEdit) # ageLineEdit = QtGui.QLineEdit(widget) # ageLineEdit.setText(settings["Age"]) # ageLineEdit.textChanged.connect(lambda t: drs.setSetting("Age", float(t))) # formLayout.addRow("Age", ageLineEdit) rbBiasLineEdit = QtGui.QLineEdit(widget) rbBiasLineEdit.setText(settings["RbBias"]) rbBiasLineEdit.textChanged.connect(lambda t: drs.setSetting("RbBias", float(t))) formLayout.addRow("Rb Bias", rbBiasLineEdit) caArBiasLineEdit = QtGui.QLineEdit(widget) caArBiasLineEdit.setText(settings["CaArBias"]) caArBiasLineEdit.textChanged.connect(lambda t: drs.setSetting("CaArBias", float(t))) formLayout.addRow("CaAr Bias", caArBiasLineEdit) propCheckBox = QtGui.QCheckBox(widget) propCheckBox.setChecked(settings["PropagateError"]) propCheckBox.toggled.connect(lambda t: drs.setSetting("PropagateError", bool(t))) formLayout.addRow("Propagate Errors?", propCheckBox) drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if 'TotalBeam' in timeSeriesNames: defaultChannelName = 'TotalBeam' elif timeSeriesNames: defaultChannelName = timeSeriesNames[0] drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("ReferenceMaterial", "CO3_shell") drs.setSetting("Mask", True) drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 0.05) drs.setSetting("MaskTrim", 0.0) drs.setSetting("Age", 0.) drs.setSetting("Corrections", "CaAr + REE") drs.setSetting("Dy_Er", 1.8) drs.setSetting("Lu_Yb", 7.0) drs.setSetting("RbBias", 0.) drs.setSetting("CaArBias", 0.) drs.setSetting("Sr88_86_reference", 8.37520938) #Konter & Storm (2014) drs.setSetting("Rb87_85_reference", 0.385710) #Konter & Storm (2014) drs.setSetting("CaPOEqType", 'Linear') drs.setSetting("CaPO_RMs", []) drs.setSetting("PropagateError", False) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.textActivated.connect( lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) def updateIndexCombo(): timeSeriesNames = data.timeSeriesNames(data.Input) indexComboBox.clear() indexComboBox.addItems(timeSeriesNames) data.dataChanged.connect(updateIndexCombo) rmComboBox = QtGui.QComboBox(widget) rmNames = data.selectionGroupNames(data.ReferenceMaterial) rmComboBox.addItems(rmNames) if settings["ReferenceMaterial"] in rmNames: rmComboBox.setCurrentText(settings["ReferenceMaterial"]) drs.setSetting("ReferenceMaterial", settings["ReferenceMaterial"]) rmComboBox.textActivated.connect( lambda t: drs.setSetting("ReferenceMaterial", t)) formLayout.addRow("Reference material", rmComboBox) def updateRMCombo(): rmNames = data.selectionGroupNames(data.ReferenceMaterial) rmComboBox.clear() rmComboBox.addItems(rmNames) data.selectionGroupsChanged.connect(updateRMCombo) verticalSpacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer) maskCheckBox = QtGui.QCheckBox(widget) maskCheckBox.setChecked(settings["Mask"]) maskCheckBox.toggled.connect(lambda t: drs.setSetting("Mask", bool(t))) formLayout.addRow("Mask", maskCheckBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect( lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Mask trim", maskTrimLineEdit) verticalSpacer2 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer2) ageLineEdit = QtGui.QLineEdit(widget) ageLineEdit.setText(settings["Age"]) ageLineEdit.textChanged.connect(lambda t: drs.setSetting("Age", float(t))) formLayout.addRow("Age", ageLineEdit) rbBiasLineEdit = QtGui.QLineEdit(widget) rbBiasLineEdit.setText(settings["RbBias"]) rbBiasLineEdit.textChanged.connect( lambda t: drs.setSetting("RbBias", float(t))) formLayout.addRow("Rb Bias Adjustment", rbBiasLineEdit) caArBiasLineEdit = QtGui.QLineEdit(widget) caArBiasLineEdit.setText(settings["CaArBias"]) caArBiasLineEdit.textChanged.connect( lambda t: drs.setSetting("CaArBias", float(t))) formLayout.addRow("CaAr Bias Adjustment", caArBiasLineEdit) verticalSpacer3 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer3) corrComboBox = QtGui.QComboBox(widget) corrComboBox.addItems(['CaAr + REE', 'CaAr only']) corrComboBox.setCurrentText(settings['Corrections']) corrComboBox.currentTextChanged.connect( lambda t: drs.setSetting('Corrections', t)) formLayout.addRow("Corrections", corrComboBox) verticalSpacer4 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer4) luYbLineEdit = QtGui.QLineEdit(widget) luYbLineEdit.setText(settings["Lu_Yb"]) luYbLineEdit.textChanged.connect( lambda t: drs.setSetting("Lu_Yb", float(t))) formLayout.addRow("Lu/Yb ratio", luYbLineEdit) dyErLineEdit = QtGui.QLineEdit(widget) dyErLineEdit.setText(settings["Dy_Er"]) dyErLineEdit.textChanged.connect( lambda t: drs.setSetting("Dy_Er", float(t))) formLayout.addRow("Dy/Er ratio", dyErLineEdit) verticalSpacer5 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer5) sr88_86_refLineEdit = QtGui.QLineEdit(widget) sr88_86_refLineEdit.setText(settings["Sr88_86_reference"]) sr88_86_refLineEdit.textChanged.connect( lambda t: drs.setSetting("Sr88_86_reference", float(t))) formLayout.addRow("Reference Sr88/Sr86 value", sr88_86_refLineEdit) rb87_85_refLineEdit = QtGui.QLineEdit(widget) rb87_85_refLineEdit.setText(settings["Rb87_85_reference"]) rb87_85_refLineEdit.textChanged.connect( lambda t: drs.setSetting("Rb87_85_reference", float(t))) formLayout.addRow("Reference Rb87/Rb85 value", rb87_85_refLineEdit) verticalSpacer6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) formLayout.addItem(verticalSpacer6) # CaPO controls capoEqType = QtGui.QComboBox(widget) capoEqType.addItems(['Linear', 'Exponential Decay']) capoEqType.setCurrentText(settings["CaPOEqType"]) capoEqType.currentTextChanged.connect( lambda t: drs.setSetting("CaPOEqType", t)) formLayout.addRow("CaPO Fit Eqn", capoEqType) setExtButton = QtGui.QToolButton(widget) rmMenu = ReferenceMaterialsMenu(setExtButton) rmMenu.rmsChanged.connect(lambda l: drs.setSetting("CaPO_RMs", l)) setExtButton.setMenu(rmMenu) setExtButton.setPopupMode(QtGui.QToolButton.InstantPopup) setExtButton.setIcon(CUI().icon('trophy')) setExtButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) formLayout.addRow("RMs for CaPO correction:", setExtButton) # Plot for CaPO correction formLayout.addRow('CaPO Correction fit', PLOT) # Prop errors controls propCheckBox = QtGui.QCheckBox(widget) propCheckBox.setChecked(settings["PropagateError"]) propCheckBox.toggled.connect( lambda t: drs.setSetting("PropagateError", bool(t))) formLayout.addRow("Propagate Errors?", propCheckBox) # Restore settings try: settings = drs.settings() print('Restoring settings...') print(settings) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) except KeyError: pass drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if timeSeriesNames: defaultChannelName = timeSeriesNames[0] rmNames = data.selectionGroupNames(data.ReferenceMaterial) drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("ReferenceMaterial", "A_MAD") drs.setSetting("Mask", False) drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 0.1) drs.setSetting("MaskTrim", 0.0) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect( lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) rmComboBox = QtGui.QComboBox(widget) rmComboBox.addItems(rmNames) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) rmComboBox.currentTextChanged.connect( lambda t: drs.setSetting("ReferenceMaterial", t)) formLayout.addRow("Reference material", rmComboBox) verticalSpacer = QtGui.QSpacerItem( 20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer) maskCheckBox = QtGui.QCheckBox(widget) maskCheckBox.setChecked(settings["Mask"]) maskCheckBox.toggled.connect(lambda t: drs.setSetting("Mask", bool(t))) formLayout.addRow("Mask", maskCheckBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect( lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Mask trim", maskTrimLineEdit) verticalSpacer2 = QtGui.QSpacerItem( 20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) formLayout.addItem(verticalSpacer2) drs.setSettingsWidget(widget)
def settingsWidget(): """ This function puts together a user interface to configure the DRS. It is important to have the last line of this function call: drs.setSettingsWidget(widget) """ widget = QtGui.QWidget() formLayout = QtGui.QFormLayout() widget.setLayout(formLayout) timeSeriesNames = data.timeSeriesNames(data.Input) defaultChannelName = "" if timeSeriesNames: defaultChannelName = timeSeriesNames[0] rmNames = data.selectionGroupNames(data.ReferenceMaterial) drs.setSetting("IndexChannel", defaultChannelName) drs.setSetting("ReferenceMaterial", "Z_Plesovice") drs.setSetting("MaskChannel", defaultChannelName) drs.setSetting("MaskCutoff", 0.1) drs.setSetting("MaskTrim", 0.0) drs.setSetting("HfTrue", 0.7325) drs.setSetting("Yb31", 1.132685) drs.setSetting("Yb63", 0.796218) drs.setSetting("Age", 0) drs.setSetting("PropagateError", False) settings = drs.settings() indexComboBox = QtGui.QComboBox(widget) indexComboBox.addItems(timeSeriesNames) indexComboBox.setCurrentText(settings["IndexChannel"]) indexComboBox.currentTextChanged.connect( lambda t: drs.setSetting("IndexChannel", t)) formLayout.addRow("Index channel", indexComboBox) rmComboBox = QtGui.QComboBox(widget) rmComboBox.addItems(rmNames) rmComboBox.setCurrentText(settings["ReferenceMaterial"]) rmComboBox.currentTextChanged.connect( lambda t: drs.setSetting("ReferenceMaterial", t)) formLayout.addRow("Reference material", rmComboBox) maskComboBox = QtGui.QComboBox(widget) maskComboBox.addItems(data.timeSeriesNames(data.Input)) maskComboBox.setCurrentText(settings["MaskChannel"]) maskComboBox.currentTextChanged.connect( lambda t: drs.setSetting("MaskChannel", t)) formLayout.addRow("Mask channel", maskComboBox) maskLineEdit = QtGui.QLineEdit(widget) maskLineEdit.setText(settings["MaskCutoff"]) maskLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskCutoff", float(t))) formLayout.addRow("Mask cutoff", maskLineEdit) maskTrimLineEdit = QtGui.QLineEdit(widget) maskTrimLineEdit.setText(settings["MaskTrim"]) maskTrimLineEdit.textChanged.connect( lambda t: drs.setSetting("MaskTrim", float(t))) formLayout.addRow("Mask trim", maskTrimLineEdit) hfTrueLineEdit = QtGui.QLineEdit(widget) hfTrueLineEdit.setText(settings["HfTrue"]) hfTrueLineEdit.textChanged.connect( lambda t: drs.setSetting("HfTrue", float(t))) formLayout.addRow("Hf true", hfTrueLineEdit) Yb31LineEdit = QtGui.QLineEdit(widget) Yb31LineEdit.setText(settings["Yb31"]) Yb31LineEdit.textChanged.connect( lambda t: drs.setSetting("Yb31", float(t))) formLayout.addRow("173Yb/171Yb", Yb31LineEdit) Yb63LineEdit = QtGui.QLineEdit(widget) Yb63LineEdit.setText(settings["Yb63"]) Yb63LineEdit.textChanged.connect( lambda t: drs.setSetting("Yb63", float(t))) formLayout.addRow("176Yb/173Yb", Yb63LineEdit) ageLineEdit = QtGui.QLineEdit(widget) ageLineEdit.setText(settings["Age"]) ageLineEdit.textChanged.connect(lambda t: drs.setSetting("Age", float(t))) formLayout.addRow("Age", ageLineEdit) propCheckBox = QtGui.QCheckBox(widget) propCheckBox.setChecked(settings["PropagateError"]) propCheckBox.toggled.connect( lambda t: drs.setSetting("PropagateError", bool(t))) formLayout.addRow("PropagateError", propCheckBox) drs.setSettingsWidget(widget)