Esempio n. 1
0
    def stop(self):

        # can't find the correct way to check if the timer is connected,
        # this is a cheat
        try:
            self.timer.timeout.disconnect(self.update_plot)
        except TypeError:
            pass
        self.data_collecting = False  # turn data collection status off
        # enable update rate QLineEdit
        self.updateRate.setReadOnly(False)
        self.updateRate.setStyleSheet(
            'color: black; border:  1px solid {:s}'.format(
                Shared.msgcolor(self.msgcode)))
Esempio n. 2
0
    def daq(self):

        if self.main.testModeAction.isChecked():
            self.current_p = np.random.rand()
            msgcode = 2
            status_txt = 'Okay'
        else:
            msgcode, status_txt, self.current_p = api_pres.query_p(
                self.main.pressureHandle, self.channelSel.currentText())

        self.currentP.setText('{:.3e}'.format(self.current_p))
        self.currentStatus.setText(status_txt)
        self.currentStatus.setStyleSheet('color: {:s}'.format(
            Shared.msgcolor(msgcode)))

        if not msgcode:  # if fatal, stop daq
            self.timer.stop()
        else:
            pass
Esempio n. 3
0
    def set_update_period(self):
        ''' Set wait time according to self.updateRate '''

        # stop data collection and re-enable update rate QLineEdit
        self.stop()
        self.updateRate.setReadOnly(False)
        self.updateRate.setStyleSheet('color: black')

        tscalar = self._TIMEUNIT[self.updateRateUnitSel.currentIndex()]

        self.msgcode, self.waittime = api_val.val_float(self.updateRate.text(),
                                                        safe=[('>=',
                                                               0.1 / tscalar)])
        self.updateRate.setStyleSheet('border: 1px solid {:s}'.format(
            Shared.msgcolor(self.msgcode)))
        if self.msgcode == 2:
            self.pgPlot.setLabel('bottom',
                                 text='Time',
                                 units=self.updateRateUnitSel.currentText())
            self.timer.setInterval(self.waittime * tscalar * 1000)
        else:
            pass
