示例#1
0
    def __init__(self, dev, taskRunner):
        TaskGui.__init__(self, dev, taskRunner)
        daqDev = self.dev.getDAQName()
        self.daqUI = self.taskRunner.getDevice(daqDev)

        self.traces = {
        }  ## Stores traces from a sequence to allow average plotting
        self.resetInpPlots = False  ## Signals result handler to clear plots before adding a new one
        self.currentCmdPlot = None
        self._block_update = False  # blocks plotting during state changes

        self.ui = Ui_Form()
        self.ui.setupUi(self)

        self.ui.splitter_2.setStretchFactor(0, 0)
        self.ui.splitter_2.setStretchFactor(1, 1)
        self.ui.splitter.setStretchFactor(0, 3)
        self.ui.splitter.setStretchFactor(1, 1)

        self.stateGroup = WidgetGroup(self)
        #self.ui.waveGeneratorWidget.setTimeScale(1e-3)
        self.ui.waveGeneratorWidget.setMeta('x',
                                            units='s',
                                            siPrefix=True,
                                            dec=True,
                                            step=0.5,
                                            minStep=1e-6)
        self.unitLabels = [self.ui.waveGeneratorLabel, self.ui.holdingCheck]
        #self.modeSignalList = self.dev.listModeSignals()
        self.mode = None
        self.setMode('I=0')

        self.ui.topPlotWidget.registerPlot(self.dev.name() + '.Input')
        self.ui.topPlotWidget.setDownsampling(ds=True, auto=True, mode='peak')
        self.ui.topPlotWidget.setClipToView(True)
        self.ui.bottomPlotWidget.registerPlot(self.dev.name() + '.Command')
        self.ui.bottomPlotWidget.setDownsampling(ds=True,
                                                 auto=True,
                                                 mode='peak')
        self.ui.bottomPlotWidget.setClipToView(True)

        self.daqChanged(self.daqUI.currentState())
        self.daqUI.sigChanged.connect(self.daqChanged)
        self.ui.waveGeneratorWidget.sigDataChanged.connect(self.updateWaves)
        self.ui.waveGeneratorWidget.sigParametersChanged.connect(
            self.sequenceChanged)
        self.stateGroup.sigChanged.connect(self.uiStateChanged)
        self.dev.sigStateChanged.connect(self.devStateChanged)
        self.dev.sigHoldingChanged.connect(self.devHoldingChanged)
        self.uiStateChanged('', '')
        self.devStateChanged()
示例#2
0
 def __init__(self, dev, taskRunner, ivModes):
     DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False)
     
     self.ivModes = ivModes
     self.layout = QtGui.QGridLayout()
     self.layout.setContentsMargins(0,0,0,0)
     self.setLayout(self.layout)
     
     self.splitter1 = QtGui.QSplitter()
     self.splitter1.setOrientation(QtCore.Qt.Horizontal)
     self.layout.addWidget(self.splitter1)
     
     self.splitter2 = QtGui.QSplitter()
     self.splitter2.setOrientation(QtCore.Qt.Vertical)
     self.modeCombo = QtGui.QComboBox()
     self.splitter2.addWidget(self.modeCombo)
     self.modeCombo.addItems(self.dev.listModes())
     
     self.splitter3 = QtGui.QSplitter()
     self.splitter3.setOrientation(QtCore.Qt.Vertical)
     
     (w1, p1) = self.createChannelWidget('primary')
     (w2, p2) = self.createChannelWidget('command')
     
     self.cmdWidget = w2
     self.inputWidget = w1
     self.cmdPlot = p2
     self.inputPlot = p1
     
     #self.ctrlWidget = QtGui.QWidget()
     #self.ctrl = Ui_protoCtrl()
     #self.ctrl.setupUi(self.ctrlWidget)
     #self.splitter2.addWidget(self.ctrlWidget)
     
     self.splitter1.addWidget(self.splitter2)
     self.splitter1.addWidget(self.splitter3)
     self.splitter2.addWidget(w1)
     self.splitter2.addWidget(w2)
     self.splitter3.addWidget(p1)
     self.splitter3.addWidget(p2)
     self.splitter1.setSizes([100, 500])
     
     self.stateGroup = WidgetGroup([
         (self.splitter1, 'splitter1'),
         (self.splitter2, 'splitter2'),
         (self.splitter3, 'splitter3'),
     ])
     
     self.modeCombo.currentIndexChanged.connect(self.modeChanged)
     self.modeChanged()
