Example #1
0
    def stack01_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(
            QtWidgets.QLabel("1. Specify the folder containing the PLE files.",
                             self))
        hbox_import = QtWidgets.QHBoxLayout()
        hbox_import.addWidget(QtWidgets.QLabel("Folder", self))
        folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        folder_button.clicked.connect(
            lambda: self.folder_dialog(path='last_import_ple'))
        folder_button.setToolTip('Choose data folder')
        hbox_import.addWidget(folder_button)
        self.folder_edit = QtWidgets.QLineEdit(paths['last_import_ple'], self)
        self.folder_edit.setMinimumWidth(180)
        self.folder_edit.setDisabled(True)
        hbox_import.addWidget(self.folder_edit)
        hbox_import.addStretch(-1)
        vbox.addLayout(hbox_import)

        vbox.addWidget(Separator())
        vbox.addWidget(
            QtWidgets.QLabel("2. Specify the file containing the UV-Vis data.",
                             self))
        hbox_import_file = QtWidgets.QHBoxLayout()
        hbox_import_file.addWidget(QtWidgets.QLabel("File", self))
        file_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        file_button.clicked.connect(
            lambda: self.file_dialog(path='last_import_uvvis'))
        file_button.setToolTip('Choose data file')
        hbox_import_file.addWidget(file_button)
        self.file_edit = QtWidgets.QLineEdit(paths['last_import_uvvis'], self)
        self.file_edit.setMinimumWidth(180)
        self.file_edit.setDisabled(True)
        hbox_import_file.addWidget(self.file_edit)
        hbox_import_file.addStretch(-1)
        vbox.addLayout(hbox_import_file)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("3. Load the spectral data.", self))
        hbox_load = QtWidgets.QHBoxLayout()
        load_button = QtWidgets.QPushButton("Load Data")
        hbox_load.addWidget(load_button)
        load_button.clicked.connect(self.load_data)
        hbox_load.addStretch(-1)
        vbox.addLayout(hbox_load)

        vbox.addWidget(Separator())
        self.load_edit = QtWidgets.QTextEdit("", self)
        vbox.addWidget(self.load_edit)

        hbox_back_next = QtWidgets.QHBoxLayout()
        hbox_back_next.addStretch(-1)
        forward_button = QtWidgets.QPushButton("Next >>")
        forward_button.clicked.connect(lambda: self.Stack.setCurrentIndex(1))
        hbox_back_next.addWidget(forward_button)
        vbox.addLayout(hbox_back_next)

        self.stack01_load.setLayout(vbox)
Example #2
0
    def stack02_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(QtWidgets.QLabel("6. Check temperature as measured by thermistor.\n"
                                        "Specify the name of the repeat baseline measurement.", self))
        hbox_show_temp = QtWidgets.QHBoxLayout()
        hbox_show_temp.addWidget(QtWidgets.QLabel("Baseline name", self))
        baseline_edit = QtWidgets.QLineEdit(defaults['process_pv'][1], self)
        baseline_edit.setFixedWidth(100)
        hbox_show_temp.addWidget(baseline_edit)
        show_button = QtWidgets.QPushButton("Show")
        show_button.clicked.connect(lambda: self.show_t_data(baseline_edit.text()))
        hbox_show_temp.addWidget(show_button)
        hbox_show_temp.addStretch(-1)
        vbox.addLayout(hbox_show_temp)

        vbox.addWidget(Separator())
        hbox_plot = QtWidgets.QHBoxLayout()
        self.t_hist_canvas = FigureCanvas(Figure(figsize=(5, 5)))
        self.t_hist_canvas.figure.tight_layout(pad=0.3)
        self.update_t_hist.connect(self.t_hist_canvas.figure.canvas.draw)
        hbox_plot.addWidget(self.t_hist_canvas)
        self.voc_t_canvas = FigureCanvas(Figure(figsize=(5, 5)))
        self.voc_t_canvas.figure.tight_layout(pad=0.3)
        self.update_voc_t.connect(self.voc_t_canvas.figure.canvas.draw)
        hbox_plot.addWidget(self.voc_t_canvas)
        hbox_plot.addStretch(-1)
        vbox.addLayout(hbox_plot)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("7. Apply temperature correction if the data looks sensible.\n"
                                        "Temperature and Voc are roughly linearly proportional, high Temp "
                                        "corresponding to low Voc.\n"
                                        "However, Voc is also dependent on the irradiance (next step), so if in doubt,"
                                        "apply the temperature correction.", self))
        hbox_apply_temp = QtWidgets.QHBoxLayout()
        temp_corr_button = QtWidgets.QPushButton("Correct to 25 C")
        hbox_apply_temp.addWidget(temp_corr_button)
        hbox_apply_temp.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_cbox = QtWidgets.QCheckBox()
        overwrite_cbox.setChecked(defaults['process_pv'][2])
        hbox_apply_temp.addWidget(overwrite_cbox)
        temp_corr_button.clicked.connect(lambda: self.apply_temp_corr(overwrite=overwrite_cbox.isChecked()))
        hbox_apply_temp.addStretch(-1)
        vbox.addLayout(hbox_apply_temp)
        vbox.addStretch(-1)

        hbox_back_next = QtWidgets.QHBoxLayout()
        back_button = QtWidgets.QPushButton("<< Previous")
        back_button.clicked.connect(lambda: self.Stack.setCurrentIndex(0))
        hbox_back_next.addWidget(back_button)
        hbox_back_next.addStretch(-1)
        forward_button = QtWidgets.QPushButton("Next >>")
        forward_button.clicked.connect(lambda: self.Stack.setCurrentIndex(2))
        hbox_back_next.addWidget(forward_button)
        vbox.addLayout(hbox_back_next)

        self.stack02_temperature.setLayout(vbox)
