From a42a0ce2983520ce3700008f4bfc9502279569c7 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Tue, 15 Jun 2021 23:02:30 -0400 Subject: added spin boxes for central and frequency span --- eitControl.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/eitControl.py b/eitControl.py index e2a1188..84884f6 100644 --- a/eitControl.py +++ b/eitControl.py @@ -110,6 +110,25 @@ class Experiment: w1.addWidget(bExit, row=0, col=5) d1.addWidget(w1) + # RF gen gui + fCent=self.rfGenFunc.getCenter() + fSpan=self.rfGenFunc.getSpan() + spins = [ + ("Central Frequency", + pg.SpinBox(value=fCent, bounds=[6.83e9, 6.84e9], suffix='Hz', siPrefix=True, step=1e3, decimals=10), + self.centralFreqValueChanged), + ("Frequency Span", + pg.SpinBox(value=fSpan, bounds=[1, 10e6], dec=True, step=0.5, suffix='Hz', siPrefix=True, minStep=1), + self.freqSpanValueChanged) + ] + w3 = pg.LayoutWidget() + d3.addWidget(w3) + for text, spin, cb in spins: + l=QtGui.QLabel(text) + w3.addWidget(l) + w3.addWidget(spin) + spin.sigValueChanged.connect(cb) + def clearData(self): self.data = {} for ch in self.channelsNames2grab: @@ -232,7 +251,8 @@ class Experiment: # self.data['x'].append(tic) # self.data['x']=self.data[self.xChannelName] x=self.data[self.xChannelName][-1] - x=(x-self.fCent) + fCent = self.rfGenFunc.getCenter() + x=(x-fCent) self.data['x'].append(x) self.dataPlot.setLabel('bottom', 'Frequency offset', units='Hz') self.dataPlot.setLabel('left', 'Signal', units='V') @@ -261,8 +281,9 @@ class Experiment: self.channelGraph[name].setData(x,y) # centralFreqFormatted = pg.siFormat(self.fCent, suffix='Hz', precision=4) # showing trailing zeros is tricky - centralFreqFormatted = f"{self.fCent/1e9:.6}" - centralFreqFormatted = str.ljust(centralFreqFormatted, 8, '0') + " GHz" + fCent = self.rfGenFunc.getCenter() + centralFreqFormatted = f"{fCent/1e9:.9f}" + centralFreqFormatted = str.ljust(centralFreqFormatted, 11, '0') + " GHz" self.dataPlot.setTitle(f"Signals around center frequency {centralFreqFormatted}") stop = datetime.now() -- cgit v1.2.3