Esempio n. 4
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self)

        # Set global window properties
        self.setWindowTitle('Yo! Go PySpec!')
        self.setMinimumWidth(1500)
        self.setMinimumHeight(840)
        self.testModeSignLabel = QtGui.QLabel('[TEST MODE ACTIVE -- NOTHING IS REAL]!')
        self.testModeSignLabel.setStyleSheet('color: {:s}'.format(Shared.msgcolor(0)))
        self.testModeSignLabel.setAlignment(QtCore.Qt.AlignCenter)

        # Initiate pyvisa instrument objects
        self.synHandle = None
        self.liaHandle = None
        self.pciHandle = None
        self.motorHandle = None
        self.pressureHandle = None

        # Set menu bar actions
        exitAction = QtGui.QAction('Exit', self)
        exitAction.setShortcuts(['Ctrl+Q', 'Esc'])
        exitAction.setStatusTip('Exit program')
        exitAction.triggered.connect(self.on_exit)

        # instrument actions
        instSelAction = QtGui.QAction('Select Instrument', self)
        instSelAction.setShortcut('Ctrl+Shift+I')
        instSelAction.setStatusTip('Select instrument')
        instSelAction.triggered.connect(self.on_sel_inst)

        instStatViewAction = QtGui.QAction('View Instrument Status', self)
        instStatViewAction.setShortcut('Ctrl+Shift+V')
        instStatViewAction.setStatusTip('View status of currently connected instrument')
        instStatViewAction.triggered.connect(self.on_view_inst_stat)

        instCloseAction = QtGui.QAction('Close Instrument', self)
        instCloseAction.setStatusTip('Close individual instrument')
        instCloseAction.triggered.connect(self.on_close_sel_inst)

        # scan actions
        scanJPLAction = QtGui.QAction('JPL Scanning Routine', self)
        scanJPLAction.setShortcut('Ctrl+Shift+J')
        scanJPLAction.setStatusTip('Use the scanning style of the JPL scanning routine')
        scanJPLAction.triggered.connect(self.on_scan_jpl)

        scanPCIAction = QtGui.QAction('PCI Oscilloscope', self)
        scanPCIAction.setShortcut('Ctrl+Shift+S')
        scanPCIAction.setStatusTip("Use the scanning style of Brian's NIPCI card routine")
        scanPCIAction.triggered.connect(self.on_scan_pci)

        scanCavityAction = QtGui.QAction('Cavity Enhanced', self)
        scanCavityAction.setShortcut('Ctrl+Shift+C')
        scanCavityAction.setStatusTip('Use cavity enhanced spectroscopy')
        scanCavityAction.triggered.connect(self.on_scan_cavity)

        presReaderAction = QtGui.QAction('Pressure Reader', self)
        presReaderAction.setShortcut('Ctrl+Shift+P')
        presReaderAction.setStatusTip('Record pressure measurements using the CENTER TWO pressure readout')
        presReaderAction.triggered.connect(self.on_pres_reader)

        # data process actions
        lwaParserAction = QtGui.QAction('.lwa preview and export', self)
        lwaParserAction.setStatusTip('Preview JPL .lwa file and export subset of scans')
        lwaParserAction.triggered.connect(self.on_lwa_parser)

        self.testModeAction = QtGui.QAction('Test Mode', self)
        self.testModeAction.setCheckable(True)
        self.testModeAction.setShortcut('Ctrl+T')
        self.testModeAction.setWhatsThis('Toggle the test mode to bypass all instrument communication for GUI development.')

        # Set menu bar
        self.statusBar()

        menuFile = self.menuBar().addMenu('&File')
        menuFile.addAction(exitAction)
        menuInst = self.menuBar().addMenu('&Instrument')
        menuInst.addAction(instSelAction)
        menuInst.addAction(instStatViewAction)
        menuInst.addAction(instCloseAction)
        menuScan = self.menuBar().addMenu('&Scan')
        menuScan.addAction(scanJPLAction)
        menuScan.addAction(scanPCIAction)
        menuScan.addAction(scanCavityAction)
        menuScan.addAction(presReaderAction)
        menuData = self.menuBar().addMenu('&Data')
        menuData.addAction(lwaParserAction)
        menuTest = self.menuBar().addMenu('&Test')
        menuTest.addAction(self.testModeAction)

        # Set classes to store all instrument info
        self.synInfo = Shared.SynInfo()
        self.liaInfo = Shared.LiaInfo()
        self.scopeInfo = Shared.ScopeInfo()
        self.motorInfo = Shared.MotorInfo()

        # Set main window widgets
        self.synStatus = Panels.SynStatus(self)
        self.liaStatus = Panels.LockinStatus(self)
        self.scopeStatus = Panels.ScopeStatus(self)
        self.synCtrl = Panels.SynCtrl(self)
        self.liaCtrl = Panels.LockinCtrl(self)
        self.scopeCtrl = Panels.ScopeCtrl(self)
        self.motorCtrl = Panels.MotorCtrl(self)
        self.scopeMonitor = Panels.ScopeMonitor(self)
        self.liaMonitor = Panels.LockinMonitor(self)
        self.specMonitor = Panels.SpectrumMonitor(self)

        # Set main window layout
        self.mainLayout = QtGui.QGridLayout()
        self.mainLayout.setSpacing(6)
        self.mainLayout.addWidget(self.synStatus, 0, 0, 3, 2)
        self.mainLayout.addWidget(self.liaStatus, 3, 0, 3, 2)
        self.mainLayout.addWidget(self.scopeStatus, 6, 0, 1, 2)
        self.mainLayout.addWidget(self.testModeSignLabel, 7, 0, 1, 2)
        self.mainLayout.addWidget(self.synCtrl, 0, 2, 3, 3)
        self.mainLayout.addWidget(self.liaCtrl, 3, 2, 2, 3)
        self.mainLayout.addWidget(self.scopeCtrl, 5, 2, 2, 3)
        self.mainLayout.addWidget(self.motorCtrl, 7, 2, 1, 3)
        self.mainLayout.addWidget(self.scopeMonitor, 0, 5, 2, 4)
        self.mainLayout.addWidget(self.liaMonitor, 2, 5, 4, 4)
        self.mainLayout.addWidget(self.specMonitor, 6, 5, 2, 4)

        # Enable main window
        self.mainWidget = QtGui.QWidget()
        self.mainWidget.setLayout(self.mainLayout)
        self.setCentralWidget(self.mainWidget)

        # Preload system dialog widgets
        self.load_dialogs()
        self.refresh_inst()
        self.testModeAction.toggled.connect(self.refresh_inst)