Example #3
0
    def stack04_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(QtWidgets.QLabel("10. Average by experiment. Produces an average and standard deviation"
                                        "value for Isc, Voc, and Pmax for each experiment.", self))
        hbox_avg_exp = QtWidgets.QHBoxLayout()
        avg_exp_button = QtWidgets.QPushButton("Average Experiment")
        hbox_avg_exp.addWidget(avg_exp_button)
        hbox_avg_exp.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_avg_exp_cbox = QtWidgets.QCheckBox()
        overwrite_avg_exp_cbox.setChecked(defaults['process_pv'][6])
        hbox_avg_exp.addWidget(overwrite_avg_exp_cbox)
        avg_exp_button.clicked.connect(lambda: self.avg_exp_data(overwrite=overwrite_avg_exp_cbox.isChecked()))
        hbox_avg_exp.addStretch(-1)
        vbox.addLayout(hbox_avg_exp)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("11. Check time dependent behaviour of baseline (or any other "
                                        "film that was measured repeatedly.", self))
        hbox_show_time = QtWidgets.QHBoxLayout()
        hbox_show_time.addWidget(QtWidgets.QLabel("Baseline name", self))
        baseline_edit = QtWidgets.QLineEdit(defaults['process_pv'][7], self)
        baseline_edit.setFixedWidth(100)
        hbox_show_time.addWidget(baseline_edit)
        hbox_show_time.addWidget(QtWidgets.QLabel("Y-axis", self))
        yaxis_combobox = QtWidgets.QComboBox(self)
        yaxis_combobox.addItem("pmax")
        yaxis_combobox.addItem("isc")
        hbox_show_time.addWidget(yaxis_combobox)
        show_button = QtWidgets.QPushButton("Show")
        show_button.clicked.connect(lambda: self.show_avg_exp_data(baseline_edit.text(), yaxis_combobox.currentText()))
        hbox_show_time.addWidget(show_button)
        hbox_show_time.addStretch(-1)
        vbox.addLayout(hbox_show_time)

        vbox.addWidget(Separator())
        hbox_plot = QtWidgets.QHBoxLayout()
        self.time_canvas = FigureCanvas(Figure(figsize=(6, 5)))
        self.time_canvas.figure.tight_layout(pad=0.3)
        self.update_time_dep.connect(self.time_canvas.figure.canvas.draw)
        hbox_plot.addWidget(self.time_canvas)
        hbox_plot.addStretch(-1)
        vbox.addLayout(hbox_plot)
        vbox.addStretch(-1)

        hbox_back_next = QtWidgets.QHBoxLayout()
        back_button = QtWidgets.QPushButton("<< Previous")
        back_button.clicked.connect(lambda: self.Stack.setCurrentIndex(2))
        hbox_back_next.addWidget(back_button)
        hbox_back_next.addStretch(-1)
        forward_button = QtWidgets.QPushButton("Next >>")
        forward_button.clicked.connect(lambda: self.Stack.setCurrentIndex(4))
        hbox_back_next.addWidget(forward_button)
        vbox.addLayout(hbox_back_next)

        self.stack04_averaging.setLayout(vbox)
    def init_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(
            QtWidgets.QLabel(
                "1. Specify the folder containing the processed files.", self))
        hbox_import = QtWidgets.QHBoxLayout()
        hbox_import.addWidget(QtWidgets.QLabel("Folder", self))
        folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        folder_button.clicked.connect(
            lambda: self.folder_dialog(path='spec_explore'))
        folder_button.setToolTip('Choose data folder')
        hbox_import.addWidget(folder_button)
        self.folder_edit = QtWidgets.QLineEdit(paths['spec_explore'], self)
        self.folder_edit.setMinimumWidth(180)
        self.folder_edit.setDisabled(True)
        hbox_import.addWidget(self.folder_edit)
        load_button = QtWidgets.QPushButton("Load")
        hbox_import.addWidget(load_button)
        load_button.clicked.connect(self.load_folder)
        hbox_import.addStretch(-1)
        vbox.addLayout(hbox_import)

        vbox.addWidget(Separator())
        hbox_selection = QtWidgets.QHBoxLayout()
        vbox_film_ids = QtWidgets.QVBoxLayout()
        vbox_film_ids.addWidget(QtWidgets.QLabel("Film IDs", self))
        self.film_id_table = QtWidgets.QTableWidget()
        self.film_id_table.setColumnCount(1)
        self.film_id_table.verticalHeader().setVisible(False)
        self.film_id_table.horizontalHeader().setVisible(False)
        self.film_id_table.setSelectionMode(
            QtWidgets.QAbstractItemView.MultiSelection)
        vbox_film_ids.addWidget(self.film_id_table)
        self.update_film_ids(labels=[])
        vbox_film_ids.addStretch(-1)
        hbox_selection.addLayout(vbox_film_ids)

        vbox_process = QtWidgets.QVBoxLayout()
        hbox_label = QtWidgets.QHBoxLayout()
        hbox_label.addWidget(QtWidgets.QLabel("Label", self))
        self.label_edit = QtWidgets.QLineEdit('', self)
        self.label_edit.setFixedWidth(180)
        hbox_label.addWidget(self.label_edit)
        hbox_label.addStretch(-1)
        vbox_process.addLayout(hbox_label)
        hbox_graphs = QtWidgets.QHBoxLayout()
        graphs_button = QtWidgets.QPushButton("Generate Plots")
        hbox_graphs.addWidget(graphs_button)
        graphs_button.clicked.connect(self.plot)
        hbox_graphs.addStretch(-1)
        vbox_process.addLayout(hbox_graphs)
        vbox_process.addStretch(-1)
        hbox_selection.addLayout(vbox_process)
        hbox_selection.addStretch(-1)
        vbox.addLayout(hbox_selection)
        self.setLayout(vbox)
Example #5
0
    def __init__(self, parent=None):
        super(TemplateWidget, self).__init__(parent)

        vbox_total = QtWidgets.QVBoxLayout()
        vbox_total.addWidget(QtWidgets.QLabel("Load Settings", self))
        self.listWidget = QtWidgets.QListWidget(self)
        for item in os.listdir(paths['templates']):
            self.listWidget.addItem(item.split('.')[0])
        vbox_total.addWidget(self.listWidget)
        hbox_apply_remove = QtWidgets.QHBoxLayout()
        self.apply_button = QtWidgets.QPushButton("Apply")
        self.apply_button.setToolTip("Apply settings")
        hbox_apply_remove.addWidget(self.apply_button)
        self.apply_button.clicked.connect(lambda: self.apply_settings(self.listWidget.currentItem()))
        self.remove_button = QtWidgets.QPushButton("Remove")
        self.remove_button.setToolTip("Remove selected settings")
        hbox_apply_remove.addWidget(self.remove_button)
        hbox_apply_remove.addStretch(-1)
        self.remove_button.clicked.connect(lambda: self.remove_settings(self.listWidget.currentItem()))
        vbox_total.addLayout(hbox_apply_remove)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Save Current Settings", self))
        hbox_save = QtWidgets.QHBoxLayout()
        hbox_save.addWidget(QtWidgets.QLabel('Name', self))
        self.save_name_edit = QtWidgets.QLineEdit('', self)
        self.save_name_edit.setFixedWidth(120)
        hbox_save.addWidget(self.save_name_edit)
        self.add_button = QtWidgets.QPushButton("Save")
        self.add_button.setToolTip("Save current settings")
        hbox_save.addWidget(self.add_button)
        hbox_save.addStretch(-1)
        self.add_button.clicked.connect(lambda: self.save_settings(self.save_name_edit.text()))
        vbox_total.addLayout(hbox_save)
        vbox_total.addStretch(-1)
        self.setLayout(vbox_total)
Example #6
0
    def init_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(
            QtWidgets.QLabel(
                "Determine the improvement/change in PCE vs blank matrix.",
                self))
        vbox.addWidget(
            QtWidgets.QLabel(
                "1. Specify the file containing processed data. The PCE change"
                "will be added to the same file.", self))

        hbox_import = QtWidgets.QHBoxLayout()
        hbox_import.addWidget(QtWidgets.QLabel("File", self))
        file_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        file_button.clicked.connect(self.file_dialog)
        file_button.setToolTip('Choose processed data file')
        hbox_import.addWidget(file_button)
        self.file_edit = QtWidgets.QLineEdit(paths['pv_improve_file'], self)
        self.file_edit.setMinimumWidth(180)
        self.file_edit.setDisabled(True)
        hbox_import.addWidget(self.file_edit)
        load_button = QtWidgets.QPushButton("Load")
        hbox_import.addWidget(load_button)
        load_button.clicked.connect(self.load_data)
        hbox_import.addStretch(-1)
        vbox.addLayout(hbox_import)

        vbox.addWidget(Separator())
        self.load_edit = QtWidgets.QTextEdit("", self)
        vbox.addWidget(self.load_edit)

        vbox.addWidget(Separator())
        vbox.addWidget(
            QtWidgets.QLabel(
                "2. Specify the groups that are to serve as a reference. Typically, these "
                "should be the \'blank matrix\' film sets.\n"
                "A linear fit along the specified axis is applied to serve as a baseline"
                "that the other films will be compared against.\n"
                "Separate group indices with commas", self))
        hbox_fit = QtWidgets.QHBoxLayout()
        hbox_fit.addWidget(QtWidgets.QLabel("Reference groups", self))
        ref_idx_edit = QtWidgets.QLineEdit('', self)
        ref_idx_edit.setFixedWidth(100)
        hbox_fit.addWidget(ref_idx_edit)
        hbox_fit.addWidget(QtWidgets.QLabel("Axis", self))
        xaxis_combobox = QtWidgets.QComboBox(self)
        xaxis_combobox.addItem("Thickness (mm)")
        xaxis_combobox.addItem("Tape Layers")
        hbox_fit.addWidget(xaxis_combobox)
        fit_button = QtWidgets.QPushButton("Fit reference")
        fit_button.clicked.connect(lambda: self.fit_reference(
            ref_idx_edit.text(), xaxis_combobox.currentText()))
        hbox_fit.addWidget(fit_button)
        hbox_fit.addStretch(-1)
        vbox.addLayout(hbox_fit)

        vbox.addWidget(Separator())
        hbox_plot = QtWidgets.QHBoxLayout()
        self.plot_canvas = FigureCanvas(Figure(figsize=(8, 5)))
        self.plot_canvas.figure.tight_layout(pad=0.3)
        self.update_plot.connect(self.plot_canvas.figure.canvas.draw)
        hbox_plot.addWidget(self.plot_canvas)
        hbox_plot.addStretch(-1)
        vbox.addLayout(hbox_plot)

        vbox.addWidget(Separator())
        vbox.addWidget(
            QtWidgets.QLabel(
                "3. Specify the groups that are to be analysed against the fitted baseline. "
                "Separate group indices with commas.", self))
        hbox_corr = QtWidgets.QHBoxLayout()
        hbox_corr.addWidget(QtWidgets.QLabel("Film groups", self))
        grp_idx_edit = QtWidgets.QLineEdit('', self)
        grp_idx_edit.setFixedWidth(100)
        hbox_corr.addWidget(grp_idx_edit)
        calc_button = QtWidgets.QPushButton("Calculate")
        calc_button.clicked.connect(lambda: self.compare_to_reference(
            grp_idx_edit.text(), xaxis_combobox.currentText()))
        hbox_corr.addWidget(calc_button)
        hbox_corr.addStretch(-1)
        vbox.addLayout(hbox_corr)

        vbox.addStretch(-1)
        self.setLayout(vbox)
