コード例 #1
0
    def setup_fit_options_table(self):
        self.fit_options_table.setRowCount(5)
        self.fit_options_table.setColumnCount(2)
        self.fit_options_table.setColumnWidth(0, 300)
        self.fit_options_table.setColumnWidth(1, 300)
        self.fit_options_table.verticalHeader().setVisible(False)
        self.fit_options_table.horizontalHeader().setStretchLastSection(True)
        self.fit_options_table.setHorizontalHeaderLabels(
            ("Property;Value").split(";"))

        table_utils.setRowName(self.fit_options_table, 0, "Time Start")
        self.time_start = table_utils.addDoubleToTable(self.fit_options_table,
                                                       0.0, 0, 1)

        table_utils.setRowName(self.fit_options_table, 1, "Time End")
        self.time_end = table_utils.addDoubleToTable(self.fit_options_table,
                                                     15.0, 1, 1)

        table_utils.setRowName(self.fit_options_table, 2, "Minimizer")
        self.minimizer_combo = table_utils.addComboToTable(
            self.fit_options_table, 2, [])

        self.minimizer_combo.addItems(allowed_minimizers)

        table_utils.setRowName(self.fit_options_table, 3, "Fit To Raw Data")
        self.fit_to_raw_data_checkbox = table_utils.addCheckBoxWidgetToTable(
            self.fit_options_table, True, 3)

        table_utils.setRowName(self.fit_options_table, 4,
                               "Evaluate Function As")
        self.evaluation_combo = table_utils.addComboToTable(
            self.fit_options_table, 4, ['CentrePoint', 'Histogram'])
