def __init__(self, lines, subplot, vlines=[], parent=None): super(RemovePlotWindow, self).__init__() all_lines = lines + vlines self._subplot = subplot self.grid = QtWidgets.QGridLayout() self.table = QtWidgets.QTableWidget(self) self.table.resize(200, 200) self.table.setRowCount(len(all_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(all_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)
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], col=WORKSPACE_NAME_COLUMN) table_utils.addCheckBoxToTable(self.item_table_widget, row[1], insertion_index, CHECKBOX_COLUMN) self.set_row_enabled(insertion_index, row[2]) self.item_table_widget.blockSignals(False)
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}")
def _setup_fit_options_table(self) -> None: """Setup the fit options table with the appropriate options.""" self.fit_options_table.setRowCount(12) 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']) table_utils.setRowName(self.fit_options_table, PLOT_GUESS_TYPE, "Plot guess using") self.plot_guess_type_combo = table_utils.addComboToTable( self.fit_options_table, PLOT_GUESS_TYPE, [X_FROM_FIT_RANGE, X_FROM_DATA_RANGE, X_FROM_CUSTOM]) table_utils.setRowName(self.fit_options_table, PLOT_GUESS_POINTS, "Points") self.plot_guess_points_spin_box = table_utils.addSpinBoxToTable( self.fit_options_table, 1000, PLOT_GUESS_POINTS) self.plot_guess_points_spin_box.setMinimum(1) self.show_plot_guess_points(False) table_utils.setRowName(self.fit_options_table, PLOT_GUESS_START_X, "Start X") self.plot_guess_start_x_line_edit, self.plot_guess_start_x_validator = table_utils.addDoubleToTable( self.fit_options_table, 0.0, PLOT_GUESS_START_X, 1) self.show_plot_guess_start_x(False) table_utils.setRowName(self.fit_options_table, PLOT_GUESS_END_X, "End X") self.plot_guess_end_x_line_edit, self.plot_guess_end_x_validator = table_utils.addDoubleToTable( self.fit_options_table, 15.0, PLOT_GUESS_END_X, 1) self.show_plot_guess_end_x(False)
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)
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'])
def __init__(self, parent=None): super(MaxEntView, self).__init__(parent) self.grid = QtWidgets.QVBoxLayout(self) self._runs_selector = CyclicDataSelectorView(self) self._runs_selector.set_data_combo_box_label("Runs:") self._runs_selector.set_data_combo_box_label_width(50) self._period_selector = CyclicDataSelectorView(self) self._period_selector.set_data_combo_box_label("Period:") self._period_selector.set_data_combo_box_label_width(50) # add splitter for resizing splitter = QtWidgets.QSplitter(QtCore.Qt.Vertical) self.run = None # make table self.table = QtWidgets.QTableWidget(self) self.table.resize(800, 800) self.table.setRowCount(7) 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 = [] table_utils.setRowName(self.table, 0, "Calculate by") self.method = table_utils.addComboToTable(self.table, 0, options) table_utils.setRowName(self.table, 1, "Phase Table") self.phase_table_combo = table_utils.addComboToTable( self.table, 1, options) table_utils.setRowName(self.table, 2, "Fit dead times") self.dead_box = table_utils.addCheckBoxToTable(self.table, True, 2) table_utils.setRowName(self.table, 3, "Output phase table") self.output_phase_box = table_utils.addCheckBoxToTable( self.table, False, 3) table_utils.setRowName(self.table, 4, "Output deadtimes") self.output_dead_box = table_utils.addCheckBoxToTable( self.table, False, 4) table_utils.setRowName(self.table, 5, "Output reconstructed data") self.output_data_box = table_utils.addCheckBoxToTable( self.table, False, 5) table_utils.setRowName(self.table, 6, "Output phase convergence") self.output_phase_evo_box = table_utils.addCheckBoxToTable( self.table, False, 6) self.table.resizeRowsToContents() # advanced options table self.advancedLabel = QtWidgets.QLabel("\n Advanced Options") # make table self.tableA = QtWidgets.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, minimum=0.0) table_utils.setRowName(self.tableA, 1, "Lagrange multiplier for chi^2") self.factor, _ = table_utils.addDoubleToTable(self.tableA, 1.04, 1, minimum=0.0) 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, minimum=0.0) # layout # this is if complex data is unhidden self.table.setMinimumSize(40, 203) self.tableA.setMinimumSize(40, 207) # make buttons self.button = QtWidgets.QPushButton('Calculate MaxEnt', self) self.button.setStyleSheet("background-color:lightgrey") self.cancel = QtWidgets.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) # button layout self.buttonLayout = QtWidgets.QHBoxLayout() self.buttonLayout.addWidget(self.button) self.buttonLayout.addWidget(self.cancel) # add to layout self.grid.addWidget(self._runs_selector) self.grid.addWidget(self._period_selector) splitter.addWidget(self.table) splitter.addWidget(self.advancedLabel) splitter.addWidget(self.tableA) self.grid.addWidget(splitter) self.grid.addLayout(self.buttonLayout)
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, False, self.Im_box_row) table_utils.setRowName(self.FFTTable, 2, "Imaginary Workspace") self.Im_ws = table_utils.addComboToTable(self.FFTTable, 2, options) self.FFTTable.hideRow(2) 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) self.FFTTable.hideRow(3) 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)