Example #7
0
    def init_ui(self):
        hbox = QtWidgets.QHBoxLayout()
        vbox_graph = QtWidgets.QVBoxLayout()
        self.plot_canvas = FigureCanvas(Figure(figsize=(7, 7)))
        self.plot_canvas.figure.tight_layout(pad=0.3)
        self.update_plot.connect(self.plot_canvas.figure.canvas.draw)
        vbox_graph.addWidget(self.plot_canvas)
        vbox_graph.addStretch(-1)
        hbox.addLayout(vbox_graph)

        vbox = QtWidgets.QVBoxLayout()
        hbox_load = QtWidgets.QHBoxLayout()
        hbox_load.addWidget(QtWidgets.QLabel("Load file", self))
        file_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        file_button.clicked.connect(self.file_dialog)
        file_button.setToolTip('Choose processed data file')
        hbox_load.addWidget(file_button)
        self.file_edit = QtWidgets.QLineEdit(paths['pv_explore'], self)
        self.file_edit.setMinimumWidth(180)
        self.file_edit.setDisabled(True)
        hbox_load.addWidget(self.file_edit)
        load_button = QtWidgets.QPushButton("Load")
        hbox_load.addWidget(load_button)
        load_button.clicked.connect(self.load_data)
        hbox_load.addStretch(-1)
        vbox.addLayout(hbox_load)
        hbox_fname = QtWidgets.QHBoxLayout()
        hbox_fname.addWidget(QtWidgets.QLabel("Save file name", self))
        self.fname_edit = QtWidgets.QLineEdit('Graph', self)
        self.fname_edit.setMinimumWidth(80)
        hbox_fname.addWidget(self.fname_edit)
        save_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'save.png')), '')
        save_button.clicked.connect(self.save_image)
        save_button.setToolTip('Save current graph')
        hbox_fname.addWidget(save_button)
        clipboard_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'clipboard.png')), '')
        clipboard_button.clicked.connect(self.clipboard)
        clipboard_button.setToolTip('Save current graph to clipboard')
        hbox_fname.addWidget(clipboard_button)
        hbox_fname.addStretch(-1)
        vbox.addLayout(hbox_fname)

        vbox.addWidget(Separator())
        self.group_list = QtWidgets.QTreeWidget()
        self.group_list.setRootIsDecorated(False)
        self.group_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        self.group_list.setHeaderLabels([
            "Plot", "Group", "Matrix", "QDs", "QD Wl.", "QD Conc.", "Solvent",
            "Additives", "Add. Conc.", "Made", "Measured"
        ])
        self.group_list.header().setSectionResizeMode(
            QtWidgets.QHeaderView.ResizeToContents)
        self.group_list.setSortingEnabled(True)
        vbox.addWidget(self.group_list)

        vbox.addWidget(Separator())
        hbox_xy = QtWidgets.QHBoxLayout()
        hbox_xy.addWidget(QtWidgets.QLabel("X-axis", self))
        xaxis_combobox = QtWidgets.QComboBox(self)
        xaxis_combobox.addItem("Thickness (mm)")
        xaxis_combobox.addItem("Tape Layers")
        hbox_xy.addWidget(xaxis_combobox)
        hbox_xy.addWidget(QtWidgets.QLabel("Y-axis", self))
        yaxis_combobox = QtWidgets.QComboBox(self)
        yaxis_combobox.addItem("pmax")
        yaxis_combobox.addItem("isc")
        yaxis_combobox.addItem("voc")
        yaxis_combobox.addItem("pmax_eff")
        yaxis_combobox.addItem("isc_eff")
        yaxis_combobox.addItem("pmax_impr")
        yaxis_combobox.addItem("isc_impr")
        hbox_xy.addWidget(yaxis_combobox)
        hbox_xy.addStretch(-1)
        vbox.addLayout(hbox_xy)

        hbox_lims = QtWidgets.QHBoxLayout()
        hbox_lims.addWidget(QtWidgets.QLabel("Xmin", self))
        xmin_edit = QtWidgets.QLineEdit('', self)
        xmin_edit.setMinimumWidth(20)
        hbox_lims.addWidget(xmin_edit)
        hbox_lims.addWidget(QtWidgets.QLabel("Xmax", self))
        xmax_edit = QtWidgets.QLineEdit('', self)
        xmax_edit.setMinimumWidth(20)
        hbox_lims.addWidget(xmax_edit)
        hbox_lims.addWidget(QtWidgets.QLabel("Ymin", self))
        ymin_edit = QtWidgets.QLineEdit('', self)
        ymin_edit.setMinimumWidth(20)
        hbox_lims.addWidget(ymin_edit)
        hbox_lims.addWidget(QtWidgets.QLabel("Ymax", self))
        ymax_edit = QtWidgets.QLineEdit('', self)
        ymax_edit.setMinimumWidth(20)
        hbox_lims.addWidget(ymax_edit)
        hbox_lims.addStretch(-1)
        vbox.addLayout(hbox_lims)

        hbox_labels = QtWidgets.QHBoxLayout()
        hbox_labels.addWidget(QtWidgets.QLabel("X Label", self))
        xlabel_edit = QtWidgets.QLineEdit('', self)
        xlabel_edit.setMinimumWidth(80)
        hbox_labels.addWidget(xlabel_edit)
        hbox_labels.addWidget(QtWidgets.QLabel("Y Label", self))
        ylabel_edit = QtWidgets.QLineEdit('', self)
        ylabel_edit.setMinimumWidth(80)
        hbox_labels.addWidget(ylabel_edit)
        hbox_labels.addStretch(-1)
        vbox.addLayout(hbox_labels)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("Include in legend:", self))
        hbox_grid = QtWidgets.QHBoxLayout()
        grid_legend_items = QtWidgets.QGridLayout()
        leg_matrix_cb = QtWidgets.QCheckBox('Matrix')
        grid_legend_items.addWidget(leg_matrix_cb, 0, 0)
        leg_qd_cb = QtWidgets.QCheckBox('QDs')
        grid_legend_items.addWidget(leg_qd_cb, 0, 1)
        leg_qdwl_cb = QtWidgets.QCheckBox('QD Wavel.')
        grid_legend_items.addWidget(leg_qdwl_cb, 0, 2)
        leg_qdconc_cb = QtWidgets.QCheckBox('QD Conc.')
        grid_legend_items.addWidget(leg_qdconc_cb, 0, 3)
        leg_solvent_cb = QtWidgets.QCheckBox('Solvent')
        grid_legend_items.addWidget(leg_solvent_cb, 1, 0)
        leg_add_cb = QtWidgets.QCheckBox('Additives')
        grid_legend_items.addWidget(leg_add_cb, 1, 1)
        leg_addconc_cb = QtWidgets.QCheckBox('Add. Conc.')
        grid_legend_items.addWidget(leg_addconc_cb, 1, 2)
        hbox_grid.addLayout(grid_legend_items)
        hbox_grid.addStretch(-1)
        vbox.addLayout(hbox_grid)

        vbox.addWidget(Separator())
        hbox_plot = QtWidgets.QHBoxLayout()
        plot_button = QtWidgets.QPushButton("Plot")
        plot_button.clicked.connect(lambda: self.plot(
            groups=self.selected_groups(),
            xaxis=xaxis_combobox.currentText(),
            yaxis=yaxis_combobox.currentText(),
            xlabel=xlabel_edit.text(),
            ylabel=ylabel_edit.text(),
            xlim=[xmin_edit.text(), xmax_edit.text()],
            ylim=[ymin_edit.text(), ymax_edit.text()],
            legend=[
                leg_matrix_cb.isChecked(),
                leg_qd_cb.isChecked(),
                leg_qdwl_cb.isChecked(),
                leg_qdconc_cb.isChecked(),
                leg_solvent_cb.isChecked(),
                leg_add_cb.isChecked(),
                leg_addconc_cb.isChecked()
            ]))
        hbox_plot.addWidget(plot_button)
        hbox_plot.addStretch(-1)
        vbox.addLayout(hbox_plot)

        vbox.addStretch(-1)
        hbox.addLayout(vbox)
        self.setLayout(hbox)