コード例 #2
0
    def __init__(self, lines, subplot, parent=None):
        super(RemovePlotWindowView, self).__init__()

        self._subplot = subplot

        self.grid = QtWidgets.QGridLayout()

        self.table = QtWidgets.QTableWidget(self)
        self.table.resize(200, 200)

        self.table.setRowCount(len(lines))
        self.table.setColumnCount(2)
        self.table.setColumnWidth(0, 150)
        self.table.setColumnWidth(1, 50)
        self.table.verticalHeader().setVisible(False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setHorizontalHeaderLabels(("Line name;Remove").split(";"))
        table_utils.setTableHeaders(self.table)

        self.widgets = {}
        for index, line in enumerate(lines):
            table_utils.setRowName(self.table, index, line)
            tmp = {
                "line": line,
                "box": table_utils.addCheckBoxToTable(self.table, False, index)
            }
            self.widgets[line] = tmp

        self.grid.addWidget(self.table)
        btn = QtWidgets.QPushButton("Remove")
        self.grid.addWidget(btn)
        self.setLayout(self.grid)
        self.setWindowTitle("Remove Lines For " + self._subplot)
        btn.clicked.connect(self.buttonClick)
コード例 #3
0
ファイル: list_selector_view.py プロジェクト: dpaj/mantid
 def addItems(self, item_list):
     """
     Adds all the items in item list to the table
     :param itemList: A list of tuples (item_name, check_state, enabled)
     """
     self.item_table_widget.blockSignals(True)
     for index, row in enumerate(item_list):
         insertion_index = self.item_table_widget.rowCount()
         self.item_table_widget.setRowCount(insertion_index + 1)
         table_utils.setRowName(self.item_table_widget, insertion_index,
                                row[0])
         table_utils.addCheckBoxToTable(self.item_table_widget, row[1],
                                        insertion_index, 1)
         self.set_row_enabled(insertion_index, row[2])
     self.item_table_widget.blockSignals(False)
コード例 #4
0
    def __init__(self, context, parent=None):
        super(ContextExampleView, self).__init__(parent)
        self.grid = QtGui.QGridLayout(self)

        self.table = QtGui.QTableWidget(self)
        self.table.resize(800, 800)
        self.table.setRowCount(2)
        self.table.setColumnCount(4)
        self.table.setColumnWidth(0, 300)
        self.table.setColumnWidth(1, 100)
        self.table.setColumnWidth(2, 100)
        self.table.setColumnWidth(3, 100)
        self.table.verticalHeader().setVisible(False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setHorizontalHeaderLabels(
            ("Property;Value 1; Value 2; Value3").split(";"))
        # populate table

        # row of groups
        table_utils.setRowName(self.table, 0, "Groups")
        group_name = ["a", "b", "c"]
        self.ws0 = table_utils.addDoubleToTable(self.table, group_name[0], 0,
                                                1)
        self.ws1 = table_utils.addDoubleToTable(self.table, group_name[1], 0,
                                                2)
        self.ws2 = table_utils.addDoubleToTable(self.table, group_name[2], 0,
                                                3)

        # row to describe a pair
        table_utils.setRowName(self.table, 1, "Pair")
        self.g1 = table_utils.addComboToTable(self.table, 1, group_name, 1)
        self.g2 = table_utils.addComboToTable(self.table, 1, group_name, 2)
        self.alpha = table_utils.addDoubleToTable(self.table, "2.", 1, 3)

        # explicit update button
        btn = QtGui.QPushButton("print context", self)

        # create grid
        self.grid.addWidget(self.table)
        self.grid.addWidget(btn)

        # add connections
        btn.clicked.connect(self.sendUpdateSignal)
        # needed for updating the possible pairs when groups change
        self.table.itemChanged.connect(self.groupChanged)
        # load values into GUI from context
        self.loadFromContext(context)
コード例 #5
0
    def __init__(self, lines, subplot, parent=None):
        super(RemovePlotWindowView, self).__init__()

        self._subplot = subplot

        self.grid = QtWidgets.QGridLayout()

        self.table = QtWidgets.QTableWidget(self)
        self.table.resize(200, 200)

        self.table.setRowCount(len(lines))
        self.table.setColumnCount(2)
        self.table.setColumnWidth(0, 150)
        self.table.setColumnWidth(1, 50)
        self.table.verticalHeader().setVisible(False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setHorizontalHeaderLabels(
            ("Line name;Remove").split(";"))
        table_utils.setTableHeaders(self.table)

        self.widgets = {}
        for index, line in enumerate(lines):
            table_utils.setRowName(self.table, index, line)
            tmp = {
                "line": line,
                "box": table_utils.addCheckBoxToTable(
                    self.table,
                    False,
                    index)}
            self.widgets[line] = tmp

        self.grid.addWidget(self.table)
        btn = QtWidgets.QPushButton("Remove")
        self.grid.addWidget(btn)
        self.setLayout(self.grid)
        self.setWindowTitle("Remove Lines For " + self._subplot)
        btn.clicked.connect(self.buttonClick)
コード例 #6
0
    def __init__(self, simultaneous_item_list, is_frequency_domain=False, parent=None):
        super(FittingTabView, self).__init__(parent)
        self.setupUi(self)
        self.setup_fit_options_table()
        self.setup_simul_fit_combo_box(simultaneous_item_list)
        self.undo_fit_button.setEnabled(False)

        self.function_browser = FunctionBrowser(self, True)
        self.function_browser_layout.addWidget(self.function_browser)
        self.function_browser.setErrorsEnabled(True)
        self.function_browser.hideGlobalCheckbox()

        self.increment_parameter_display_button.clicked.connect(self.increment_display_combo_box)
        self.decrement_parameter_display_button.clicked.connect(self.decrement_display_combo_box)

        self.disable_simul_fit_options()

        if is_frequency_domain:
            self.hide_simultaneous_fit_options()
            self.fit_options_table.hideRow(RAW_DATA_TABLE_ROW)
            self.fit_options_table.hideRow(TF_ASYMMETRY_MODE_TABLE_ROW)
            table_utils.setRowName(self.fit_options_table, FIT_START_TABLE_ROW, "Start X")
            table_utils.setRowName(self.fit_options_table, FIT_END_TABLE_ROW, "End X")
            self.end_time = DEFAULT_FREQUENCY_FIT_END_X
コード例 #7
0
ファイル: maxent_view.py プロジェクト: mantid-roman/mantid
    def __init__(self, parent=None):
        super(MaxEntView, self).__init__(parent)
        self.grid = QtGui.QVBoxLayout(self)

        # add splitter for resizing
        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)

        self.run = None
        # make table
        self.table = QtGui.QTableWidget(self)
        self.table.resize(800, 800)

        self.table.setRowCount(11)
        self.table.setColumnCount(2)
        self.table.setColumnWidth(0, 300)
        self.table.setColumnWidth(1, 300)
        self.table.verticalHeader().setVisible(False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setHorizontalHeaderLabels(
            ("MaxEnt Property;Value").split(";"))
        table_utils.setTableHeaders(self.table)

        # populate table
        options = ['test']

        table_utils.setRowName(self.table, 0, "Workspace")
        self.ws = table_utils.addComboToTable(self.table, 0, options)

        table_utils.setRowName(self.table, 1, "First good time")
        self.first_good = table_utils.addDoubleToTable(self.table, 0.1, 1)

        table_utils.setRowName(self.table, 2, "Last good time")
        self.last_good = table_utils.addDoubleToTable(self.table, 15.0, 2)

        table_utils.setRowName(self.table, 3, "Fit dead times")
        self.dead_box = table_utils.addCheckBoxToTable(self.table, True, 3)

        table_utils.setRowName(self.table, 4, "Use Phase Table")
        self.use_phaseTable_box = table_utils.addCheckBoxToTable(
            self.table, False, 4)

        table_utils.setRowName(self.table, 5, "Select Phase Table")
        options = [construct]
        self.phaseTable_box = table_utils.addComboToTable(
            self.table, 5, options)

        table_utils.setRowName(self.table, 6, "Fix phases")
        self.fix_phase_box = table_utils.addCheckBoxToTable(
            self.table, False, 6)

        self.table.hideRow(5)
        self.table.hideRow(6)

        table_utils.setRowName(self.table, 7, "Output phase table")
        self.output_phase_box = table_utils.addCheckBoxToTable(
            self.table, False, 7)

        table_utils.setRowName(self.table, 8, "Output deadtimes")
        self.output_dead_box = table_utils.addCheckBoxToTable(
            self.table, False, 8)

        table_utils.setRowName(self.table, 9, "Output reconstructed data")
        self.output_data_box = table_utils.addCheckBoxToTable(
            self.table, False, 9)

        table_utils.setRowName(self.table, 10, "Output phase convergence")
        self.output_phase_evo_box = table_utils.addCheckBoxToTable(
            self.table, False, 10)

        self.table.resizeRowsToContents()

        # advanced options table
        self.advancedLabel = QtGui.QLabel("\n  Advanced Options")
        # make table
        self.tableA = QtGui.QTableWidget(self)
        self.tableA.resize(800, 800)

        self.tableA.setRowCount(7)
        self.tableA.setColumnCount(2)
        self.tableA.setColumnWidth(0, 300)
        self.tableA.setColumnWidth(1, 300)

        self.tableA.verticalHeader().setVisible(False)
        self.tableA.horizontalHeader().setStretchLastSection(True)

        self.tableA.setHorizontalHeaderLabels(
            ("Advanced Property;Value").split(";"))
        table_utils.setTableHeaders(self.tableA)

        table_utils.setRowName(self.tableA, 0, "Maximum entropy constant (A)")
        self.AConst = table_utils.addDoubleToTable(self.tableA, 0.1, 0)

        table_utils.setRowName(self.tableA, 1, "Lagrange multiplier for chi^2")
        self.factor = table_utils.addDoubleToTable(self.tableA, 1.04, 1)

        table_utils.setRowName(self.tableA, 2, "Inner Iterations")
        self.inner_loop = table_utils.addSpinBoxToTable(self.tableA, 10, 2)

        table_utils.setRowName(self.tableA, 3, "Outer Iterations")
        self.outer_loop = table_utils.addSpinBoxToTable(self.tableA, 10, 3)

        table_utils.setRowName(self.tableA, 4, "Double pulse data")
        self.double_pulse_box = table_utils.addCheckBoxToTable(
            self.tableA, False, 4)

        table_utils.setRowName(self.tableA, 5, "Number of data points")
        self.N_points = table_utils.addComboToTable(self.tableA, 5, options)

        table_utils.setRowName(self.tableA, 6, "Maximum Field ")
        self.max_field = table_utils.addDoubleToTable(self.tableA, 1000.0, 6)

        # layout
        # this is if complex data is unhidden
        self.table.setMinimumSize(40, 203)
        self.tableA.setMinimumSize(40, 207)

        # make buttons
        self.button = QtGui.QPushButton('Calculate MaxEnt', self)
        self.button.setStyleSheet("background-color:lightgrey")
        self.cancel = QtGui.QPushButton('Cancel', self)
        self.cancel.setStyleSheet("background-color:lightgrey")
        self.cancel.setEnabled(False)
        # connects
        self.button.clicked.connect(self.MaxEntButtonClick)
        self.cancel.clicked.connect(self.cancelClick)
        self.table.cellClicked.connect(self.phaseBoxClick)
        # button layout
        self.buttonLayout = QtGui.QHBoxLayout()
        self.buttonLayout.addWidget(self.button)
        self.buttonLayout.addWidget(self.cancel)
        # add to layout
        splitter.addWidget(self.table)
        splitter.addWidget(self.advancedLabel)
        splitter.addWidget(self.tableA)
        self.grid.addWidget(splitter)
        self.grid.addLayout(self.buttonLayout)
コード例 #8
0
    def __init__(self, parent=None):
        super(FFTView, self).__init__(parent)
        self.grid = QtWidgets.QGridLayout(self)

        # add splitter for resizing
        splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)

        # make table
        self.FFTTable = QtWidgets.QTableWidget(self)
        self.FFTTable.resize(800, 800)
        self.FFTTable.setRowCount(6)
        self.FFTTable.setColumnCount(2)
        self.FFTTable.setColumnWidth(0, 300)
        self.FFTTable.setColumnWidth(1, 300)
        self.FFTTable.verticalHeader().setVisible(False)
        self.FFTTable.horizontalHeader().setStretchLastSection(True)
        self.FFTTable.setHorizontalHeaderLabels(
            ("FFT Property;Value").split(";"))
        # populate table
        options = ['test']

        table_utils.setRowName(self.FFTTable, 0, "Workspace")
        self.ws = table_utils.addComboToTable(self.FFTTable, 0, options)
        self.Im_box_row = 1
        table_utils.setRowName(
            self.FFTTable,
            self.Im_box_row,
            "Imaginary Data")
        self.Im_box = table_utils.addCheckBoxToTable(
            self.FFTTable, True, self.Im_box_row)

        table_utils.setRowName(self.FFTTable, 2, "Imaginary Workspace")
        self.Im_ws = table_utils.addComboToTable(self.FFTTable, 2, options)

        self.shift_box_row = 3
        table_utils.setRowName(self.FFTTable, self.shift_box_row, "Auto shift")
        self.shift_box = table_utils.addCheckBoxToTable(
            self.FFTTable, True, self.shift_box_row)

        table_utils.setRowName(self.FFTTable, 4, "Shift")
        self.shift = table_utils.addDoubleToTable(self.FFTTable, 0.0, 4)
        self.FFTTable.hideRow(4)

        table_utils.setRowName(self.FFTTable, 5, "Use Raw data")
        self.Raw_box = table_utils.addCheckBoxToTable(self.FFTTable, True, 5)

        self.FFTTable.resizeRowsToContents()
        # make advanced table options
        self.advancedLabel = QtWidgets.QLabel("\n Advanced Options")
        self.FFTTableA = QtWidgets.QTableWidget(self)
        self.FFTTableA.resize(800, 800)
        self.FFTTableA.setRowCount(4)
        self.FFTTableA.setColumnCount(2)
        self.FFTTableA.setColumnWidth(0, 300)
        self.FFTTableA.setColumnWidth(1, 300)
        self.FFTTableA.verticalHeader().setVisible(False)
        self.FFTTableA.horizontalHeader().setStretchLastSection(True)
        self.FFTTableA.setHorizontalHeaderLabels(
            ("Advanced Property;Value").split(";"))

        table_utils.setRowName(self.FFTTableA, 0, "Apodization Function")
        options = ["Lorentz", "Gaussian", "None"]
        self.apodization = table_utils.addComboToTable(
            self.FFTTableA, 0, options)

        table_utils.setRowName(
            self.FFTTableA,
            1,
            "Decay Constant (micro seconds)")
        self.decay = table_utils.addDoubleToTable(self.FFTTableA, 4.4, 1)

        table_utils.setRowName(self.FFTTableA, 2, "Negative Padding")
        self.negativePadding = table_utils.addCheckBoxToTable(
            self.FFTTableA, True, 2)

        table_utils.setRowName(self.FFTTableA, 3, "Padding")
        self.padding = table_utils.addSpinBoxToTable(self.FFTTableA, 1, 3)
        self.FFTTableA.resizeRowsToContents()

        # make button
        self.button = QtWidgets.QPushButton('Calculate FFT', self)
        self.button.setStyleSheet("background-color:lightgrey")
        # connects
        self.FFTTable.cellClicked.connect(self.tableClick)
        self.button.clicked.connect(self.buttonClick)
        self.ws.currentIndexChanged.connect(self.phaseCheck)
        # add to layout
        self.FFTTable.setMinimumSize(40, 158)
        self.FFTTableA.setMinimumSize(40, 127)
        table_utils.setTableHeaders(self.FFTTable)
        table_utils.setTableHeaders(self.FFTTableA)

        # add to layout
        splitter.addWidget(self.FFTTable)
        splitter.addWidget(self.advancedLabel)
        splitter.addWidget(self.FFTTableA)
        self.grid.addWidget(splitter)
        self.grid.addWidget(self.button)
コード例 #9
0
ファイル: phase_table_view.py プロジェクト: yutiansut/mantid
    def setup_phase_table_options_table(self):
        self.phase_table_options_table.setColumnWidth(0, 300)
        self.phase_table_options_table.setColumnWidth(1, 300)

        # populate table
        options = []

        table_utils.setRowName(self.phase_table_options_table, 0, "Workspace")
        self.input_workspace_combo_box = table_utils.addComboToTable(
            self.phase_table_options_table, 0, options)

        table_utils.setRowName(self.phase_table_options_table, 1,
                               "Forward group")
        self.forward_group_combo = table_utils.addComboToTable(
            self.phase_table_options_table, 1, options)

        table_utils.setRowName(self.phase_table_options_table, 2,
                               "Backward group")
        self.backward_group_combo = table_utils.addComboToTable(
            self.phase_table_options_table, 2, options)

        table_utils.setRowName(self.phase_table_options_table, 3,
                               "First Good Data")
        self.first_good_data_item = table_utils.addDoubleToTable(
            self.phase_table_options_table, 0.1, 3)

        table_utils.setRowName(self.phase_table_options_table, 4,
                               "Last Good Data")
        self.last_good_data_item = table_utils.addDoubleToTable(
            self.phase_table_options_table, 15.0, 4)

        table_utils.setRowName(self.phase_table_options_table, 5,
                               "Output fit information")
        self.output_fit_info_box = table_utils.addCheckBoxToTable(
            self.phase_table_options_table, False, 5)

        self.phase_table_options_table.resizeRowsToContents()

        table_utils.setTableHeaders(self.phase_table_options_table)

        self.phase_quad_table.setColumnWidth(0, 300)
        self.phase_quad_table.setColumnWidth(1, 300)

        # self.calculate_phase_table_button = QtWidgets.QPushButton('Calculate Phase Table', self)
        table_utils.setRowName(self.phase_quad_table, 0, 'InputWorkspace')
        self.phase_quad_input_workspace_combo = table_utils.addComboToTable(
            self.phase_quad_table, 0, options)

        table_utils.setRowName(self.phase_quad_table, 1, 'PhaseTable')
        self.phase_quad_phase_table_combo = table_utils.addComboToTable(
            self.phase_quad_table, 1, options)

        self.phase_quad_table.resizeRowsToContents()

        # add to layout
        table_utils.setTableHeaders(self.phase_quad_table)
コード例 #10
0
ファイル: maxent_view.py プロジェクト: samueljackson92/mantid
    def __init__(self, parent=None):
        super(MaxEntView, self).__init__(parent)
        self.grid = QtGui.QVBoxLayout(self)

        # add splitter for resizing
        splitter = QtGui.QSplitter(QtCore.Qt.Vertical)

        self.run = None
        # make table
        self.table = QtGui.QTableWidget(self)
        self.table.resize(800, 800)

        self.table.setRowCount(11)
        self.table.setColumnCount(2)
        self.table.setColumnWidth(0, 300)
        self.table.setColumnWidth(1, 300)
        self.table.verticalHeader().setVisible(False)
        self.table.horizontalHeader().setStretchLastSection(True)
        self.table.setHorizontalHeaderLabels(
            ("MaxEnt Property;Value").split(";"))
        table_utils.setTableHeaders(self.table)

        # populate table
        options = ['test']

        table_utils.setRowName(self.table, 0, "Workspace")
        self.ws = table_utils.addComboToTable(self.table, 0, options)

        table_utils.setRowName(self.table, 1, "First good time")
        self.first_good = table_utils.addDoubleToTable(self.table, 0.1, 1)

        table_utils.setRowName(self.table, 2, "Last good time")
        self.last_good = table_utils.addDoubleToTable(self.table, 15.0, 2)

        table_utils.setRowName(self.table, 3, "Fit dead times")
        self.dead_box = table_utils.addCheckBoxToTable(self.table, True, 3)

        table_utils.setRowName(self.table, 4, "Use Phase Table")
        self.use_phaseTable_box = table_utils.addCheckBoxToTable(
            self.table, False, 4)

        table_utils.setRowName(self.table, 5, "Construct Phase Table")
        self.phaseTable_box = table_utils.addCheckBoxToTable(
            self.table, True, 5)

        table_utils.setRowName(self.table, 6, "Fix phases")
        self.fix_phase_box = table_utils.addCheckBoxToTable(
            self.table, False, 6)

        self.table.hideRow(5)
        self.table.hideRow(6)

        table_utils.setRowName(self.table, 7, "Output phase table")
        self.output_phase_box = table_utils.addCheckBoxToTable(
            self.table, False, 7)

        table_utils.setRowName(self.table, 8, "Output deadtimes")
        self.output_dead_box = table_utils.addCheckBoxToTable(
            self.table, False, 8)

        table_utils.setRowName(self.table, 9, "Output reconstructed data")
        self.output_data_box = table_utils.addCheckBoxToTable(
            self.table, False, 9)

        table_utils.setRowName(self.table, 10, "Output phase convergence")
        self.output_phase_evo_box = table_utils.addCheckBoxToTable(
            self.table, False, 10)

        self.table.resizeRowsToContents()

        # advanced options table
        self.advancedLabel = QtGui.QLabel("\n  Advanced Options")
        # make table
        self.tableA = QtGui.QTableWidget(self)
        self.tableA.resize(800, 800)

        self.tableA.setRowCount(7)
        self.tableA.setColumnCount(2)
        self.tableA.setColumnWidth(0, 300)
        self.tableA.setColumnWidth(1, 300)

        self.tableA.verticalHeader().setVisible(False)
        self.tableA.horizontalHeader().setStretchLastSection(True)

        self.tableA.setHorizontalHeaderLabels(
            ("Advanced Property;Value").split(";"))
        table_utils.setTableHeaders(self.tableA)

        table_utils.setRowName(self.tableA, 0, "Maximum entropy constant (A)")
        self.AConst = table_utils.addDoubleToTable(self.tableA, 0.1, 0)

        table_utils.setRowName(self.tableA, 1, "Lagrange multiplier for chi^2")
        self.factor = table_utils.addDoubleToTable(self.tableA, 1.04, 1)

        table_utils.setRowName(self.tableA, 2, "Inner Iterations")
        self.inner_loop = table_utils.addSpinBoxToTable(self.tableA, 10, 2)

        table_utils.setRowName(self.tableA, 3, "Outer Iterations")
        self.outer_loop = table_utils.addSpinBoxToTable(self.tableA, 10, 3)

        table_utils.setRowName(self.tableA, 4, "Double pulse data")
        self.double_pulse_box = table_utils.addCheckBoxToTable(
            self.tableA, False, 4)

        table_utils.setRowName(self.tableA, 5, "Number of data points")
        self.N_points = table_utils.addComboToTable(self.tableA, 5, options)

        table_utils.setRowName(self.tableA, 6, "Maximum Field ")
        self.max_field = table_utils.addDoubleToTable(self.tableA, 1000.0, 6)

        # layout
        # this is if complex data is unhidden
        self.table.setMinimumSize(40, 203)
        self.tableA.setMinimumSize(40, 207)

        # make buttons
        self.button = QtGui.QPushButton('Calculate MaxEnt', self)
        self.button.setStyleSheet("background-color:lightgrey")
        self.cancel = QtGui.QPushButton('Cancel', self)
        self.cancel.setStyleSheet("background-color:lightgrey")
        self.cancel.setEnabled(False)
        # connects
        self.button.clicked.connect(self.MaxEntButtonClick)
        self.cancel.clicked.connect(self.cancelClick)
        self.table.cellClicked.connect(self.phaseBoxClick)
        # button layout
        self.buttonLayout = QtGui.QHBoxLayout()
        self.buttonLayout.addWidget(self.button)
        self.buttonLayout.addWidget(self.cancel)
        # add to layout
        splitter.addWidget(self.table)
        splitter.addWidget(self.advancedLabel)
        splitter.addWidget(self.tableA)
        self.grid.addWidget(splitter)
        self.grid.addLayout(self.buttonLayout)
コード例 #11
0
    def setup_phase_table_options_table(self):
        self.phase_table_options_table.setColumnWidth(0, 300)
        self.phase_table_options_table.setColumnWidth(1, 300)

        # populate table
        options = []

        table_utils.setRowName(self.phase_table_options_table, 0, "Workspace")
        self.input_workspace_combo_box = table_utils.addComboToTable(self.phase_table_options_table, 0, options)

        table_utils.setRowName(self.phase_table_options_table, 1, "Forward group")
        self.forward_group_combo = table_utils.addComboToTable(self.phase_table_options_table, 1, options)

        table_utils.setRowName(self.phase_table_options_table, 2, "Backward group")
        self.backward_group_combo = table_utils.addComboToTable(self.phase_table_options_table, 2, options)

        table_utils.setRowName(self.phase_table_options_table, 3, "First Good Data")
        self.first_good_data_item = table_utils.addDoubleToTable(self.phase_table_options_table, 0.1, 3)

        table_utils.setRowName(self.phase_table_options_table, 4, "Last Good Data")
        self.last_good_data_item = table_utils.addDoubleToTable(self.phase_table_options_table, 15.0, 4)

        table_utils.setRowName(self.phase_table_options_table, 5, "Output fit information")
        self.output_fit_info_box = table_utils.addCheckBoxToTable(
            self.phase_table_options_table, False, 5)

        self.phase_table_options_table.resizeRowsToContents()

        table_utils.setTableHeaders(self.phase_table_options_table)

        self.phase_quad_table.setColumnWidth(0, 300)
        self.phase_quad_table.setColumnWidth(1, 300)

        # self.calculate_phase_table_button = QtWidgets.QPushButton('Calculate Phase Table', self)
        table_utils.setRowName(self.phase_quad_table, 0, 'InputWorkspace')
        self.phase_quad_input_workspace_combo = table_utils.addComboToTable(self.phase_quad_table, 0, options)

        table_utils.setRowName(self.phase_quad_table, 1, 'PhaseTable')
        self.phase_quad_phase_table_combo = table_utils.addComboToTable(self.phase_quad_table, 1, options)

        self.phase_quad_table.resizeRowsToContents()

        # add to layout
        table_utils.setTableHeaders(self.phase_quad_table)
コード例 #12
0
    def setup_phase_table_options_table(self):
        self.phase_table_options_table.setColumnCount(2)
        self.phase_table_options_table.setColumnWidth(0, 300)
        self.phase_table_options_table.setColumnWidth(1, 300)

        self.phase_table_options_table.setRowCount(6)
        self.phase_table_options_table.setHorizontalHeaderLabels(
            ["Property", "Value"])
        header = self.phase_table_options_table.horizontalHeader()
        header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
        header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)
        vertical_headers = self.phase_table_options_table.verticalHeader()
        vertical_headers.setSectionsMovable(False)
        vertical_headers.setSectionResizeMode(
            QtWidgets.QHeaderView.ResizeToContents)
        vertical_headers.setVisible(True)
        self.phase_table_options_table.horizontalHeaderItem(0).setToolTip("")
        self.phase_table_options_table.horizontalHeaderItem(1).setToolTip("")

        # populate table
        options = []

        table_utils.setRowName(self.phase_table_options_table, 0, "Workspace")
        self.input_workspace_combo_box = table_utils.addComboToTable(
            self.phase_table_options_table, 0, options)

        table_utils.setRowName(self.phase_table_options_table, 1,
                               "Forward group")
        self.forward_group_combo = table_utils.addComboToTable(
            self.phase_table_options_table, 1, options)

        table_utils.setRowName(self.phase_table_options_table, 2,
                               "Backward group")
        self.backward_group_combo = table_utils.addComboToTable(
            self.phase_table_options_table, 2, options)

        table_utils.setRowName(self.phase_table_options_table, 3,
                               "First Good Data")
        self.first_good_data_item, self.first_good_data_validator = table_utils.addDoubleToTable(
            self.phase_table_options_table, 0.1, 3)

        table_utils.setRowName(self.phase_table_options_table, 4,
                               "Last Good Data")
        self.last_good_data_item, self.last_good_data_validator = table_utils.addDoubleToTable(
            self.phase_table_options_table, 15.0, 4)

        table_utils.setRowName(self.phase_table_options_table, 5,
                               "Output fit information")
        self.output_fit_info_box = table_utils.addCheckBoxToTable(
            self.phase_table_options_table, False, 5)
コード例 #13
0
    def setup_fit_options_table(self):
        self.fit_options_table.setRowCount(6)
        self.fit_options_table.setColumnCount(2)
        self.fit_options_table.setColumnWidth(0, 150)
        self.fit_options_table.setColumnWidth(1, 300)
        self.fit_options_table.verticalHeader().setVisible(False)
        self.fit_options_table.horizontalHeader().setStretchLastSection(True)
        self.fit_options_table.setHorizontalHeaderLabels(
            ("Property;Value").split(";"))

        table_utils.setRowName(self.fit_options_table, FIT_START_TABLE_ROW, "Time Start")
        self.time_start = table_utils.addDoubleToTable(self.fit_options_table, 0.0, FIT_START_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, FIT_END_TABLE_ROW, "Time End")
        self.time_end = table_utils.addDoubleToTable(self.fit_options_table, 15.0, FIT_END_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, 2, "Minimizer")
        self.minimizer_combo = table_utils.addComboToTable(self.fit_options_table, 2, [])
        self.minimizer_combo.addItems(allowed_minimizers)

        table_utils.setRowName(self.fit_options_table, RAW_DATA_TABLE_ROW, "Fit To Raw Data")
        self.fit_to_raw_data_checkbox = table_utils.addCheckBoxWidgetToTable(
            self.fit_options_table, True, RAW_DATA_TABLE_ROW)

        table_utils.setRowName(self.fit_options_table, TF_ASYMMETRY_MODE_TABLE_ROW, "TF Asymmetry Mode")
        self.tf_asymmetry_mode_checkbox = table_utils.addCheckBoxWidgetToTable(
            self.fit_options_table, False, TF_ASYMMETRY_MODE_TABLE_ROW)

        table_utils.setRowName(self.fit_options_table, 5, "Evaluate Function As")
        self.evaluation_combo = table_utils.addComboToTable(self.fit_options_table, 5, ['CentrePoint', 'Histogram'])
コード例 #14
0
ファイル: fft_view_new.py プロジェクト: mantidproject/mantid
    def __init__(self, parent=None):
        super(FFTView, self).__init__(parent)
        self.grid = QtWidgets.QGridLayout(self)

        # add splitter for resizing
        splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical)

        # make table
        self.FFTTable = QtWidgets.QTableWidget(self)
        self.FFTTable.resize(800, 800)
        self.FFTTable.setRowCount(6)
        self.FFTTable.setColumnCount(2)
        self.FFTTable.setColumnWidth(0, 300)
        self.FFTTable.setColumnWidth(1, 300)
        self.FFTTable.verticalHeader().setVisible(False)
        self.FFTTable.horizontalHeader().setStretchLastSection(True)
        self.FFTTable.setHorizontalHeaderLabels(
            ("FFT Property;Value").split(";"))
        # populate table
        options = ['test']

        table_utils.setRowName(self.FFTTable, 0, "Workspace")
        self.ws = table_utils.addComboToTable(self.FFTTable, 0, options)
        self.Im_box_row = 1
        table_utils.setRowName(
            self.FFTTable,
            self.Im_box_row,
            "Imaginary Data")
        self.Im_box = table_utils.addCheckBoxToTable(
            self.FFTTable, True, self.Im_box_row)

        table_utils.setRowName(self.FFTTable, 2, "Imaginary Workspace")
        self.Im_ws = table_utils.addComboToTable(self.FFTTable, 2, options)

        self.shift_box_row = 3
        table_utils.setRowName(self.FFTTable, self.shift_box_row, "Auto shift")
        self.shift_box = table_utils.addCheckBoxToTable(
            self.FFTTable, True, self.shift_box_row)

        table_utils.setRowName(self.FFTTable, 4, "Shift")
        self.shift = table_utils.addDoubleToTable(self.FFTTable, 0.0, 4)
        self.FFTTable.hideRow(4)

        table_utils.setRowName(self.FFTTable, 5, "Use Raw data")
        self.Raw_box = table_utils.addCheckBoxToTable(self.FFTTable, True, 5)

        self.FFTTable.resizeRowsToContents()
        # make advanced table options
        self.advancedLabel = QtWidgets.QLabel("\n Advanced Options")
        self.FFTTableA = QtWidgets.QTableWidget(self)
        self.FFTTableA.resize(800, 800)
        self.FFTTableA.setRowCount(4)
        self.FFTTableA.setColumnCount(2)
        self.FFTTableA.setColumnWidth(0, 300)
        self.FFTTableA.setColumnWidth(1, 300)
        self.FFTTableA.verticalHeader().setVisible(False)
        self.FFTTableA.horizontalHeader().setStretchLastSection(True)
        self.FFTTableA.setHorizontalHeaderLabels(
            ("Advanced Property;Value").split(";"))

        table_utils.setRowName(self.FFTTableA, 0, "Apodization Function")
        options = ["Lorentz", "Gaussian", "None"]
        self.apodization = table_utils.addComboToTable(
            self.FFTTableA, 0, options)

        table_utils.setRowName(
            self.FFTTableA,
            1,
            "Decay Constant (micro seconds)")
        self.decay = table_utils.addDoubleToTable(self.FFTTableA, 4.4, 1)

        table_utils.setRowName(self.FFTTableA, 2, "Negative Padding")
        self.negativePadding = table_utils.addCheckBoxToTable(
            self.FFTTableA, True, 2)

        table_utils.setRowName(self.FFTTableA, 3, "Padding")
        self.padding = table_utils.addSpinBoxToTable(self.FFTTableA, 1, 3)
        self.FFTTableA.resizeRowsToContents()

        # make button
        self.button = QtWidgets.QPushButton('Calculate FFT', self)
        self.button.setStyleSheet("background-color:lightgrey")
        # connects
        self.FFTTable.cellClicked.connect(self.tableClick)
        self.button.clicked.connect(self.buttonClick)
        self.ws.currentIndexChanged.connect(self.phaseCheck)
        # add to layout
        self.FFTTable.setMinimumSize(40, 158)
        self.FFTTableA.setMinimumSize(40, 127)
        table_utils.setTableHeaders(self.FFTTable)
        table_utils.setTableHeaders(self.FFTTableA)

        # add to layout
        splitter.addWidget(self.FFTTable)
        splitter.addWidget(self.advancedLabel)
        splitter.addWidget(self.FFTTableA)
        self.grid.addWidget(splitter)
        self.grid.addWidget(self.button)
