Exemple #1
0
    def initializeGUI(self):
        layout = QtGui.QGridLayout()
        from labrad.units import WithUnit as U
        self.U = U
        qBox = QtGui.QGroupBox('DDS Control')
        subLayout = QtGui.QGridLayout()
        qBox.setLayout(subLayout)
        layout.addWidget(qBox, 0, 0)
        for chan in self.chaninfo:
            port = self.chaninfo[chan][0]
            try:
                self.contexts[port]
            except:
                self.contexts[port] = yield self.server.context()
                yield self.server.select_device(port,
                                                context=self.contexts[port])
            position = self.chaninfo[chan][1]
            channel = self.chaninfo[chan][2]
            initfreq = self.chaninfo[chan][3]
            widget = QCustomFreqPower(chan)
            MinPower = self.U(-63, 'dbm')
            MaxPower = self.U(-1.1625, 'dbm')
            MinFreq = self.U(0, 'MHz')
            MaxFreq = self.U(500, 'MHz')
            widget.setPowerRange((MinPower['dbm'], MaxPower['dbm']))
            widget.setFreqRange((MinFreq['MHz'], MaxFreq['MHz']))
            if chan in self.settings:
                value = yield self.reg.get(chan)
                initstate = value[0]
                initpower = value[1]
                initfreq = value[2]
            else:
                initstate = False
                initpower = MinPower
                initfreq = MaxFreq / 2
            widget.setStateNoSignal(initstate)
            widget.setPowerNoSignal(initpower['dbm'])
            widget.setFreqNoSignal(initfreq['MHz'])

            yield self.powerChanged(initpower['dbm'], port, (chan, channel))
            yield self.freqChanged(initfreq['MHz'], port, (chan, channel))
            yield self.switchChanged(initstate, port, (chan, channel))

            widget.spinPower.valueChanged.connect(
                lambda value=widget.spinPower.value(), port=port, channel=
                (chan, channel): self.powerChanged(value, port, channel))
            widget.spinFreq.valueChanged.connect(
                lambda value=widget.spinFreq.value(), port=port, channel=
                (chan, channel): self.freqChanged(value, port, channel))
            widget.buttonSwitch.toggled.connect(
                lambda state=widget.buttonSwitch.isDown(), port=port, channel=
                (chan, channel): self.switchChanged(state, port, channel))
            self.d[port] = widget
            subLayout.addWidget(self.d[port], position[0], position[1])
        self.setLayout(layout)
Exemple #2
0
    def initializeGUI(self):
        layout = QtGui.QGridLayout()
        chans = yield self.server.get_dds_channels()
        if self.chan in chans:
            widget = QCustomFreqPower(self.chan)
            MinPower, MaxPower = yield self.server.get_dds_amplitude_range(self.chan)
            MinFreq, MaxFreq = yield self.server.get_dds_frequency_range(self.chan)
            widget.setPowerRange((MinPower, MaxPower))
            widget.setFreqRange((MinFreq, MaxFreq))
            initpower = yield self.server.amplitude(self.chan)
            initfreq = yield self.server.frequency(self.chan)
            initstate = yield self.server.output(self.chan)
            widget.spinFreq.setSingleStep(0.001)
            widget.setStateNoSignal(initstate)
            widget.setPowerNoSignal(initpower['dBm'])
            widget.setFreqNoSignal(initfreq['MHz'])
            widget.spinPower.valueChanged.connect(self.powerChanged)
            widget.spinFreq.valueChanged.connect(self.freqChanged) 
            widget.buttonSwitch.toggled.connect(self.switchChanged)
            layout.addWidget(widget)

        self.setLayout(layout)
Exemple #3
0
    def initializeGUI(self):
        layout = QtGui.QGridLayout()
        chans = yield self.server.get_dds_channels()
        if self.chan in chans:
            widget = QCustomFreqPower(self.chan)
            MinPower, MaxPower = yield self.server.get_dds_amplitude_range(
                self.chan)
            MinFreq, MaxFreq = yield self.server.get_dds_frequency_range(
                self.chan)
            widget.setPowerRange((MinPower, MaxPower))
            widget.setFreqRange((MinFreq, MaxFreq))
            initpower = yield self.server.amplitude(self.chan)
            initfreq = yield self.server.frequency(self.chan)
            initstate = yield self.server.output(self.chan)
            widget.spinFreq.setSingleStep(0.001)
            widget.setStateNoSignal(initstate)
            widget.setPowerNoSignal(initpower['dBm'])
            widget.setFreqNoSignal(initfreq['MHz'])
            widget.spinPower.valueChanged.connect(self.powerChanged)
            widget.spinFreq.valueChanged.connect(self.freqChanged)
            widget.buttonSwitch.toggled.connect(self.switchChanged)
            layout.addWidget(widget)

        self.setLayout(layout)
Exemple #4
0
    def initializeGUI(self):
        layout = QtGui.QGridLayout()
        from labrad.units import WithUnit as U
        self.U = U
        qBox = QtGui.QGroupBox('DDS Control')
        subLayout = QtGui.QGridLayout()
        qBox.setLayout(subLayout)
        layout.addWidget(qBox, 0, 0)
        for chan in self.chaninfo:
            port = self.chaninfo[chan][0]
            try: self.contexts[port]
            except:
                self.contexts[port] = yield self.server.context()
                yield self.server.select_device(port, context = self.contexts[port])
            position = self.chaninfo[chan][1]
            channel = self.chaninfo[chan][2]
            initfreq = self.chaninfo[chan][3]
            widget = QCustomFreqPower(chan)
            MinPower =  self.U(-63, 'dbm')
            MaxPower =  self.U(-1.1625, 'dbm')
            MinFreq = self.U(0, 'MHz')
            MaxFreq = self.U(500, 'MHz')
            widget.setPowerRange((MinPower['dbm'], MaxPower['dbm']))
            widget.setFreqRange((MinFreq['MHz'], MaxFreq['MHz']))
            if chan in self.settings:
                value = yield self.reg.get(chan)
                initstate = value[0]
                initpower = value[1]
                initfreq = value[2]
            else:
                initstate = False
                initpower = MinPower
                initfreq = MaxFreq/2
            widget.setStateNoSignal(initstate)
            widget.setPowerNoSignal(initpower['dbm'])
            widget.setFreqNoSignal(initfreq['MHz'])

            yield self.powerChanged(initpower['dbm'], port, (chan, channel))
            yield self.freqChanged(initfreq['MHz'], port, (chan, channel))
            yield self.switchChanged(initstate, port, (chan, channel))

            widget.spinPower.valueChanged.connect(lambda value =  widget.spinPower.value(), port = port, channel = (chan, channel): self.powerChanged(value, port, channel))
            widget.spinFreq.valueChanged.connect(lambda value = widget.spinFreq.value(), port = port, channel = (chan, channel) : self.freqChanged(value, port, channel))
            widget.buttonSwitch.toggled.connect(lambda state = widget.buttonSwitch.isDown(), port = port, channel = (chan, channel) : self.switchChanged(state, port, channel))
            self.d[port] = widget
            subLayout.addWidget(self.d[port], position[0], position[1])
        self.setLayout(layout)