Example #8
0
    def init_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(
            QtWidgets.QLabel(
                "Combine two existing, processed IV files into one.", self))
        vbox.addWidget(
            QtWidgets.QLabel(
                "1. Specify the files to be merged and the target folder for the "
                "combined file.", self))

        hbox_import1 = QtWidgets.QHBoxLayout()
        hbox_import1.addWidget(QtWidgets.QLabel("File #1", self))
        file1_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        file1_button.clicked.connect(lambda: self.file_dialog(origin=1))
        file1_button.setToolTip('Choose first file')
        hbox_import1.addWidget(file1_button)
        self.file1_edit = QtWidgets.QLineEdit(paths['last_export'], self)
        self.file1_edit.setMinimumWidth(180)
        self.file1_edit.setDisabled(True)
        hbox_import1.addWidget(self.file1_edit)
        hbox_import1.addStretch(-1)
        vbox.addLayout(hbox_import1)

        hbox_import2 = QtWidgets.QHBoxLayout()
        hbox_import2.addWidget(QtWidgets.QLabel("File #2", self))
        file2_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        file2_button.clicked.connect(lambda: self.file_dialog(origin=2))
        file2_button.setToolTip('Choose second file')
        hbox_import2.addWidget(file2_button)
        self.file2_edit = QtWidgets.QLineEdit(paths['last_export'], self)
        self.file2_edit.setMinimumWidth(180)
        self.file2_edit.setDisabled(True)
        hbox_import2.addWidget(self.file2_edit)
        hbox_import2.addStretch(-1)
        vbox.addLayout(hbox_import2)

        hbox_export = QtWidgets.QHBoxLayout()
        hbox_export.addWidget(QtWidgets.QLabel("Output folder", self))
        save_folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        save_folder_button.clicked.connect(lambda: self.folder_dialog())
        save_folder_button.setToolTip('Choose output folder')
        hbox_export.addWidget(save_folder_button)
        self.save_folder_edit = QtWidgets.QLineEdit(paths['last_export'], self)
        self.save_folder_edit.setMinimumWidth(180)
        self.save_folder_edit.setDisabled(True)
        hbox_export.addWidget(self.save_folder_edit)
        hbox_export.addStretch(-1)
        vbox.addLayout(hbox_export)

        vbox.addWidget(Separator())
        vbox.addWidget(
            QtWidgets.QLabel(
                "2. Create combined file in the target folder.\n"
                "Groups will be reassigned and indices reset.\n"
                "If file name exists, the combined file will be named "
                "\'Processed IV(1).xlsx\'.", self))
        hbox_merge = QtWidgets.QHBoxLayout()
        merge_button = QtWidgets.QPushButton("Merge Data")
        hbox_merge.addWidget(merge_button)
        merge_button.clicked.connect(self.merge_data)
        hbox_merge.addStretch(-1)
        vbox.addLayout(hbox_merge)
        vbox.addStretch(-1)
        self.setLayout(vbox)
Example #9
0
    def stack02_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(
            QtWidgets.QLabel("4. Specify output root folder for results.",
                             self))
        hbox_export = QtWidgets.QHBoxLayout()
        hbox_export.addWidget(QtWidgets.QLabel("Folder", self))
        save_folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        save_folder_button.clicked.connect(
            lambda: self.folder_dialog(path='last_export_spec'))
        save_folder_button.setToolTip('Choose output folder')
        hbox_export.addWidget(save_folder_button)
        self.save_folder_edit = QtWidgets.QLineEdit(paths['last_export_spec'],
                                                    self)
        self.save_folder_edit.setMinimumWidth(180)
        self.save_folder_edit.setDisabled(True)
        hbox_export.addWidget(self.save_folder_edit)
        hbox_export.addStretch(-1)
        vbox.addLayout(hbox_export)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("5. Pair and label spectra.", self))
        hbox_pairing = QtWidgets.QHBoxLayout()
        vbox_absorbance = QtWidgets.QVBoxLayout()
        vbox_absorbance.addWidget(QtWidgets.QLabel("Absorbance Labels", self))
        self.absorbance_table = QtWidgets.QTableWidget()
        self.absorbance_table.setColumnCount(1)
        self.absorbance_table.verticalHeader().setVisible(False)
        self.absorbance_table.horizontalHeader().setVisible(False)
        self.absorbance_table.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        vbox_absorbance.addWidget(self.absorbance_table)
        self.update_absorbance()
        vbox_absorbance.addStretch(-1)
        hbox_pairing.addLayout(vbox_absorbance)

        vbox_emission = QtWidgets.QVBoxLayout()
        vbox_emission.addWidget(QtWidgets.QLabel("Emission Labels", self))
        self.emission_table = QtWidgets.QTableWidget()
        self.emission_table.setColumnCount(1)
        self.emission_table.verticalHeader().setVisible(False)
        self.emission_table.horizontalHeader().setVisible(False)
        self.emission_table.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        vbox_emission.addWidget(self.emission_table)
        self.update_emission()
        vbox_emission.addStretch(-1)
        hbox_pairing.addLayout(vbox_emission)

        vbox_label = QtWidgets.QVBoxLayout()
        hbox_update = QtWidgets.QHBoxLayout()
        update_button = QtWidgets.QPushButton("Update")
        hbox_update.addWidget(update_button)
        update_button.clicked.connect(self.update_tables)
        hbox_update.addStretch(-1)
        vbox_label.addLayout(hbox_update)
        hbox_label = QtWidgets.QHBoxLayout()
        hbox_label.addWidget(QtWidgets.QLabel("Film ID", self))
        self.film_id_edit = QtWidgets.QLineEdit('', self)
        self.film_id_edit.setFixedWidth(100)
        hbox_label.addWidget(self.film_id_edit)
        hbox_label.addStretch(-1)
        vbox_label.addLayout(hbox_label)
        hbox_no_emission = QtWidgets.QHBoxLayout()
        hbox_no_emission.addWidget(QtWidgets.QLabel("No Emission", self))
        self.no_emission_cbox = QtWidgets.QCheckBox()
        hbox_no_emission.addWidget(self.no_emission_cbox)
        hbox_no_emission.addStretch(-1)
        vbox_label.addLayout(hbox_no_emission)
        hbox_process = QtWidgets.QHBoxLayout()
        process_button = QtWidgets.QPushButton("Process")
        hbox_process.addWidget(process_button)
        process_button.clicked.connect(self.process_spectra)
        hbox_process.addStretch(-1)
        vbox_label.addLayout(hbox_process)
        vbox_label.addStretch(-1)
        hbox_pairing.addLayout(vbox_label)
        hbox_pairing.addStretch(-1)
        vbox.addLayout(hbox_pairing)

        vbox.addWidget(Separator())
        self.fit_edit = QtWidgets.QTextEdit("", self)
        vbox.addWidget(self.fit_edit)
        vbox.addStretch(-1)

        hbox_back_next = QtWidgets.QHBoxLayout()
        back_button = QtWidgets.QPushButton("<< Previous")
        back_button.clicked.connect(lambda: self.Stack.setCurrentIndex(0))
        hbox_back_next.addWidget(back_button)
        hbox_back_next.addStretch(-1)
        vbox.addLayout(hbox_back_next)

        self.stack02_process.setLayout(vbox)