コード例 #15
0
    def _setup_fit_options_table(self) -> None:
        """Setup the fit options table with the appropriate options."""
        self.fit_options_table.setRowCount(8)
        self.fit_options_table.setColumnCount(2)
        self.fit_options_table.setColumnWidth(0, 150)
        self.fit_options_table.verticalHeader().setVisible(False)
        self.fit_options_table.horizontalHeader().setStretchLastSection(True)
        self.fit_options_table.setHorizontalHeaderLabels(["Property", "Value"])

        table_utils.setRowName(self.fit_options_table, START_X_TABLE_ROW, "Start X")
        self.start_x_line_edit, self.start_x_validator = table_utils.addDoubleToTable(self.fit_options_table, 0.0,
                                                                                      START_X_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, END_X_TABLE_ROW, "End X")
        self.end_x_line_edit, self.end_x_validator = table_utils.addDoubleToTable(self.fit_options_table, 15.0,
                                                                                  END_X_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, EXCLUDE_RANGE_TABLE_ROW, "Exclude Range")
        self.exclude_range_checkbox = table_utils.addCheckBoxWidgetToTable(
            self.fit_options_table, False, EXCLUDE_RANGE_TABLE_ROW)

        table_utils.setRowName(self.fit_options_table, EXCLUDE_START_X_TABLE_ROW, "Exclude Start X")
        self.exclude_start_x_line_edit, self.exclude_start_x_validator = table_utils.addDoubleToTable(
            self.fit_options_table, 15.0, EXCLUDE_START_X_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, EXCLUDE_END_X_TABLE_ROW, "Exclude End X")
        self.exclude_end_x_line_edit, self.exclude_end_x_validator = table_utils.addDoubleToTable(
            self.fit_options_table, 15.0, EXCLUDE_END_X_TABLE_ROW, 1)

        table_utils.setRowName(self.fit_options_table, RAW_DATA_TABLE_ROW, "Fit To Raw Data")
        self.fit_to_raw_data_checkbox = table_utils.addCheckBoxWidgetToTable(
            self.fit_options_table, True, RAW_DATA_TABLE_ROW)

        table_utils.setRowName(self.fit_options_table, MINIMIZER_TABLE_ROW, "Minimizer")
        self.minimizer_combo = table_utils.addComboToTable(self.fit_options_table, MINIMIZER_TABLE_ROW, [])
        self.minimizer_combo.addItems(ALLOWED_MINIMIZERS)

        table_utils.setRowName(self.fit_options_table, EVALUATE_AS_TABLE_ROW, "Evaluate Function As")
        self.evaluation_combo = table_utils.addComboToTable(self.fit_options_table, EVALUATE_AS_TABLE_ROW,
                                                            ['CentrePoint', 'Histogram'])
コード例 #16
0
 def set_start_and_end_x_labels(self, start_x_label: str, end_x_label: str) -> None:
     """Sets the labels to use for the start and end X labels in the fit options table."""
     table_utils.setRowName(self.fit_options_table, START_X_TABLE_ROW, start_x_label)
     table_utils.setRowName(self.fit_options_table, END_X_TABLE_ROW, end_x_label)
     table_utils.setRowName(self.fit_options_table, EXCLUDE_START_X_TABLE_ROW, f"Exclude {start_x_label}")
     table_utils.setRowName(self.fit_options_table, EXCLUDE_END_X_TABLE_ROW, f"Exclude {end_x_label}")