def __determine_frequency_units(self): string = experimentinfo_table.get_units(conn, self.experiment.mid) if string is "MHz": return u.MHz elif string is "GHz": return u.GHz else: return u.MHz
def __setup__(self, experiment): """ :param experiment: :return: """ mid = experiment.mid name = experiment.name composition = info_table.get_composition(conn, mid) notes = info_table.get_notes(conn, mid) units = info_table.get_units(conn, mid) type = info_table.get_type(conn, mid) total_peaks = peaks_table.get_peak_count(conn, mid) assigned = experiment.get_assigned_peaks_count() invalid_mol, invalid_peaks = experiment.get_invalidated_peaks_count() valid_mol, valid_peaks = experiment.get_validated_count() pending_peaks = assigned - valid_peaks - invalid_peaks pending_mol = len(experiment.molecule_matches) - invalid_mol - valid_mol unnassigned = total_peaks - valid_peaks # Set labels to data # self.ui.experiment_name_lbl.setText(name) self.ui.composition_val.setText(composition) self.ui.notes_val.setText(notes) self.ui.units_val.setText(units) self.ui.type_val.setText(type) self.ui.total_peaks_val.setText(str(total_peaks)) self.ui.invalid_mol_num.display(invalid_mol) self.ui.invalid_peaks_num.display(invalid_peaks) self.ui.valid_mol_num.display(valid_mol) self.ui.valid_peaks_num.display(valid_peaks) self.ui.pending_mol_num.display(pending_mol) self.ui.pending_peaks_num.display(pending_peaks) self.ui.unnassigned_peaks_num.display(unnassigned) # Formatting self.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
def populate_info_table_as_experiment(mid, table_widget): row_count = 6 # Number of Rows column_count = 1 # Number of Columnns [mid, name, category] # Format Table table_widget.setRowCount(row_count) table_widget.setColumnCount(column_count) table_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) table_widget.setSortingEnabled(True) # Set Header Label header = table_widget.horizontalHeader() header.setStretchLastSection(True) header.setResizeMode(QHeaderView.Stretch) # Set Vertical Header table_widget.setVerticalHeaderLabels( ["EID", "Type", "Units", "Composition", "Notes", "Last-Updated"]) # Get row data eid = experimentinfo_table.get_eid(conn, mid) type = experimentinfo_table.get_type(conn, mid) units = experimentinfo_table.get_units(conn, mid) composition = experimentinfo_table.get_composition(conn, mid) notes = experimentinfo_table.get_notes(conn, mid) updated = experimentinfo_table.get_last_updated(conn, mid) # Convert Data to QTableWidgetItem eid_item = QTableWidgetItem(str(eid)) type_item = QTableWidgetItem(str(type)) units_item = QTableWidgetItem(str(units)) composition_item = QTableWidgetItem(str(composition)) notes_item = QTableWidgetItem(str(notes)) updated_item = QTableWidgetItem(str(updated)) # Add Widget Items to Table table_widget.setItem(0, 0, eid_item) table_widget.setItem(0, 1, type_item) table_widget.setItem(0, 2, units_item) table_widget.setItem(0, 3, composition_item) table_widget.setItem(0, 4, notes_item) table_widget.setItem(0, 5, updated_item)
def populate_info_table_as_experiment(mid, table_widget): row_count = 6 # Number of Rows column_count = 1 # Number of Columnns [mid, name, category] # Format Table table_widget.setRowCount(row_count) table_widget.setColumnCount(column_count) table_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) table_widget.setSortingEnabled(True) # Set Header Label header = table_widget.horizontalHeader() header.setStretchLastSection(True) header.setResizeMode(QHeaderView.Stretch) # Set Vertical Header table_widget.setVerticalHeaderLabels(["EID", "Type", "Units", "Composition", "Notes", "Last-Updated"]) # Get row data eid = experimentinfo_table.get_eid(conn, mid) type = experimentinfo_table.get_type(conn, mid) units = experimentinfo_table.get_units(conn, mid) composition = experimentinfo_table.get_composition(conn, mid) notes = experimentinfo_table.get_notes(conn, mid) updated = experimentinfo_table.get_last_updated(conn, mid) # Convert Data to QTableWidgetItem eid_item = QTableWidgetItem(str(eid)) type_item = QTableWidgetItem(str(type)) units_item = QTableWidgetItem(str(units)) composition_item = QTableWidgetItem(str(composition)) notes_item = QTableWidgetItem(str(notes)) updated_item = QTableWidgetItem(str(updated)) # Add Widget Items to Table table_widget.setItem(0, 0, eid_item) table_widget.setItem(0, 1, type_item) table_widget.setItem(0, 2, units_item) table_widget.setItem(0, 3, composition_item) table_widget.setItem(0, 4, notes_item) table_widget.setItem(0, 5, updated_item)
def __get_table_items(self, mid, category): items = [] name = molecules_table.get_name(conn, mid) items.append(QTableWidgetItem(name)) if category == 'known': units = knowninfo_table.get_units(conn, mid) temperature = knowninfo_table.get_temperature(conn, mid) isotope = knowninfo_table.is_isotype(conn, mid) vibrational = knowninfo_table.is_vibrational(conn, mid) notes = knowninfo_table.get_notes(conn, mid) items.append(QTableWidgetItem(units)) items.append(QTableWidgetItem(str(temperature))) items.append(QTableWidgetItem(str(isotope))) items.append(QTableWidgetItem(str(vibrational))) items.append(QTableWidgetItem(notes)) labels = ['name', 'units', 'temperature', 'isotope', 'vibrational', 'notes'] elif category == 'experiment': type = experimentinfo_table.get_type(conn, mid) units = experimentinfo_table.get_units(conn, mid) notes = experimentinfo_table.get_notes(conn, mid) items.append(QTableWidgetItem(str(units))) items.append(QTableWidgetItem(str(type))) items.append(QTableWidgetItem(notes)) labels = ['Name', 'Units', 'Type', 'Notes'] else: #print category + " but here" notes = knowninfo_table.get_notes(conn, mid) items.append(QTableWidgetItem(notes)) labels = ['Name', 'Notes'] return items, labels
def get_units(self): return info.get_units(conn, self.mid)