Example #10
0
    def __init__(self, parent=None):
        super(CellWidget, self).__init__(parent)

        self.save_dir = paths['last_save']

        vbox_total = QtWidgets.QVBoxLayout()
        vbox_total.addWidget(QtWidgets.QLabel("Parameters", self))
        grid_source = QtWidgets.QGridLayout()
        grid_source.addWidget(QtWidgets.QLabel("Start (V)", self), 0, 0)
        self.start_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][0], self)
        self.start_edit.setFixedWidth(60)
        self.start_edit.textChanged.connect(self.update_steps)
        grid_source.addWidget(self.start_edit, 0, 1)
        grid_source.addWidget(QtWidgets.QLabel("End (V)", self), 1, 0)
        self.end_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][1], self)
        self.end_edit.setFixedWidth(60)
        self.end_edit.textChanged.connect(self.update_steps)
        grid_source.addWidget(self.end_edit, 1, 1)
        grid_source.addWidget(QtWidgets.QLabel("Step (V)", self), 0, 2)
        self.step_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][2], self)
        self.step_edit.setFixedWidth(60)
        self.step_edit.setDisabled(True)
        grid_source.addWidget(self.step_edit, 0, 3)
        grid_source.addWidget(QtWidgets.QLabel("# Steps", self), 1, 2)
        self.nstep_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][3], self)
        self.nstep_edit.setFixedWidth(60)
        self.nstep_edit.textChanged.connect(self.update_steps)
        grid_source.addWidget(self.nstep_edit, 1, 3)
        grid_source.addWidget(QtWidgets.QLabel("I Limit (A)", self), 0, 4)
        self.ilimit_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][4],
                                               self)
        self.ilimit_edit.setFixedWidth(60)
        grid_source.addWidget(self.ilimit_edit, 0, 5)
        grid_source.addWidget(QtWidgets.QLabel("V Protection (V)", self), 1, 4)
        self.vprot_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][5], self)
        self.vprot_edit.setFixedWidth(60)
        grid_source.addWidget(self.vprot_edit, 1, 5)

        grid_source.addWidget(QtWidgets.QLabel("Averages", self), 2, 0)
        self.averages_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][6],
                                                 self)
        self.averages_edit.setFixedWidth(60)
        grid_source.addWidget(self.averages_edit, 2, 1)
        grid_source.addWidget(QtWidgets.QLabel("Trigger Delay (s)", self), 3,
                              0)
        self.trigger_delay_edit = QtWidgets.QLineEdit(
            '%s' % defaults['cell'][7], self)
        self.trigger_delay_edit.setFixedWidth(60)
        grid_source.addWidget(self.trigger_delay_edit, 3, 1)
        grid_source.addWidget(QtWidgets.QLabel("Traces", self), 2, 2)
        self.traces_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][8],
                                               self)
        self.traces_edit.setFixedWidth(60)
        grid_source.addWidget(self.traces_edit, 2, 3)
        grid_source.addWidget(QtWidgets.QLabel("Trace Pause (s)", self), 3, 2)
        self.trace_pause_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][9],
                                                    self)
        self.trace_pause_edit.setFixedWidth(60)
        grid_source.addWidget(self.trace_pause_edit, 3, 3)
        grid_source.addWidget(QtWidgets.QLabel("Cycles", self), 2, 4)
        self.cycles_edit = QtWidgets.QLineEdit('%s' % defaults['cell'][10],
                                               self)
        self.cycles_edit.setFixedWidth(60)
        grid_source.addWidget(self.cycles_edit, 2, 5)
        grid_source.addWidget(QtWidgets.QLabel("Cycle Pause (min)", self), 3,
                              4)
        self.cycle_pause_edit = QtWidgets.QLineEdit(
            '%s' % defaults['cell'][11], self)
        self.cycle_pause_edit.setFixedWidth(60)
        grid_source.addWidget(self.cycle_pause_edit, 3, 5)
        vbox_total.addLayout(grid_source)

        hbox_terminals = QtWidgets.QHBoxLayout()
        grid_terminals = QtWidgets.QGridLayout()
        meas2w_label = QtWidgets.QLabel("2 Wire Sensing", self)
        meas2w_label.setAlignment(QtCore.Qt.AlignRight)
        grid_terminals.addWidget(meas2w_label, 0, 0)
        self.remote_sense_btn = Switch()
        self.remote_sense_btn.setChecked(defaults['cell'][12])
        grid_terminals.addWidget(self.remote_sense_btn, 0, 1)
        grid_terminals.addWidget(QtWidgets.QLabel("4 Wire Sensing", self), 0,
                                 2)
        front_label = QtWidgets.QLabel("Front Terminals", self)
        front_label.setAlignment(QtCore.Qt.AlignRight)
        grid_terminals.addWidget(front_label, 1, 0)
        self.rear_terminal_btn = Switch()
        self.rear_terminal_btn.setChecked(defaults['cell'][13])
        grid_terminals.addWidget(self.rear_terminal_btn, 1, 1)
        grid_terminals.addWidget(QtWidgets.QLabel("Rear Terminals", self), 1,
                                 2)
        hbox_terminals.addLayout(grid_terminals)
        hbox_terminals.addStretch(-1)
        vbox_total.addLayout(hbox_terminals)

        hbox_port = QtWidgets.QHBoxLayout()
        hbox_port.addWidget(QtWidgets.QLabel("GPIB Port", self))
        self.source_cb = QtWidgets.QComboBox()
        self.source_cb.setFixedWidth(160)
        self.get_gpib_ports()
        self.source_cb.currentTextChanged.connect(self.source_port_changed)
        hbox_port.addWidget(self.source_cb)
        self.refresh_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'refresh.png')), '')
        self.refresh_button.clicked.connect(self.get_gpib_ports)
        self.refresh_button.setToolTip('Update Port')
        hbox_port.addWidget(self.refresh_button)
        hbox_port.addStretch(-1)
        vbox_total.addLayout(hbox_port)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Save", self))
        hbox_folder = QtWidgets.QHBoxLayout()
        self.folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        self.folder_button.clicked.connect(self.folder_dialog)
        self.folder_button.setToolTip('Choose folder')
        hbox_folder.addWidget(self.folder_button)
        self.folder_edit = QtWidgets.QLineEdit(self.save_dir, self)
        self.folder_edit.setMinimumWidth(180)
        self.folder_edit.setDisabled(True)
        hbox_folder.addWidget(self.folder_edit)
        self.clipboard_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'clipboard.png')), '')
        self.clipboard_button.setToolTip('Save plot to clipboard')
        hbox_folder.addWidget(self.clipboard_button)
        vbox_total.addLayout(hbox_folder)
        hbox_skip_save = QtWidgets.QHBoxLayout()
        self.skip_save_cb = QtWidgets.QCheckBox("Skip save for infinite run")
        self.skip_save_cb.setChecked(defaults['cell'][14])
        hbox_skip_save.addWidget(self.skip_save_cb)
        vbox_total.addLayout(hbox_skip_save)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Readout", self))
        hbox_readout = QtWidgets.QHBoxLayout()
        hbox_readout.addWidget(QtWidgets.QLabel("Isc (mA)", self))
        self.show_isc_edit = QtWidgets.QLineEdit('-1', self)
        self.show_isc_edit.setFixedWidth(60)
        self.show_isc_edit.setDisabled(True)
        hbox_readout.addWidget(self.show_isc_edit)
        hbox_readout.addWidget(QtWidgets.QLabel("Voc (mV)", self))
        self.show_voc_edit = QtWidgets.QLineEdit('-1', self)
        self.show_voc_edit.setFixedWidth(60)
        self.show_voc_edit.setDisabled(True)
        hbox_readout.addWidget(self.show_voc_edit)
        hbox_readout.addWidget(QtWidgets.QLabel("Pmax (mW)", self))
        self.show_pmax_edit = QtWidgets.QLineEdit('-1', self)
        self.show_pmax_edit.setFixedWidth(60)
        self.show_pmax_edit.setDisabled(True)
        hbox_readout.addWidget(self.show_pmax_edit)
        hbox_readout.addStretch(-1)
        vbox_total.addLayout(hbox_readout)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Measure", self))
        hbox_measure = QtWidgets.QHBoxLayout()
        self.run_cont_button = QtWidgets.QPushButton("Run \u221e")
        self.run_cont_button.setCheckable(True)
        self.run_cont_button.setStyleSheet(
            "QPushButton:checked { background-color: #32cd32 }")
        self.run_cont_button.setToolTip("Run Continuously")
        hbox_measure.addWidget(self.run_cont_button)
        self.run_fixed_button = QtWidgets.QPushButton("Run Fixed")
        self.run_fixed_button.setCheckable(True)
        self.run_fixed_button.setStyleSheet(
            "QPushButton:checked { background-color: #32cd32 }")
        self.run_fixed_button.setToolTip('Run fixed set')
        hbox_measure.addWidget(self.run_fixed_button)
        self.run_isc_button = QtWidgets.QPushButton("Run Isc")
        self.run_isc_button.setCheckable(True)
        self.run_isc_button.setStyleSheet(
            "QPushButton:checked { background-color: #32cd32 }")
        self.run_isc_button.setToolTip('Record Isc')
        hbox_measure.addWidget(self.run_isc_button)
        hbox_measure.addStretch(-1)
        vbox_total.addLayout(hbox_measure)
        vbox_total.addStretch(-1)
        self.setLayout(vbox_total)