示例#3
0
    def __init__(self, dev, taskRunner):
        DAQGenericTaskGui.__init__(self, dev, taskRunner, ownUi=False)

        self.layout = Qt.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.layout)

        self.splitter1 = Qt.QSplitter()
        self.splitter1.setOrientation(Qt.Qt.Horizontal)
        self.layout.addWidget(self.splitter1)

        self.splitter2 = Qt.QSplitter()
        self.splitter2.setOrientation(Qt.Qt.Vertical)
        self.modeCombo = Qt.QComboBox()
        self.splitter2.addWidget(self.modeCombo)
        self.modeCombo.addItems(self.dev.listModes())

        self.splitter3 = Qt.QSplitter()
        self.splitter3.setOrientation(Qt.Qt.Vertical)

        (w1, p1) = self.createChannelWidget('primary')
        (w2, p2) = self.createChannelWidget('command')

        self.cmdWidget = w2
        self.inputWidget = w1
        self.cmdPlot = p2
        self.inputPlot = p1
        self.cmdWidget.setMeta('x', siPrefix=True, suffix='s', dec=True)
        self.cmdWidget.setMeta('y', siPrefix=True, dec=True)

        self.splitter1.addWidget(self.splitter2)
        self.splitter1.addWidget(self.splitter3)
        self.splitter2.addWidget(w1)
        self.splitter2.addWidget(w2)
        self.splitter3.addWidget(p1)
        self.splitter3.addWidget(p2)
        self.splitter1.setSizes([100, 500])

        self.stateGroup = WidgetGroup([
            (self.splitter1, 'splitter1'),
            (self.splitter2, 'splitter2'),
            (self.splitter3, 'splitter3'),
        ])

        self.modeCombo.currentIndexChanged.connect(self.modeChanged)
        self.modeChanged()
示例#4
0
 def __init__(self, dev, task, ownUi=True):
     TaskGui.__init__(self, dev, task)
     self.plots = weakref.WeakValueDictionary()
     self.channels = {}
     
     if ownUi:
         self.ui = Ui_Form()
         self.ui.setupUi(self)
         self.stateGroup = WidgetGroup([
             (self.ui.topSplitter, 'splitter1'),
             (self.ui.controlSplitter, 'splitter2'),
             (self.ui.plotSplitter, 'splitter3'),
         ])
         self.createChannelWidgets(self.ui.controlSplitter, self.ui.plotSplitter)
         self.ui.topSplitter.setStretchFactor(0, 0)
         self.ui.topSplitter.setStretchFactor(1, 1)
         
     else:
         ## If ownUi is False, then the UI is created elsewhere and createChannelWidgets must be called from there too.
         self.stateGroup = None
示例#5
0
 def postGuiInit(self):
     self.stateGroup = WidgetGroup(self)
示例#6
0
    def __init__(self, dev, win):
        #pdb.set_trace()
        Qt.QWidget.__init__(self)
        self.dev = dev
        self.win = win
        #self.cam = self.dev.cam
        #self.ui = Ui_Form()
        #self.ui.setupUi(self)
        self.layout = Qt.QGridLayout()
        self.layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.layout)

        self.params = self.dev.listParams()
        self.stateGroup = WidgetGroup([])
        #self.labels = {}

        params = []

        for k, p in self.params.items():
            try:
                val = self.dev.getParam(k)
            except:
                continue

            if not p[1]:  ## read-only param
                params.append({
                    'name': k,
                    'readonly': True,
                    'value': val,
                    'type': 'str'
                })
                #w = Qt.QLabel()
                #w.setText(str(val))
                #self.labels[k] = w

            else:  ## parameter is writable
                if type(p[0]) is tuple:
                    if len(p[0]) == 3:
                        (mn, mx, step) = p[0]
                    elif len(p[0]) == 2:
                        (mn, mx) = p[0]
                        step = 1
                    else:
                        raise TypeError(
                            "Invalid parameter specification for '%s': %s" %
                            (k, repr(p)))
                    if type(mx) in [int, long] and type(mn) in [int, long]:
                        params.append({
                            'name': k,
                            'type': 'int',
                            'value': val,
                            'limits': (mn, mx),
                            'step': step
                        })
                    else:
                        params.append({
                            'name': k,
                            'type': 'float',
                            'value': val,
                            'limits': (mn, mx),
                            'dec': True,
                            'step': 1
                        })
                        if k == 'exposure':
                            params[-1]['suffix'] = 's'
                            params[-1]['siPrefix'] = True
                            params[-1]['minStep'] = 1e-6
                elif type(p[0]) is list:
                    #print k, val, p
                    params.append({
                        'name': k,
                        'type': 'list',
                        'value': val,
                        'values': p[0]
                    })
                #elif 'BOOL' in typ:
                #    w = Qt.QCheckBox()
                #    w.setChecked(val)
                else:
                    print("    Ignoring parameter '%s': %s" % (k, str(p)))
                    continue

                #self.stateGroup.addWidget(w, k)
            #self.ui.formLayout_2.addRow(k, w)
        #self.stateGroup.sigChanged.connect(self.stateChanged)

        self.paramSet = Parameter(name='cameraParams',
                                  type='group',
                                  children=params)
        self.paramWidget = ParameterTree()
        self.paramWidget.setParameters(self.paramSet, showTop=False)
        self.layout.addWidget(self.paramWidget)

        self.paramSet.sigTreeStateChanged.connect(self.stateChanged)
        #self.ui.reconnectBtn.clicked.connect(self.reconnect)
        self.dev.sigParamsChanged.connect(self.paramsChanged)