Esempio n. 5
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self)

        # Set global window properties
        self.setWindowTitle('Yo! Go PySpec!')
        self.setMinimumWidth(1500)
        self.setMinimumHeight(840)
        self.testModeSignLabel = QtGui.QLabel(
            '[TEST MODE ACTIVE -- NOTHING IS REAL]!')
        self.testModeSignLabel.setStyleSheet('color: {:s}'.format(
            Shared.msgcolor(0)))
        self.testModeSignLabel.setAlignment(QtCore.Qt.AlignCenter)

        # Initiate pyvisa instrument objects
        self.synHandle = None
        self.liaHandle = None
        self.pciHandle = None
        self.motorHandle = None
        self.pressureHandle = None

        # Set menu bar actions
        exitAction = QtGui.QAction('Exit', self)
        exitAction.setShortcuts(['Ctrl+Q', 'Esc'])
        exitAction.setStatusTip('Exit program')
        exitAction.triggered.connect(self.on_exit)

        # instrument actions
        instSelAction = QtGui.QAction('Select Instrument', self)
        instSelAction.setShortcut('Ctrl+Shift+I')
        instSelAction.setStatusTip('Select instrument')
        instSelAction.triggered.connect(self.on_sel_inst)

        instStatViewAction = QtGui.QAction('View Instrument Status', self)
        instStatViewAction.setShortcut('Ctrl+Shift+V')
        instStatViewAction.setStatusTip(
            'View status of currently connected instrument')
        instStatViewAction.triggered.connect(self.on_view_inst_stat)

        instCloseAction = QtGui.QAction('Close Instrument', self)
        instCloseAction.setStatusTip('Close individual instrument')
        instCloseAction.triggered.connect(self.on_close_sel_inst)

        # scan actions
        scanJPLAction = QtGui.QAction('JPL Scanning Routine', self)
        scanJPLAction.setShortcut('Ctrl+Shift+J')
        scanJPLAction.setStatusTip(
            'Use the scanning style of the JPL scanning routine')
        scanJPLAction.triggered.connect(self.on_scan_jpl)

        scanPCIAction = QtGui.QAction('PCI Oscilloscope', self)
        scanPCIAction.setShortcut('Ctrl+Shift+S')
        scanPCIAction.setStatusTip(
            "Use the scanning style of Brian's NIPCI card routine")
        scanPCIAction.triggered.connect(self.on_scan_pci)

        scanCavityAction = QtGui.QAction('Cavity Enhanced', self)
        scanCavityAction.setShortcut('Ctrl+Shift+C')
        scanCavityAction.setStatusTip('Use cavity enhanced spectroscopy')
        scanCavityAction.triggered.connect(self.on_scan_cavity)

        presReaderAction = QtGui.QAction('Pressure Reader', self)
        presReaderAction.setShortcut('Ctrl+Shift+P')
        presReaderAction.setStatusTip(
            'Record pressure measurements using the CENTER TWO pressure readout'
        )
        presReaderAction.triggered.connect(self.on_pres_reader)

        # data process actions
        lwaParserAction = QtGui.QAction('.lwa preview and export', self)
        lwaParserAction.setStatusTip(
            'Preview JPL .lwa file and export subset of scans')
        lwaParserAction.triggered.connect(self.on_lwa_parser)

        self.testModeAction = QtGui.QAction('Test Mode', self)
        self.testModeAction.setCheckable(True)
        self.testModeAction.setShortcut('Ctrl+T')
        self.testModeAction.setWhatsThis(
            'Toggle the test mode to bypass all instrument communication for GUI development.'
        )

        # Set menu bar
        self.statusBar()

        menuFile = self.menuBar().addMenu('&File')
        menuFile.addAction(exitAction)
        menuInst = self.menuBar().addMenu('&Instrument')
        menuInst.addAction(instSelAction)
        menuInst.addAction(instStatViewAction)
        menuInst.addAction(instCloseAction)
        menuScan = self.menuBar().addMenu('&Scan')
        menuScan.addAction(scanJPLAction)
        menuScan.addAction(scanPCIAction)
        menuScan.addAction(scanCavityAction)
        menuScan.addAction(presReaderAction)
        menuData = self.menuBar().addMenu('&Data')
        menuData.addAction(lwaParserAction)
        menuTest = self.menuBar().addMenu('&Test')
        menuTest.addAction(self.testModeAction)

        # Set classes to store all instrument info
        self.synInfo = Shared.SynInfo()
        self.liaInfo = Shared.LiaInfo()
        self.scopeInfo = Shared.ScopeInfo()
        self.motorInfo = Shared.MotorInfo()

        # Set main window widgets
        self.synStatus = Panels.SynStatus(self)
        self.liaStatus = Panels.LockinStatus(self)
        self.scopeStatus = Panels.ScopeStatus(self)
        self.synCtrl = Panels.SynCtrl(self)
        self.liaCtrl = Panels.LockinCtrl(self)
        self.scopeCtrl = Panels.ScopeCtrl(self)
        self.motorCtrl = Panels.MotorCtrl(self)
        self.scopeMonitor = Panels.ScopeMonitor(self)
        self.liaMonitor = Panels.LockinMonitor(self)
        self.specMonitor = Panels.SpectrumMonitor(self)

        # Set main window layout
        self.mainLayout = QtGui.QGridLayout()
        self.mainLayout.setSpacing(6)
        self.mainLayout.addWidget(self.synStatus, 0, 0, 3, 2)
        self.mainLayout.addWidget(self.liaStatus, 3, 0, 3, 2)
        self.mainLayout.addWidget(self.scopeStatus, 6, 0, 1, 2)
        self.mainLayout.addWidget(self.testModeSignLabel, 7, 0, 1, 2)
        self.mainLayout.addWidget(self.synCtrl, 0, 2, 3, 3)
        self.mainLayout.addWidget(self.liaCtrl, 3, 2, 2, 3)
        self.mainLayout.addWidget(self.scopeCtrl, 5, 2, 2, 3)
        self.mainLayout.addWidget(self.motorCtrl, 7, 2, 1, 3)
        self.mainLayout.addWidget(self.scopeMonitor, 0, 5, 2, 4)
        self.mainLayout.addWidget(self.liaMonitor, 2, 5, 4, 4)
        self.mainLayout.addWidget(self.specMonitor, 6, 5, 2, 4)

        # Enable main window
        self.mainWidget = QtGui.QWidget()
        self.mainWidget.setLayout(self.mainLayout)
        self.setCentralWidget(self.mainWidget)

        # Preload system dialog widgets
        self.load_dialogs()
        self.refresh_inst()
        self.testModeAction.toggled.connect(self.refresh_inst)