Example #11
0
    def stack01_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(QtWidgets.QLabel("1. Import raw data: specify the root folder for the experiment series.", self))
        hbox_import = QtWidgets.QHBoxLayout()
        hbox_import.addWidget(QtWidgets.QLabel("Folder", self))
        folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        folder_button.clicked.connect(lambda: self.folder_dialog(path='last_import'))
        folder_button.setToolTip('Choose data folder')
        hbox_import.addWidget(folder_button)
        self.folder_edit = QtWidgets.QLineEdit(paths['last_import'], self)
        self.folder_edit.setMinimumWidth(180)
        self.folder_edit.setDisabled(True)
        hbox_import.addWidget(self.folder_edit)
        hbox_import.addStretch(-1)
        vbox.addLayout(hbox_import)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("2. Define output folder for results.", self))
        hbox_export = QtWidgets.QHBoxLayout()
        hbox_export.addWidget(QtWidgets.QLabel("Folder", self))
        save_folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        save_folder_button.clicked.connect(lambda: self.folder_dialog(path='last_export'))
        save_folder_button.setToolTip('Choose output folder')
        hbox_export.addWidget(save_folder_button)
        self.save_folder_edit = QtWidgets.QLineEdit(paths['last_export'], self)
        self.save_folder_edit.setMinimumWidth(180)
        self.save_folder_edit.setDisabled(True)
        hbox_export.addWidget(self.save_folder_edit)
        hbox_export.addStretch(-1)
        vbox.addLayout(hbox_export)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("3. Load the IV data into the data frame and generate a summary Excel sheet.",
                                        self))
        hbox_load = QtWidgets.QHBoxLayout()
        load_button = QtWidgets.QPushButton("Load Data")
        hbox_load.addWidget(load_button)
        hbox_load.addWidget(QtWidgets.QLabel("Overwrite Summary", self))
        overwrite_cbox = QtWidgets.QCheckBox()
        overwrite_cbox.setChecked(defaults['process_pv'][0])
        hbox_load.addWidget(overwrite_cbox)
        load_button.clicked.connect(lambda: self.load_data(path=paths['last_import'],
                                                           overwrite=overwrite_cbox.isChecked()))
        hbox_load.addStretch(-1)
        vbox.addLayout(hbox_load)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("4. Specify experiment numbers to be excluded from analysis.\n"
                                        "Separate experiments with commas.", self))
        hbox_drop = QtWidgets.QHBoxLayout()
        hbox_drop.addWidget(QtWidgets.QLabel("Experiment No", self))
        drop_id_edit = QtWidgets.QLineEdit('', self)
        drop_id_edit.setFixedWidth(100)
        hbox_drop.addWidget(drop_id_edit)
        exclude_button = QtWidgets.QPushButton("Exclude")
        exclude_button.clicked.connect(lambda: self.exclude_data(drop_id_edit.text()))
        hbox_drop.addWidget(exclude_button)
        hbox_drop.addStretch(-1)
        vbox.addLayout(hbox_drop)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("5. Specify experiment ID range to be included in analysis.", self))
        hbox_range = QtWidgets.QHBoxLayout()
        hbox_range.addWidget(QtWidgets.QLabel("Min", self))
        min_id_edit = QtWidgets.QLineEdit('1', self)
        min_id_edit.setFixedWidth(40)
        hbox_range.addWidget(min_id_edit)
        max_id_edit = QtWidgets.QLineEdit('999', self)
        max_id_edit.setFixedWidth(40)
        hbox_range.addWidget(max_id_edit)
        range_button = QtWidgets.QPushButton("Select Range")
        range_button.clicked.connect(lambda: self.select_range(int(min_id_edit.text()), int(max_id_edit.text())))
        hbox_range.addWidget(range_button)
        hbox_range.addStretch(-1)
        vbox.addLayout(hbox_range)

        vbox.addWidget(Separator())
        self.load_edit = QtWidgets.QTextEdit("", self)
        vbox.addWidget(self.load_edit)

        hbox_back_next = QtWidgets.QHBoxLayout()
        hbox_back_next.addStretch(-1)
        forward_button = QtWidgets.QPushButton("Next >>")
        forward_button.clicked.connect(lambda: self.Stack.setCurrentIndex(1))
        hbox_back_next.addWidget(forward_button)
        vbox.addLayout(hbox_back_next)

        self.stack01_import.setLayout(vbox)
Example #12
0
    def stack05_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(QtWidgets.QLabel("12. Average by experiment name or film ID. Combines repeat measurements of "
                                        "the same film into one datapoint.\n"
                                        "If measurements with the same film ID but different names are not to be "
                                        "combined, select \'name\'.", self))
        hbox_avg_film = QtWidgets.QHBoxLayout()
        hbox_avg_film.addWidget(QtWidgets.QLabel("Average by", self))
        avg_by_combobox = QtWidgets.QComboBox(self)
        avg_by_combobox.addItem("name")
        avg_by_combobox.addItem("film_id")
        hbox_avg_film.addWidget(avg_by_combobox)
        avg_exp_button = QtWidgets.QPushButton("Average Film")
        hbox_avg_film.addWidget(avg_exp_button)
        hbox_avg_film.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_avg_film_cbox = QtWidgets.QCheckBox()
        overwrite_avg_film_cbox.setChecked(defaults['process_pv'][8])
        hbox_avg_film.addWidget(overwrite_avg_film_cbox)
        avg_exp_button.clicked.connect(lambda: self.avg_film_data(col_name=avg_by_combobox.currentText(),
                                                                  overwrite=overwrite_avg_film_cbox.isChecked()))
        hbox_avg_film.addStretch(-1)
        vbox.addLayout(hbox_avg_film)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("13. Calculate change in Pmax/PCE compared to the baseline or another "
                                        "specified reference film.", self))
        hbox_efficiency = QtWidgets.QHBoxLayout()
        hbox_efficiency.addWidget(QtWidgets.QLabel("Baseline name", self))
        baseline_edit = QtWidgets.QLineEdit(defaults['process_pv'][9], self)
        baseline_edit.setFixedWidth(100)
        hbox_efficiency.addWidget(baseline_edit)
        efficiency_button = QtWidgets.QPushButton("Calculate")
        hbox_efficiency.addWidget(efficiency_button)
        hbox_efficiency.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_eff_cbox = QtWidgets.QCheckBox()
        overwrite_eff_cbox.setChecked(defaults['process_pv'][10])
        hbox_efficiency.addWidget(overwrite_eff_cbox)
        efficiency_button.clicked.connect(lambda: self.efficiency_data(name=baseline_edit.text(),
                                                                       overwrite=overwrite_eff_cbox.isChecked()))
        hbox_efficiency.addStretch(-1)
        vbox.addLayout(hbox_efficiency)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("14. Merge processed data with film information. Specify the location of the "
                                        "film database, then merge by ID.", self))
        hbox_import = QtWidgets.QHBoxLayout()
        hbox_import.addWidget(QtWidgets.QLabel("Film DB", self))
        folder_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'folder.png')), '')
        folder_button.clicked.connect(self.file_dialog)
        folder_button.setToolTip('Choose film database')
        hbox_import.addWidget(folder_button)
        self.film_path_edit = QtWidgets.QLineEdit(paths['film_db'], self)
        self.film_path_edit.setMinimumWidth(180)
        self.film_path_edit.setDisabled(True)
        hbox_import.addWidget(self.film_path_edit)
        merge_button = QtWidgets.QPushButton("Merge")
        hbox_import.addWidget(merge_button)
        hbox_import.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_merge_cbox = QtWidgets.QCheckBox()
        overwrite_merge_cbox.setChecked(defaults['process_pv'][11])
        hbox_import.addWidget(overwrite_merge_cbox)
        merge_button.clicked.connect(lambda: self.merge_film_data(overwrite=overwrite_merge_cbox.isChecked()))
        hbox_import.addStretch(-1)
        vbox.addLayout(hbox_import)
        vbox.addStretch(-1)

        hbox_back_next = QtWidgets.QHBoxLayout()
        back_button = QtWidgets.QPushButton("<< Previous")
        back_button.clicked.connect(lambda: self.Stack.setCurrentIndex(3))
        hbox_back_next.addWidget(back_button)
        hbox_back_next.addStretch(-1)
        vbox.addLayout(hbox_back_next)

        self.stack05_film.setLayout(vbox)