示例#7
0
    def __init__(self, dev, taskRunner):
        TaskGui.__init__(self, dev, taskRunner)
        self.ui = Ui_Form()
        self.ui.setupUi(self)
        self.nPts = 0
        self.ignorePeriod = False
        self.ignoreRate = False
        self.rate = 40e3

        self._block_update = False  # use to block signal emission during bulk updates

        self.updateNPts()
        self.updateDevList()
        self.ui.rateSpin.setOpts(dec=True,
                                 step=0.5,
                                 minStep=10,
                                 bounds=[1, None],
                                 siPrefix=True,
                                 suffix='Hz')
        self.ui.periodSpin.setOpts(dec=True,
                                   step=0.5,
                                   minStep=1e-6,
                                   bounds=[1e-6, None],
                                   siPrefix=True,
                                   suffix='s')
        self.ui.besselCutoffSpin.setOpts(value=20e3,
                                         dec=True,
                                         step=0.5,
                                         minStep=10,
                                         bounds=[1, None],
                                         siPrefix=True,
                                         suffix='Hz')
        self.ui.butterworthPassbandSpin.setOpts(value=20e3,
                                                dec=True,
                                                step=0.5,
                                                minStep=10,
                                                bounds=[1, None],
                                                siPrefix=True,
                                                suffix='Hz')
        self.ui.butterworthStopbandSpin.setOpts(value=40e3,
                                                dec=True,
                                                step=0.5,
                                                minStep=10,
                                                bounds=[1, None],
                                                siPrefix=True,
                                                suffix='Hz')

        ## important to create widget group before connecting anything else.
        self.stateGroup = WidgetGroup([
            (self.ui.rateSpin, 'rate'),
            (self.ui.downsampleSpin, 'downsample'),
            (self.ui.triggerDevList, 'triggerDevice'),
            (self.ui.denoiseCombo, 'denoiseMethod'),
            (self.ui.denoiseThresholdSpin, 'denoiseThreshold'),
            (self.ui.denoiseWidthSpin, 'denoiseWidth'),
            (self.ui.filterCombo, 'filterMethod'),
            (self.ui.besselCutoffSpin, 'besselCutoff'),
            (self.ui.besselOrderSpin, 'besselOrder'),
            (self.ui.besselBidirCheck, 'besselBidirectional'),
            (self.ui.butterworthPassbandSpin, 'butterworthPassband'),
            (self.ui.butterworthStopbandSpin, 'butterworthStopband'),
            (self.ui.butterworthPassDBSpin, 'butterworthPassDB'),
            (self.ui.butterworthStopDBSpin, 'butterworthStopDB'),
            (self.ui.butterworthBidirCheck, 'butterworthBidirectional'),
        ])

        self.ui.periodSpin.sigValueChanging.connect(self.updateRateSpin)
        self.ui.rateSpin.sigValueChanging.connect(self.updatePeriodSpin)
        self.taskRunner.sigTaskChanged.connect(self.taskChanged)
        self.ui.denoiseCombo.currentIndexChanged.connect(
            self.updateDenoiseCtrl)
        self.ui.filterCombo.currentIndexChanged.connect(self.updateFilterCtrl)
        self.ui.rateSpin.setValue(self.rate)
        self.stateGroup.sigChanged.connect(self.stateChanged)

        self.updateDenoiseCtrl()
        self.updateFilterCtrl()