Example #1
0
    def __init__(self, entry_settings, filename, main=None):
        QtGui.QWidget.__init__(self, main)
        self.main = main
        self.setWindowTitle('Lockin scan monitor')
        self.setMinimumSize(1200, 600)
        self.entry_settings = entry_settings

        # set up batch list display
        self.batchListWidget = JPLBatchListWidget(entry_settings)
        batchArea = QtGui.QScrollArea()
        batchArea.setWidgetResizable(True)
        batchArea.setWidget(self.batchListWidget)

        batchDisplay = QtGui.QGroupBox()
        batchDisplay.setTitle('Batch List')
        batchLayout = QtGui.QVBoxLayout()
        batchLayout.addWidget(batchArea)
        batchDisplay.setLayout(batchLayout)

        # set up single scan monitor + daq class
        self.singleScan = SingleScan(filename, parent=self, main=self.main)

        # set up progress bar
        self.currentProgBar = QtGui.QProgressBar()
        self.totalProgBar = QtGui.QProgressBar()

        progressDisplay = QtGui.QWidget()
        progressLayout = QtGui.QGridLayout()
        progressLayout.addWidget(QtGui.QLabel('Current Progress'), 0, 0)
        progressLayout.addWidget(self.currentProgBar, 0, 1)
        progressLayout.addWidget(QtGui.QLabel('Total progress'), 1, 0)
        progressLayout.addWidget(self.totalProgBar, 1, 1)
        progressDisplay.setLayout(progressLayout)

        mainLayout = QtGui.QGridLayout()
        mainLayout.addWidget(batchDisplay, 0, 0, 1, 2)
        mainLayout.addWidget(self.singleScan, 0, 2, 1, 3)
        mainLayout.addWidget(progressDisplay, 1, 0, 1, 5)
        self.setLayout(mainLayout)

        # Initiate progress bar
        total_time = ceil(Shared.jpl_scan_time(entry_settings))
        self.totalProgBar.setRange(0, total_time)
        self.totalProgBar.setValue(0)
        self.batch_time_taken = 0

        # Start scan
        self.next_entry_signal.connect(self.next_entry)
        # this makes sure batch starts at index 0
        self.current_entry_index = -1
        self.next_entry_signal.emit()
Example #2
0
    def __init__(self, entry_settings, filename, main=None):
        QtGui.QWidget.__init__(self, main)
        self.main = main
        self.setWindowTitle('Lockin scan monitor')
        self.setMinimumSize(1200, 600)
        self.entry_settings = entry_settings

        # set up batch list display
        self.batchListWidget = JPLBatchListWidget(entry_settings)
        batchArea = QtGui.QScrollArea()
        batchArea.setWidgetResizable(True)
        batchArea.setWidget(self.batchListWidget)

        batchDisplay = QtGui.QGroupBox()
        batchDisplay.setTitle('Batch List')
        batchLayout = QtGui.QVBoxLayout()
        batchLayout.addWidget(batchArea)
        batchDisplay.setLayout(batchLayout)

        # set up single scan monitor + daq class
        self.singleScan = SingleScan(filename, parent=self, main=self.main)

        # set up progress bar
        self.currentProgBar = QtGui.QProgressBar()
        self.totalProgBar = QtGui.QProgressBar()

        progressDisplay = QtGui.QWidget()
        progressLayout = QtGui.QGridLayout()
        progressLayout.addWidget(QtGui.QLabel('Current Progress'), 0, 0)
        progressLayout.addWidget(self.currentProgBar, 0, 1)
        progressLayout.addWidget(QtGui.QLabel('Total progress'), 1, 0)
        progressLayout.addWidget(self.totalProgBar, 1, 1)
        progressDisplay.setLayout(progressLayout)

        mainLayout = QtGui.QGridLayout()
        mainLayout.addWidget(batchDisplay, 0, 0, 1, 2)
        mainLayout.addWidget(self.singleScan, 0, 2, 1, 3)
        mainLayout.addWidget(progressDisplay, 1, 0, 1, 5)
        self.setLayout(mainLayout)

        # Initiate progress bar
        total_time = ceil(Shared.jpl_scan_time(entry_settings))
        self.totalProgBar.setRange(0, total_time)
        self.totalProgBar.setValue(0)
        self.batch_time_taken = 0

        # Start scan
        self.next_entry_signal.connect(self.next_entry)
        # this makes sure batch starts at index 0
        self.current_entry_index = -1
        self.next_entry_signal.emit()
