def build_scatterSelect_Widget(self): self.layout_scatterSelect = QVBoxLayout() self.layout_scatterSelect_Btn = QHBoxLayout() # Cancel push button for closing the window and terminating the process self.pushBtn_scatterSelect_cancel = QPushButton("Cancel") lib.setFont(self.pushBtn_scatterSelect_cancel) self.pushBtn_scatterSelect_ok = QPushButton("OK") lib.setFont(self.pushBtn_scatterSelect_ok) self.layout_scatterSelect_Btn.addWidget( self.pushBtn_scatterSelect_cancel) self.layout_scatterSelect_Btn.addWidget(self.pushBtn_scatterSelect_ok) # Housekeeping items self.line_scatterPlot_popup_h0 = QtWidgets.QFrame() self.line_scatterPlot_popup_h0.setFrameShape(QFrame.HLine) self.line_scatterPlot_popup_h0.setFrameShadow(QFrame.Sunken) # plot self.plot_scatterSelect_mainPlot = pg.PlotWidget() lib.set_plotWidget(self.plot_scatterSelect_mainPlot) # add widgets to the layout self.layout_scatterSelect.addLayout(self.layout_scatterSelect_Btn) self.layout_scatterSelect.addWidget(self.line_scatterPlot_popup_h0) self.layout_scatterSelect.addWidget(self.plot_scatterSelect_mainPlot) self.layout_scatterSelect.setSpacing(1) self.layout_scatterSelect.setContentsMargins(1, 1, 1, 1) self.setLayout(self.layout_scatterSelect) return 0
def build_mainwin_CsPanel(self): self.layout_mainwin_CsPanel_plots = QGridLayout() self.layout_mainwin_CsPanel_buttons = QHBoxLayout() self.layout_mainwin_CsPanel_plots_CsWaveBtn = QHBoxLayout() self.layout_mainwin_CsPanel_plots_CsPcaBtn = QHBoxLayout() self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_waveDissect = QPushButton( "Dissect") lib.setFont(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_waveDissect, color="red") self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_selectWave = QPushButton( "Select") lib.setFont(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_selectWave, color="red") self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_learnWaveform = QPushButton( "Learn Template") lib.setFont(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_learnWaveform, color="red") self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_learnWaveform.setCheckable( True) self.layout_mainwin_CsPanel_plots_CsWaveBtn.\ addWidget(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_waveDissect) self.layout_mainwin_CsPanel_plots_CsWaveBtn.\ addWidget(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_selectWave) self.layout_mainwin_CsPanel_plots_CsWaveBtn.\ addWidget(self.pushBtn_mainwin_CsPanel_plots_CsWaveBtn_learnWaveform) self.layout_mainwin_CsPanel_plots_CsWaveBtn.setSpacing(1) self.layout_mainwin_CsPanel_plots_CsWaveBtn.setContentsMargins( 1, 1, 1, 1) self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_waveClust = QPushButton( "Cluster") lib.setFont(self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_waveClust, color="red") self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_selectPcaData = QPushButton( "Select") lib.setFont(self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_selectPcaData, color="red") self.comboBx_mainwin_CsPanel_plots_CsPcaBtn_selectPcaCombo = QComboBox( ) self.comboBx_mainwin_CsPanel_plots_CsPcaBtn_selectPcaCombo.addItems( ["Manual", "GMM-2D"]) self.comboBx_mainwin_CsPanel_plots_CsPcaBtn_selectPcaCombo.setCurrentIndex( 0) lib.setFont(self.comboBx_mainwin_CsPanel_plots_CsPcaBtn_selectPcaCombo, color="red") self.layout_mainwin_CsPanel_plots_CsPcaBtn.\ addWidget(self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_waveClust) self.layout_mainwin_CsPanel_plots_CsPcaBtn.\ addWidget(self.pushBtn_mainwin_CsPanel_plots_CsPcaBtn_selectPcaData) self.layout_mainwin_CsPanel_plots_CsPcaBtn.\ addWidget(self.comboBx_mainwin_CsPanel_plots_CsPcaBtn_selectPcaCombo) self.layout_mainwin_CsPanel_plots_CsPcaBtn.setSpacing(1) self.layout_mainwin_CsPanel_plots_CsPcaBtn.setContentsMargins( 1, 1, 1, 1) self.txtlabel_mainwin_CsPanel_plots_CsFiring = QLabel( "CS Firing: 0.00Hz") lib.setFont(self.txtlabel_mainwin_CsPanel_plots_CsFiring, color="red") self.txtlabel_mainwin_CsPanel_plots_CsFiring.\ setAlignment(QtCore.Qt.AlignCenter) self.plot_mainwin_CsPanel_plots_CsWave = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_CsPanel_plots_CsWave) self.plot_mainwin_CsPanel_plots_CsWave.setTitle( "Y: CS_Waveform(uV) | X: Time(ms)") self.plot_mainwin_CsPanel_plots_CsIfr = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_CsPanel_plots_CsIfr) self.plot_mainwin_CsPanel_plots_CsIfr.setTitle( "Y: CS_IFR(#) | X: Freq(Hz)") self.plot_mainwin_CsPanel_plots_CsPca = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_CsPanel_plots_CsPca) self.plot_mainwin_CsPanel_plots_CsPca.setTitle(None) self.plot_mainwin_CsPanel_plots_CsXProb = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_CsPanel_plots_CsXProb) self.plot_mainwin_CsPanel_plots_CsXProb.setTitle( "Y: CSxSS_XProb(1) | X: Time(ms)") self.layout_mainwin_CsPanel_plots_CsPcaPlot = QVBoxLayout() self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum = QHBoxLayout() self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum = QWidget() self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setAutoFillBackground( True) palette = self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.palette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(255, 255, 255, 255)) self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setPalette(palette) self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.\ setLayout(self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum) self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1 = QComboBox() self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1.addItems( ['pca1', 'pca2']) lib.setFont(self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1, color="red") self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1.setCurrentIndex(0) self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2 = QComboBox() self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2.addItems( ['pca1', 'pca2']) lib.setFont(self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2, color="red") self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2.setCurrentIndex(1) self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1 = QLabel( "| X: CS_ ") lib.setFont(self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1, color="red") self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2 = QLabel( " Y: CS_ ") lib.setFont(self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2, color="red") self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.\ addWidget(self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.\ addWidget(self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum2) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.\ addWidget(self.txtlabel_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.\ addWidget(self.comboBx_mainwin_CsPanel_plots_CsPcaPlot_PcaNum1) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setStretch(0, 0) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setStretch(1, 1) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setStretch(2, 0) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setStretch(3, 1) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setSpacing(1) self.layout_mainwin_CsPanel_plots_CsPcaPlot_PcaNum.setContentsMargins( 1, 1, 1, 1) self.layout_mainwin_CsPanel_plots_CsPcaPlot.\ addWidget(self.widget_mainwin_CsPanel_plots_CsPcaPlot_PcaNum) self.layout_mainwin_CsPanel_plots_CsPcaPlot.\ addWidget(self.plot_mainwin_CsPanel_plots_CsPca) self.layout_mainwin_CsPanel_plots_CsPcaPlot.setSpacing(1) self.layout_mainwin_CsPanel_plots_CsPcaPlot.setContentsMargins( 1, 1, 1, 1) self.layout_mainwin_CsPanel_plots.\ addLayout(self.layout_mainwin_CsPanel_plots_CsWaveBtn, 0, 0) self.layout_mainwin_CsPanel_plots.\ addWidget(self.txtlabel_mainwin_CsPanel_plots_CsFiring, 0, 1) self.layout_mainwin_CsPanel_plots.\ addWidget(self.plot_mainwin_CsPanel_plots_CsWave, 1, 0) self.layout_mainwin_CsPanel_plots.\ addWidget(self.plot_mainwin_CsPanel_plots_CsIfr, 1, 1) self.layout_mainwin_CsPanel_plots.\ addLayout(self.layout_mainwin_CsPanel_plots_CsPcaBtn, 2, 0) self.layout_mainwin_CsPanel_plots.\ addLayout(self.layout_mainwin_CsPanel_plots_CsPcaPlot, 3, 0) self.layout_mainwin_CsPanel_plots.\ addWidget(self.plot_mainwin_CsPanel_plots_CsXProb, 3, 1) self.layout_mainwin_CsPanel_plots.setRowStretch(0, 0) self.layout_mainwin_CsPanel_plots.setRowStretch(1, 1) self.layout_mainwin_CsPanel_plots.setRowStretch(2, 0) self.layout_mainwin_CsPanel_plots.setRowStretch(3, 1) self.layout_mainwin_CsPanel_plots.setSpacing(1) self.layout_mainwin_CsPanel_plots.setContentsMargins(1, 1, 1, 1) self.pushBtn_mainwin_CsPanel_buttons_CsDelete = QPushButton("Delete") lib.setFont(self.pushBtn_mainwin_CsPanel_buttons_CsDelete, color="red") self.pushBtn_mainwin_CsPanel_buttons_CsDelete.\ setIcon(QtGui.QIcon(os.path.join(lib.PROJECT_FOLDER, 'icons', '067-trash-red.png'))) self.pushBtn_mainwin_CsPanel_buttons_CsKeep = QPushButton("Keep") lib.setFont(self.pushBtn_mainwin_CsPanel_buttons_CsKeep, color="red") self.pushBtn_mainwin_CsPanel_buttons_CsKeep.\ setIcon(QtGui.QIcon(os.path.join(lib.PROJECT_FOLDER, 'icons', '023-download-red.png'))) self.pushBtn_mainwin_CsPanel_buttons_CsMoveToSs = QPushButton( "Move to SS") lib.setFont(self.pushBtn_mainwin_CsPanel_buttons_CsMoveToSs, color="red") self.pushBtn_mainwin_CsPanel_buttons_CsMoveToSs.\ setIcon(QtGui.QIcon(os.path.join(lib.PROJECT_FOLDER, 'icons', '084-shuffle-left-red.png'))) self.pushBtn_mainwin_CsPanel_buttons_CsDeselect = QPushButton( "Unselect") lib.setFont(self.pushBtn_mainwin_CsPanel_buttons_CsDeselect, color="red") self.pushBtn_mainwin_CsPanel_buttons_CsDeselect.\ setIcon(QtGui.QIcon(os.path.join(lib.PROJECT_FOLDER, 'icons', '030-forbidden-red.png'))) self.layout_mainwin_CsPanel_buttons.\ addWidget(self.pushBtn_mainwin_CsPanel_buttons_CsDelete) self.layout_mainwin_CsPanel_buttons.\ addWidget(self.pushBtn_mainwin_CsPanel_buttons_CsKeep) self.layout_mainwin_CsPanel_buttons.\ addWidget(self.pushBtn_mainwin_CsPanel_buttons_CsMoveToSs) self.layout_mainwin_CsPanel_buttons.\ addWidget(self.pushBtn_mainwin_CsPanel_buttons_CsDeselect) self.layout_mainwin_CsPanel_buttons.setSpacing(1) self.layout_mainwin_CsPanel_buttons.setContentsMargins(1, 1, 1, 1) self.layout_mainwin_CsPanel.\ addLayout(self.layout_mainwin_CsPanel_plots) self.layout_mainwin_CsPanel.\ addLayout(self.layout_mainwin_CsPanel_buttons) self.layout_mainwin_CsPanel.setStretch(0, 1) self.layout_mainwin_CsPanel.setStretch(1, 0) self.layout_mainwin_CsPanel.setSpacing(1) self.layout_mainwin_CsPanel.setContentsMargins(1, 1, 1, 1) return 0
def build_mainwin_rawSignalPanel(self): self.layout_mainwin_rawSignalPanel_SsPeak = QVBoxLayout() self.layout_mainwin_rawSignalPanel_SsPeak_Thresh = QHBoxLayout() self.layout_mainwin_rawSignalPanel_CsPeak = QVBoxLayout() self.layout_mainwin_rawSignalPanel_CsPeak_Thresh = QHBoxLayout() # rawSignal plot self.plot_mainwin_rawSignalPanel_rawSignal = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_rawSignalPanel_rawSignal) self.plot_mainwin_rawSignalPanel_rawSignal.setTitle( "Y: Raw_Signal(uV) | X: Time(s)") # SsPeak Panel, containing SsHistogram and SsThresh self.widget_mainwin_rawSignalPanel_SsPeakPanel = QWidget() self.widget_mainwin_rawSignalPanel_SsPeakPanel.setAutoFillBackground( True) palette = self.widget_mainwin_rawSignalPanel_SsPeakPanel.palette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(0, 0, 255, 30)) self.widget_mainwin_rawSignalPanel_SsPeakPanel.setPalette(palette) self.widget_mainwin_rawSignalPanel_SsPeakPanel.\ setLayout(self.layout_mainwin_rawSignalPanel_SsPeak) self.plot_mainwin_rawSignalPanel_SsPeak = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_rawSignalPanel_SsPeak) self.plot_mainwin_rawSignalPanel_SsPeak.setTitle( "X: SS_Peak_Dist(uV) | Y: Count(#)") self.txtlabel_mainwin_rawSignalPanel_SsThresh = QLabel("SS Threshold") lib.setFont(self.txtlabel_mainwin_rawSignalPanel_SsThresh, color="blue") self.txtedit_mainwin_rawSignalPanel_SsThresh = QDoubleSpinBox() self.txtedit_mainwin_rawSignalPanel_SsThresh.setKeyboardTracking(True) self.txtedit_mainwin_rawSignalPanel_SsThresh.setMinimum(1.0) self.txtedit_mainwin_rawSignalPanel_SsThresh.setMaximum(15000.0) self.txtedit_mainwin_rawSignalPanel_SsThresh.setDecimals(0) lib.setFont(self.txtedit_mainwin_rawSignalPanel_SsThresh, color="blue") self.txtedit_mainwin_rawSignalPanel_SsThresh.setValue(300.0) self.line_mainwin_rawSignalPanel_SsL1 = QtGui.QFrame() self.line_mainwin_rawSignalPanel_SsL1.setFrameShape(QFrame.VLine) self.line_mainwin_rawSignalPanel_SsL1.setFrameShadow(QFrame.Sunken) self.line_mainwin_rawSignalPanel_SsL2 = QtGui.QFrame() self.line_mainwin_rawSignalPanel_SsL2.setFrameShape(QFrame.VLine) self.line_mainwin_rawSignalPanel_SsL2.setFrameShadow(QFrame.Sunken) self.pushBtn_mainwin_rawSignalPanel_SsAutoThresh = QPushButton("Auto") lib.setFont(self.pushBtn_mainwin_rawSignalPanel_SsAutoThresh, color="blue") self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addWidget(self.txtlabel_mainwin_rawSignalPanel_SsThresh) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addWidget(self.txtedit_mainwin_rawSignalPanel_SsThresh) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addWidget(self.line_mainwin_rawSignalPanel_SsL1) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addStretch() self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addWidget(self.line_mainwin_rawSignalPanel_SsL2) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.\ addWidget(self.pushBtn_mainwin_rawSignalPanel_SsAutoThresh) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.setSpacing(1) self.layout_mainwin_rawSignalPanel_SsPeak_Thresh.setContentsMargins( 1, 1, 1, 1) self.layout_mainwin_rawSignalPanel_SsPeak.\ addLayout(self.layout_mainwin_rawSignalPanel_SsPeak_Thresh) self.layout_mainwin_rawSignalPanel_SsPeak.\ addWidget(self.plot_mainwin_rawSignalPanel_SsPeak) self.layout_mainwin_rawSignalPanel_SsPeak.setStretch(0, 0) self.layout_mainwin_rawSignalPanel_SsPeak.setStretch(1, 1) self.layout_mainwin_rawSignalPanel_SsPeak.setSpacing(1) self.layout_mainwin_rawSignalPanel_SsPeak.setContentsMargins( 1, 1, 1, 1) # CsPeak Panel, containing CsHistogram and CsThresh self.widget_mainwin_rawSignalPanel_CsPeakPanel = QWidget() self.widget_mainwin_rawSignalPanel_CsPeakPanel.setAutoFillBackground( True) palette = self.widget_mainwin_rawSignalPanel_CsPeakPanel.palette() palette.setColor(QtGui.QPalette.Window, QtGui.QColor(255, 0, 0, 30)) self.widget_mainwin_rawSignalPanel_CsPeakPanel.setPalette(palette) self.widget_mainwin_rawSignalPanel_CsPeakPanel.\ setLayout(self.layout_mainwin_rawSignalPanel_CsPeak) self.plot_mainwin_rawSignalPanel_CsPeak = pg.PlotWidget() lib.set_plotWidget(self.plot_mainwin_rawSignalPanel_CsPeak) self.plot_mainwin_rawSignalPanel_CsPeak.setTitle( "X: CS_Peak_Dist(uV) | Y: Count(#)") self.txtlabel_mainwin_rawSignalPanel_CsThresh = QLabel("CS Threshold") lib.setFont(self.txtlabel_mainwin_rawSignalPanel_CsThresh, color="red") self.txtedit_mainwin_rawSignalPanel_CsThresh = QDoubleSpinBox() self.txtedit_mainwin_rawSignalPanel_CsThresh.setKeyboardTracking(True) self.txtedit_mainwin_rawSignalPanel_CsThresh.setMinimum(1.0) self.txtedit_mainwin_rawSignalPanel_CsThresh.setMaximum(15000.0) self.txtedit_mainwin_rawSignalPanel_CsThresh.setDecimals(0) lib.setFont(self.txtedit_mainwin_rawSignalPanel_CsThresh, color="red") self.txtedit_mainwin_rawSignalPanel_CsThresh.setValue(300.0) self.line_mainwin_rawSignalPanel_CsL1 = QtGui.QFrame() self.line_mainwin_rawSignalPanel_CsL1.setFrameShape(QFrame.VLine) self.line_mainwin_rawSignalPanel_CsL1.setFrameShadow(QFrame.Sunken) self.line_mainwin_rawSignalPanel_CsL2 = QtGui.QFrame() self.line_mainwin_rawSignalPanel_CsL2.setFrameShape(QFrame.VLine) self.line_mainwin_rawSignalPanel_CsL2.setFrameShadow(QFrame.Sunken) self.pushBtn_mainwin_rawSignalPanel_CsAutoThresh = QPushButton("Auto") lib.setFont(self.pushBtn_mainwin_rawSignalPanel_CsAutoThresh, color="red") self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addWidget(self.txtlabel_mainwin_rawSignalPanel_CsThresh) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addWidget(self.txtedit_mainwin_rawSignalPanel_CsThresh) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addWidget(self.line_mainwin_rawSignalPanel_CsL1) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addStretch() self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addWidget(self.line_mainwin_rawSignalPanel_CsL2) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.\ addWidget(self.pushBtn_mainwin_rawSignalPanel_CsAutoThresh) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.setSpacing(1) self.layout_mainwin_rawSignalPanel_CsPeak_Thresh.setContentsMargins( 1, 1, 1, 1) self.layout_mainwin_rawSignalPanel_CsPeak.\ addLayout(self.layout_mainwin_rawSignalPanel_CsPeak_Thresh) self.layout_mainwin_rawSignalPanel_CsPeak.\ addWidget(self.plot_mainwin_rawSignalPanel_CsPeak) self.layout_mainwin_rawSignalPanel_CsPeak.setStretch(0, 0) self.layout_mainwin_rawSignalPanel_CsPeak.setStretch(1, 1) self.layout_mainwin_rawSignalPanel_CsPeak.setSpacing(1) self.layout_mainwin_rawSignalPanel_CsPeak.setContentsMargins( 1, 1, 1, 1) # rawSignal plot is x3 while the SsPeak and CsPeak are x1 self.layout_mainwin_rawSignalPanel.\ addWidget(self.plot_mainwin_rawSignalPanel_rawSignal) self.layout_mainwin_rawSignalPanel.\ addWidget(self.widget_mainwin_rawSignalPanel_SsPeakPanel) self.layout_mainwin_rawSignalPanel.\ addWidget(self.widget_mainwin_rawSignalPanel_CsPeakPanel) self.layout_mainwin_rawSignalPanel.setStretch(0, 3) self.layout_mainwin_rawSignalPanel.setStretch(1, 1) self.layout_mainwin_rawSignalPanel.setStretch(2, 1) self.layout_mainwin_rawSignalPanel.setSpacing(1) self.layout_mainwin_rawSignalPanel.setContentsMargins(1, 1, 1, 1) return 0
def build_slotBoundary_Widget(self): self.layout_slotBoundary = QVBoxLayout() self.layout_slotBoundary_OkCancel = QHBoxLayout() self.layout_slotBoundary_toolbar = QHBoxLayout() # Cancel push button for closing the window and terminating the process self.pushBtn_slotBoundary_cancel = QPushButton("Cancel") lib.setFont(self.pushBtn_slotBoundary_cancel) self.pushBtn_slotBoundary_ok = QPushButton("OK") lib.setFont(self.pushBtn_slotBoundary_ok) self.layout_slotBoundary_OkCancel.addWidget(self.pushBtn_slotBoundary_cancel) self.layout_slotBoundary_OkCancel.addWidget(self.pushBtn_slotBoundary_ok) # separator line self.line_slotBoundary_h0 = QtWidgets.QFrame() self.line_slotBoundary_h0.setFrameShape(QFrame.HLine) self.line_slotBoundary_h0.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_h1 = QtWidgets.QFrame() self.line_slotBoundary_h1.setFrameShape(QFrame.HLine) self.line_slotBoundary_h1.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_v0 = QtWidgets.QFrame() self.line_slotBoundary_v0.setFrameShape(QFrame.VLine) self.line_slotBoundary_v0.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_v1 = QtWidgets.QFrame() self.line_slotBoundary_v1.setFrameShape(QFrame.VLine) self.line_slotBoundary_v1.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_v2 = QtWidgets.QFrame() self.line_slotBoundary_v2.setFrameShape(QFrame.VLine) self.line_slotBoundary_v2.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_v3 = QtWidgets.QFrame() self.line_slotBoundary_v3.setFrameShape(QFrame.VLine) self.line_slotBoundary_v3.setFrameShadow(QFrame.Sunken) self.line_slotBoundary_v4 = QtWidgets.QFrame() self.line_slotBoundary_v4.setFrameShape(QFrame.VLine) self.line_slotBoundary_v4.setFrameShadow(QFrame.Sunken) # toolbar self.label_slotBoundary_numSlots = QLabel("Number of slots:") lib.setFont(self.label_slotBoundary_numSlots) self.spinBx_slotBoundary_numSlots = QSpinBox() self.spinBx_slotBoundary_numSlots.setKeyboardTracking(False) self.spinBx_slotBoundary_numSlots.setMinimum(1) self.spinBx_slotBoundary_numSlots.setMaximum(120) self.spinBx_slotBoundary_numSlots.setValue(30) lib.setFont(self.spinBx_slotBoundary_numSlots) self.pushBtn_slotBoundary_addSlot = QPushButton("Add line at click") lib.setFont(self.pushBtn_slotBoundary_addSlot) self.pushBtn_slotBoundary_addSlot.setCheckable(True) self.pushBtn_slotBoundary_addSlot.setIcon(QtGui.QIcon(os.path.join(lib.PROJECT_FOLDER, 'icons', 'crosshair.png'))) self.label_slotBoundary_description = QLabel("Drag line out of boundries to delete.") lib.setFont(self.label_slotBoundary_description) self.label_slotBoundary_resetModeDescription = QLabel("Restart mode: ") lib.setFont(self.label_slotBoundary_resetModeDescription) self.comboBx_slotBoundary_restartMode = QComboBox() self.comboBx_slotBoundary_restartMode.addItems(["Hard restart","Soft restart"]) lib.setFont(self.comboBx_slotBoundary_restartMode) self.label_slotBoundary_duration = QLabel(f"Avg slot duration: {10}s.") lib.setFont(self.label_slotBoundary_duration) self.layout_slotBoundary_toolbar.addWidget(self.label_slotBoundary_numSlots) self.layout_slotBoundary_toolbar.addWidget(self.spinBx_slotBoundary_numSlots) self.layout_slotBoundary_toolbar.addWidget(self.line_slotBoundary_v0) self.layout_slotBoundary_toolbar.addWidget(self.pushBtn_slotBoundary_addSlot) self.layout_slotBoundary_toolbar.addWidget(self.line_slotBoundary_v1) self.layout_slotBoundary_toolbar.addWidget(self.label_slotBoundary_description) self.layout_slotBoundary_toolbar.addWidget(self.line_slotBoundary_v2) self.layout_slotBoundary_toolbar.addStretch() self.layout_slotBoundary_toolbar.addWidget(self.line_slotBoundary_v3) self.layout_slotBoundary_toolbar.addWidget(self.label_slotBoundary_resetModeDescription) self.layout_slotBoundary_toolbar.addWidget(self.comboBx_slotBoundary_restartMode) self.layout_slotBoundary_toolbar.addWidget(self.line_slotBoundary_v4) self.layout_slotBoundary_toolbar.addWidget(self.label_slotBoundary_duration) self.layout_slotBoundary_toolbar.setSpacing(1) self.layout_slotBoundary_toolbar.setContentsMargins(1,1,1,1) # plot self.plot_slotBoundary_mainPlot = pg.PlotWidget() lib.set_plotWidget(self.plot_slotBoundary_mainPlot) # add widgets to the layout self.layout_slotBoundary.addLayout(self.layout_slotBoundary_OkCancel) self.layout_slotBoundary.addWidget(self.line_slotBoundary_h0) self.layout_slotBoundary.addLayout(self.layout_slotBoundary_toolbar) self.layout_slotBoundary.addWidget(self.line_slotBoundary_h1) self.layout_slotBoundary.addWidget(self.plot_slotBoundary_mainPlot) self.layout_slotBoundary.setSpacing(1) self.layout_slotBoundary.setContentsMargins(1,1,1,1) self.setLayout(self.layout_slotBoundary) return 0
def init_plot(self): self.graphWin.setBackground('w') # Stats self.pltLabel_Stats = self.graphWin.addLabel(text='TEXT2', row=None, col=None, rowspan=1, colspan=3) # Next Row self.graphWin.nextRow() # Waveform self.pltWidget_Waveform = self.graphWin.addPlot(title="Waveform") lib.set_plotWidget(self.pltWidget_Waveform, bkg=False) self.pltWidget_Waveform.setTitle("Y: Waveform(uV) | X: Time(ms)") self.pltData_SsWave95Min =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="ssWave95Min", \ pen=pg.mkPen(color=(0, 0, 255, 155), width=2, style=QtCore.Qt.SolidLine)) self.pltData_SsWave95Max =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="ssWave95Max", \ pen=pg.mkPen(color=(0, 0, 255, 155), width=2, style=QtCore.Qt.SolidLine)) self.pltData_CsWave95Min =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="csWave95Min", \ pen=pg.mkPen(color=(255, 0, 0, 155), width=2, style=QtCore.Qt.SolidLine)) self.pltData_CsWave95Max =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="csWave95Max", \ pen=pg.mkPen(color=(255, 0, 0, 155), width=2, style=QtCore.Qt.SolidLine)) self.pltData_SsWave =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="ssWave", \ pen=pg.mkPen(color=(0, 0, 255, 255), width=3, style=QtCore.Qt.SolidLine)) self.pltData_CsWave =\ self.pltWidget_Waveform.\ plot(np.zeros((0)), np.zeros((0)), name="csWave", \ pen=pg.mkPen(color=(255, 0, 0, 255), width=3, style=QtCore.Qt.SolidLine)) self.viewBox_Waveform = self.pltWidget_Waveform.getViewBox() self.viewBox_Waveform.autoRange() # SS_IFR self.pltWidget_SsIfr = self.graphWin.addPlot(title="SS_Ifr") lib.set_plotWidget(self.pltWidget_SsIfr, bkg=False) self.pltWidget_SsIfr.setTitle("Y: SS_IFR(#) | X: Freq(Hz)") self.pltData_SsIfr =\ self.pltWidget_SsIfr.\ plot(np.arange(2), np.zeros((1)), name="ssIfr", stepMode=True, fillLevel=0, brush=(0,0,255,200)) self.infLine_SsIfr = \ pg.InfiniteLine(pos=+60., angle=90, \ pen=pg.mkPen(color=(0,0,255,255), width=2, style=QtCore.Qt.SolidLine), movable=False, hoverPen='g', label='ssIfr', labelOpts={'position':0.90}) self.pltWidget_SsIfr.\ addItem(self.infLine_SsIfr, ignoreBounds=False) self.viewBox_SsIfr = self.pltWidget_SsIfr.getViewBox() self.viewBox_SsIfr.autoRange() # SS_Peak self.pltWidget_SsPeak = self.graphWin.addPlot(title="SS_Peak") lib.set_plotWidget(self.pltWidget_SsPeak, bkg=False) self.pltWidget_SsPeak.setTitle("X: SS_Peak_Dist(uV) | Y: Count(#)") self.pltData_SsPeak =\ self.pltWidget_SsPeak.\ plot(np.arange(2), np.zeros((1)), name="ssPeak", stepMode=True, fillLevel=0, brush=(0,0,255,200)) self.viewBox_SsPeak = self.pltWidget_SsPeak.getViewBox() self.viewBox_SsPeak.autoRange() # Next Row self.graphWin.nextRow() # Cross_Probability self.pltWidget_xProb = self.graphWin.addPlot(title="Cross_Probability") lib.set_plotWidget(self.pltWidget_xProb, bkg=False) self.pltWidget_xProb.setTitle("Y: Cross_Probability(1) | X: Time(ms)") self.pltData_SsCorr =\ self.pltWidget_xProb.\ plot(np.zeros((0)), np.zeros((0)), name="ssCorr", \ pen=pg.mkPen(color='b', width=3, style=QtCore.Qt.SolidLine)) self.pltData_CsCorr =\ self.pltWidget_xProb.\ plot(np.zeros((0)), np.zeros((0)), name="csCorr", \ pen=pg.mkPen(color='r', width=3, style=QtCore.Qt.SolidLine)) self.viewBox_xProb = self.pltWidget_xProb.getViewBox() self.viewBox_xProb.autoRange() # CS_IFR self.pltWidget_CsIfr = self.graphWin.addPlot(title="CS_Ifr") lib.set_plotWidget(self.pltWidget_CsIfr, bkg=False) self.pltWidget_CsIfr.setTitle("Y: CS_IFR(#) | X: Freq(Hz)") self.pltData_CsIfr =\ self.pltWidget_CsIfr.\ plot(np.arange(2), np.zeros((1)), name="csIfr", stepMode=True, fillLevel=0, brush=(255,0,0,200)) self.infLine_CsIfr = \ pg.InfiniteLine(pos=+0.80, angle=90, \ pen=pg.mkPen(color=(255,0,0,255), width=2, style=QtCore.Qt.SolidLine), movable=False, hoverPen='g', label='csIfr', labelOpts={'position':0.90}) self.pltWidget_CsIfr.\ addItem(self.infLine_CsIfr, ignoreBounds=False) self.viewBox_CsIfr = self.pltWidget_CsIfr.getViewBox() self.viewBox_CsIfr.autoRange() # CS_Peak self.pltWidget_CsPeak = self.graphWin.addPlot(title="CS_Peak") lib.set_plotWidget(self.pltWidget_CsPeak, bkg=False) self.pltWidget_CsPeak.setTitle("X: CS_Peak_Dist(uV) | Y: Count(#)") self.pltData_CsPeak =\ self.pltWidget_CsPeak.\ plot(np.arange(2), np.zeros((1)), name="csPeak", stepMode=True, fillLevel=0, brush=(255,0,0,200)) self.viewBox_CsPeak = self.pltWidget_CsPeak.getViewBox() self.viewBox_CsPeak.autoRange() return 0