Example #13
0
    def stack03_ui(self):
        vbox = QtWidgets.QVBoxLayout()
        vbox.addWidget(QtWidgets.QLabel("8. Attempt irradiance fit.", self))
        hbox_show_irrad = QtWidgets.QHBoxLayout()
        hbox_show_irrad.addWidget(QtWidgets.QLabel("Baseline name", self))
        baseline_edit = QtWidgets.QLineEdit(defaults['process_pv'][1], self)
        baseline_edit.setFixedWidth(100)
        hbox_show_irrad.addWidget(baseline_edit)
        hbox_show_irrad.addWidget(QtWidgets.QLabel("Diode #", self))
        diode_edit = QtWidgets.QLineEdit(str(defaults['process_pv'][3]), self)
        diode_edit.setFixedWidth(40)
        hbox_show_irrad.addWidget(diode_edit)
        show_button = QtWidgets.QPushButton("Show")
        show_button.clicked.connect(lambda: self.show_irrad_data(baseline_edit.text(), diode_edit.text()))
        hbox_show_irrad.addWidget(show_button)
        hbox_show_irrad.addStretch(-1)
        vbox.addLayout(hbox_show_irrad)

        vbox.addWidget(Separator())
        hbox_plot = QtWidgets.QHBoxLayout()
        self.irrad_canvas = FigureCanvas(Figure(figsize=(12, 5)))
        self.irrad_canvas.figure.tight_layout(pad=0.3)
        self.update_irrad.connect(self.irrad_canvas.figure.canvas.draw)
        hbox_plot.addWidget(self.irrad_canvas)
        hbox_plot.addStretch(-1)
        vbox.addLayout(hbox_plot)

        hbox_fit_pars = QtWidgets.QHBoxLayout()
        hbox_fit_pars.addWidget(QtWidgets.QLabel("Isc = ", self))
        self.isc_edit = QtWidgets.QLineEdit("", self)
        self.isc_edit.setFixedWidth(200)
        self.isc_edit.setDisabled(True)
        hbox_fit_pars.addWidget(self.isc_edit)
        hbox_fit_pars.addWidget(QtWidgets.QLabel("Voc = ", self))
        self.voc_edit = QtWidgets.QLineEdit("", self)
        self.voc_edit.setFixedWidth(200)
        self.voc_edit.setDisabled(True)
        hbox_fit_pars.addWidget(self.voc_edit)
        hbox_fit_pars.addWidget(QtWidgets.QLabel("Pmax = ", self))
        self.pmax_edit = QtWidgets.QLineEdit("", self)
        self.pmax_edit.setFixedWidth(200)
        self.pmax_edit.setDisabled(True)
        hbox_fit_pars.addWidget(self.pmax_edit)
        hbox_fit_pars.addStretch(-1)
        vbox.addLayout(hbox_fit_pars)

        vbox.addWidget(Separator())
        vbox.addWidget(QtWidgets.QLabel("9. Apply irradiance correction if the data looks sensible.\n"
                                        "Irradiance and Isc/Pmax are roughly linearly proportional, high irradiance "
                                        "corresponding to high Isc/Pmax.\n"
                                        "If there are big jumps in the data, try another photodiode or skip this "
                                        "correction step.\n"
                                        "Individual experiment IDs can also be excluded in step 3 (repeat from"
                                        "the start).", self))
        hbox_apply_irrad = QtWidgets.QHBoxLayout()
        hbox_apply_irrad.addWidget(QtWidgets.QLabel("Diode #", self))
        diode_at_1sun = QtWidgets.QLineEdit(str(defaults['process_pv'][4]), self)
        diode_at_1sun.setFixedWidth(60)
        hbox_apply_irrad.addWidget(diode_at_1sun)
        irrad_corr_button = QtWidgets.QPushButton("Correct to 1 sun")
        hbox_apply_irrad.addWidget(irrad_corr_button)
        hbox_apply_irrad.addWidget(QtWidgets.QLabel("Overwrite Existing", self))
        overwrite_cbox = QtWidgets.QCheckBox()
        overwrite_cbox.setChecked(defaults['process_pv'][5])
        hbox_apply_irrad.addWidget(overwrite_cbox)
        irrad_corr_button.clicked.connect(lambda: self.apply_irrad_corr(channel=diode_edit.text(),
                                                                        one_sun=diode_at_1sun.text(),
                                                                        overwrite=overwrite_cbox.isChecked()))
        hbox_apply_irrad.addStretch(-1)
        vbox.addLayout(hbox_apply_irrad)
        vbox.addStretch(-1)

        hbox_back_next = QtWidgets.QHBoxLayout()
        back_button = QtWidgets.QPushButton("<< Previous")
        back_button.clicked.connect(lambda: self.Stack.setCurrentIndex(1))
        hbox_back_next.addWidget(back_button)
        hbox_back_next.addStretch(-1)
        forward_button = QtWidgets.QPushButton("Next >>")
        forward_button.clicked.connect(lambda: self.Stack.setCurrentIndex(3))
        hbox_back_next.addWidget(forward_button)
        vbox.addLayout(hbox_back_next)

        self.stack03_irradiance.setLayout(vbox)