Example #3
0
    def on_scan_jpl(self):

        # when invoke this dialog, pause live lockin monitor in the main panel
        self.liaMonitor.stop()

        # if it is test mode, or real-run mode with instrument correctly connected
        if self.testModeAction.isChecked() or (self.synHandle
                                               and self.liaHandle):
            dconfig = ScanLockin.JPLScanConfig(main=self)
            entry_settings = None
            dconfig_result = dconfig.exec_()
        else:
            # instrument handle is None, pop up error
            msg = Shared.MsgError(
                self, 'Instrument Offline!',
                'Connect to the synthesizer and lockin first before proceed.')
            msg.exec_()
            return None

        # this loop makes sure the config dialog does not disappear
        # unless the settings are all valid / or user hits cancel
        while dconfig_result:  # if dialog accepted
            entry_settings, filename = dconfig.get_settings()
            if entry_settings:
                total_time = Shared.jpl_scan_time(entry_settings)
                now = datetime.datetime.today()
                length = datetime.timedelta(seconds=total_time)
                then = now + length
                text = 'This batch job is estimated to take {:s}.\nIt is expected to finish at {:s}.'.format(
                    str(length), then.strftime('%I:%M %p, %m-%d-%Y (%a)'))
                q = Shared.MsgInfo(self, 'Time Estimation', text)
                q.addButton(QtGui.QMessageBox.Cancel)
                qres = q.exec_()
                if qres == QtGui.QMessageBox.Ok:
                    break
                else:
                    dconfig_result = dconfig.exec_()
            else:
                dconfig_result = dconfig.exec_()

        if entry_settings and dconfig_result:
            dscan = ScanLockin.JPLScanWindow(entry_settings,
                                             filename,
                                             main=self)
            dscan.exec_()
        else:
            pass
Example #4
0
    def on_scan_jpl(self):

        # when invoke this dialog, pause live lockin monitor in the main panel
        self.liaMonitor.stop()

        # if it is test mode, or real-run mode with instrument correctly connected
        if self.testModeAction.isChecked() or (self.synHandle and self.liaHandle):
            dconfig = ScanLockin.JPLScanConfig(main=self)
            entry_settings = None
            dconfig_result = dconfig.exec_()
        else:
            # instrument handle is None, pop up error
            msg = Shared.MsgError(self, 'Instrument Offline!', 'Connect to the synthesizer and lockin first before proceed.')
            msg.exec_()
            return None

        # this loop makes sure the config dialog does not disappear
        # unless the settings are all valid / or user hits cancel
        while dconfig_result:  # if dialog accepted
            entry_settings, filename = dconfig.get_settings()
            if entry_settings:
                total_time = Shared.jpl_scan_time(entry_settings)
                now = datetime.datetime.today()
                length = datetime.timedelta(seconds=total_time)
                then = now + length
                text = 'This batch job is estimated to take {:s}.\nIt is expected to finish at {:s}.'.format(str(length), then.strftime('%I:%M %p, %m-%d-%Y (%a)'))
                q = Shared.MsgInfo(self, 'Time Estimation', text)
                q.addButton(QtGui.QMessageBox.Cancel)
                qres = q.exec_()
                if qres == QtGui.QMessageBox.Ok:
                    break
                else:
                    dconfig_result = dconfig.exec_()
            else:
                dconfig_result = dconfig.exec_()

        if entry_settings and dconfig_result:
            dscan = ScanLockin.JPLScanWindow(entry_settings, filename, main=self)
            dscan.exec_()
        else:
            pass