Example #14
0
    def __init__(self, parent=None):
        super(InfoWidget, self).__init__(parent)

        vbox_total = QtWidgets.QVBoxLayout()
        vbox_total.addWidget(QtWidgets.QLabel("Experiment", self))
        grid_experiment = QtWidgets.QGridLayout()
        grid_experiment.addWidget(QtWidgets.QLabel('Name', self), 0, 0)
        self.experiment_name_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][0], self)
        self.experiment_name_edit.setFixedWidth(80)
        grid_experiment.addWidget(self.experiment_name_edit, 0, 1)
        grid_experiment.addWidget(QtWidgets.QLabel('Date', self), 0, 2)
        self.experiment_date_edit = QtWidgets.QLineEdit(
            '%s' % datetime.date.today(), self)
        self.experiment_date_edit.setFixedWidth(80)
        grid_experiment.addWidget(self.experiment_date_edit, 0, 3)
        vbox_total.addLayout(grid_experiment)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Sample", self))
        grid_sample = QtWidgets.QGridLayout()
        grid_sample.addWidget(QtWidgets.QLabel('Film ID', self), 0, 0)
        self.film_id_edit = QtWidgets.QLineEdit('%s' % defaults['info'][2],
                                                self)
        self.film_id_edit.setFixedWidth(80)
        grid_sample.addWidget(self.film_id_edit, 0, 1)
        grid_sample.addWidget(QtWidgets.QLabel('PV Cell ID', self), 0, 2)
        self.pv_cell_id_edit = QtWidgets.QLineEdit('%s' % defaults['info'][3],
                                                   self)
        self.pv_cell_id_edit.setFixedWidth(80)
        grid_sample.addWidget(self.pv_cell_id_edit, 0, 3)
        grid_sample.addWidget(QtWidgets.QLabel('Ref. Cell Temperature', self),
                              1, 0)
        self.ref_temp_edit = QtWidgets.QLineEdit('%s' % defaults['info'][4],
                                                 self)
        self.ref_temp_edit.setFixedWidth(80)
        grid_sample.addWidget(self.ref_temp_edit, 1, 1)
        vbox_total.addLayout(grid_sample)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Setup", self))
        grid_setup = QtWidgets.QGridLayout()
        grid_setup.addWidget(QtWidgets.QLabel('Setup Location', self), 0, 0)
        self.setup_location_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][5], self)
        self.setup_location_edit.setFixedWidth(80)
        grid_setup.addWidget(self.setup_location_edit, 0, 1)
        grid_setup.addWidget(QtWidgets.QLabel('Calibration Date', self), 0, 2)
        self.setup_calibrated_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][6], self)
        self.setup_calibrated_edit.setFixedWidth(80)
        grid_setup.addWidget(self.setup_calibrated_edit, 0, 3)
        grid_setup.addWidget(QtWidgets.QLabel('Calibration (suns)', self), 1,
                             0)
        self.setup_suns_edit = QtWidgets.QLineEdit('%s' % defaults['info'][7],
                                                   self)
        self.setup_suns_edit.setFixedWidth(80)
        grid_setup.addWidget(self.setup_suns_edit, 1, 1)
        vbox_total.addLayout(grid_setup)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("PID Controller", self))
        grid_pid = QtWidgets.QGridLayout()
        grid_pid.addWidget(QtWidgets.QLabel('Proportional band (%)', self), 0,
                           0)
        self.pid_prob_band_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][8], self)
        self.pid_prob_band_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_prob_band_edit, 0, 1)
        grid_pid.addWidget(QtWidgets.QLabel('Integral time', self), 0, 2)
        self.pid_integral_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][9], self)
        self.pid_integral_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_integral_edit, 0, 3)
        grid_pid.addWidget(QtWidgets.QLabel('Derivative time', self), 1, 0)
        self.pid_derivative_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][10], self)
        self.pid_derivative_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_derivative_edit, 1, 1)
        grid_pid.addWidget(QtWidgets.QLabel('Fuzzy Overshoot', self), 1, 2)
        self.pid_fuoc_edit = QtWidgets.QLineEdit('%s' % defaults['info'][11],
                                                 self)
        self.pid_fuoc_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_fuoc_edit, 1, 3)
        grid_pid.addWidget(QtWidgets.QLabel('Heat Cycle TCR1', self), 2, 0)
        self.pid_tcr1_edit = QtWidgets.QLineEdit('%s' % defaults['info'][12],
                                                 self)
        self.pid_tcr1_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_tcr1_edit, 2, 1)
        grid_pid.addWidget(QtWidgets.QLabel('Cool Cycle TCR2', self), 2, 2)
        self.pid_tcr2_edit = QtWidgets.QLineEdit('%s' % defaults['info'][13],
                                                 self)
        self.pid_tcr2_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_tcr2_edit, 2, 3)
        grid_pid.addWidget(QtWidgets.QLabel('Setpoint (C)', self), 3, 0)
        self.pid_setpoint_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][14], self)
        self.pid_setpoint_edit.setFixedWidth(80)
        grid_pid.addWidget(self.pid_setpoint_edit, 3, 1)
        vbox_total.addLayout(grid_pid)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Environment", self))
        grid_environment = QtWidgets.QGridLayout()
        grid_environment.addWidget(
            QtWidgets.QLabel('Room Temperature (C)', self), 0, 0)
        self.room_temperature_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][15], self)
        self.room_temperature_edit.setFixedWidth(80)
        grid_environment.addWidget(self.room_temperature_edit, 0, 1)
        grid_environment.addWidget(QtWidgets.QLabel('Room Humidity', self), 0,
                                   2)
        self.room_humidity_edit = QtWidgets.QLineEdit(
            '%s' % defaults['info'][16], self)
        self.room_humidity_edit.setFixedWidth(80)
        grid_environment.addWidget(self.room_humidity_edit, 0, 3)
        vbox_total.addLayout(grid_environment)
        vbox_total.addStretch(-1)
        self.setLayout(vbox_total)
Example #15
0
    def __init__(self, parent=None):
        super(SensorWidget, self).__init__(parent)

        self.block_sensor = False

        vbox_total = QtWidgets.QVBoxLayout()
        vbox_total.addWidget(QtWidgets.QLabel("Parameters", self))
        grid_pars = QtWidgets.QGridLayout()
        grid_pars.addWidget(QtWidgets.QLabel("Time (s)", self), 0, 0)
        self.sensor_time_edit = QtWidgets.QLineEdit(
            '%s' % defaults['arduino'][5], self)
        self.sensor_time_edit.setFixedWidth(80)
        grid_pars.addWidget(self.sensor_time_edit, 0, 1)
        grid_pars.addWidget(QtWidgets.QLabel("# Data points", self), 0, 2)
        self.datapoints_edit = QtWidgets.QLineEdit(
            '%s' % defaults['arduino'][1], self)
        self.datapoints_edit.setFixedWidth(80)
        grid_pars.addWidget(self.datapoints_edit, 0, 3)
        grid_pars.addWidget(QtWidgets.QLabel("Query delay (s)", self), 0, 4)
        self.query_edit = QtWidgets.QLineEdit('%s' % defaults['arduino'][4],
                                              self)
        self.query_edit.setFixedWidth(80)
        grid_pars.addWidget(self.query_edit, 0, 5)
        grid_pars.addWidget(QtWidgets.QLabel("Supply Voltage (V)", self), 1, 0)
        self.supply_voltage_edit = QtWidgets.QLineEdit(
            '%s' % defaults['arduino'][6], self)
        self.supply_voltage_edit.setFixedWidth(80)
        grid_pars.addWidget(self.supply_voltage_edit, 1, 1)
        vbox_total.addLayout(grid_pars)

        hbox_port = QtWidgets.QHBoxLayout()
        hbox_port.addWidget(QtWidgets.QLabel("COM Port", self))
        self.sensor_cb = QtWidgets.QComboBox()
        self.sensor_cb.setFixedWidth(90)
        self.sensor_cb.addItem('dummy')
        for port in serial_ports.get_serial_ports():
            self.sensor_cb.addItem(port)
            if port == ports['arduino']:
                self.sensor_cb.setCurrentText(port)
        self.sensor_cb.currentTextChanged.connect(self.sensor_port_changed)
        hbox_port.addWidget(self.sensor_cb)
        self.refresh_button = QtWidgets.QPushButton(
            QtGui.QIcon(os.path.join(paths['icons'], 'refresh.png')), '')
        self.refresh_button.clicked.connect(self.update_port)
        self.refresh_button.setToolTip('Update Port')
        hbox_port.addWidget(self.refresh_button)
        hbox_port.addStretch(-1)
        vbox_total.addLayout(hbox_port)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Readout", self))
        grid_sensors = QtWidgets.QGridLayout()
        grid_sensors.addWidget(QtWidgets.QLabel("Temperature (C)", self), 0, 0)
        self.temperature_edit = QtWidgets.QLineEdit('25', self)
        self.temperature_edit.setFixedWidth(60)
        self.temperature_edit.setDisabled(True)
        grid_sensors.addWidget(self.temperature_edit, 0, 1)
        grid_sensors.addWidget(QtWidgets.QLabel("Diode 1 (W/m2)", self), 0, 2)
        self.diode1_edit = QtWidgets.QLineEdit('0', self)
        self.diode1_edit.setFixedWidth(60)
        self.diode1_edit.setDisabled(True)
        grid_sensors.addWidget(self.diode1_edit, 0, 3)
        grid_sensors.addWidget(QtWidgets.QLabel("Diode 2 (W/m2)", self), 1, 0)
        self.diode2_edit = QtWidgets.QLineEdit('0', self)
        self.diode2_edit.setFixedWidth(60)
        self.diode2_edit.setDisabled(True)
        grid_sensors.addWidget(self.diode2_edit, 1, 1)
        grid_sensors.addWidget(QtWidgets.QLabel("Diode 3 (W/m2)", self), 1, 2)
        self.diode3_edit = QtWidgets.QLineEdit('0', self)
        self.diode3_edit.setFixedWidth(60)
        self.diode3_edit.setDisabled(True)
        grid_sensors.addWidget(self.diode3_edit, 1, 3)
        vbox_total.addLayout(grid_sensors)

        vbox_total.addWidget(Separator())
        vbox_total.addWidget(QtWidgets.QLabel("Measure", self))
        hbox_measure = QtWidgets.QHBoxLayout()
        self.run_cont_button = QtWidgets.QPushButton("Run \u221e")
        self.run_cont_button.setCheckable(True)
        self.run_cont_button.setStyleSheet(
            "QPushButton:checked { background-color: #32cd32 }")
        self.run_cont_button.setToolTip('Continuous read')
        hbox_measure.addWidget(self.run_cont_button)
        self.run_fixed_button = QtWidgets.QPushButton("Run Fixed")
        self.run_fixed_button.setCheckable(True)
        self.run_fixed_button.setStyleSheet(
            "QPushButton:checked { background-color: #32cd32 }")
        self.run_fixed_button.setToolTip('Fix time read')
        hbox_measure.addWidget(self.run_fixed_button)
        hbox_measure.addStretch(-1)
        vbox_total.addLayout(hbox_measure)
        vbox_total.addStretch(-1)
        self.setLayout(vbox_total)