summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/python
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-17 11:04:02 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-17 11:04:02 -0500
commit9ca6c72a04991a0ec41afcc04b60a85eae52e921 (patch)
tree88c22d2fff68e2e8c3d3b46ce5c7556e2e4f5a95 /gnuradio-core/src/python
parentf8175a626bb477d92b0d46164d30399e12e2ac09 (diff)
parent226bb6ad1f524b3556f3fc2be83a6093875e50f0 (diff)
Merge branch 'next' of gnuradio.org:gnuradio into next
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r--gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py156
-rwxr-xr-xgnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor24
2 files changed, 159 insertions, 21 deletions
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
index f33160aca2..e2844b8bad 100644
--- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -46,9 +46,7 @@ class GrDataPlotterC(gr.top_block):
self.thr = gr.throttle(gr.sizeof_gr_complex, rate)
self.snk = qtgui.time_sink_c(self._npts, samp_rate,
self._name, 1)
-
- if(pmin is not None or not pmax is None):
- self.snk.set_y_axis(pmin, pmax)
+ self.snk.enable_autoscale(True)
self.connect(self.src, self.thr, (self.snk, 0))
@@ -121,9 +119,7 @@ class GrDataPlotterF(gr.top_block):
self.thr = gr.throttle(gr.sizeof_float, rate)
self.snk = qtgui.time_sink_f(self._npts, samp_rate,
self._name, 1)
-
- if(pmin is not None or not pmax is None):
- self.snk.set_y_axis(pmin, pmax)
+ self.snk.enable_autoscale(True)
self.connect(self.src, self.thr, (self.snk, 0))
@@ -191,10 +187,7 @@ class GrDataPlotterConst(gr.top_block):
self.thr = gr.throttle(gr.sizeof_gr_complex, rate)
self.snk = qtgui.const_sink_c(self._npts,
self._name, 1)
-
- if(pmin is not None or not pmax is None):
- self.snk.set_x_axis(pmin, pmax)
- self.snk.set_y_axis(pmin, pmax)
+ self.snk.enable_autoscale(True)
self.connect(self.src, self.thr, (self.snk, 0))
@@ -268,9 +261,7 @@ class GrDataPlotterPsdC(gr.top_block):
self.snk = qtgui.freq_sink_c(self._fftsize, self._wintype,
self._fc, self._samp_rate,
self._name, 1)
-
- if(pmin is not None or not pmax is None):
- self.snk.set_y_axis(pmin, pmax)
+ self.snk.enable_autoscale(True)
self.connect(self.src, self.thr, (self.snk, 0))
@@ -343,9 +334,7 @@ class GrDataPlotterPsdF(gr.top_block):
self.snk = qtgui.freq_sink_f(self._fftsize, self._wintype,
self._fc, self._samp_rate,
self._name, 1)
-
- if(pmin is not None or not pmax is None):
- self.snk.set_y_axis(pmin, pmax)
+ self.snk.enable_autoscale(True)
self.connect(self.src, self.thr, (self.snk, 0))
@@ -401,6 +390,141 @@ class GrDataPlotterPsdF(gr.top_block):
self.src.set_data(self._last_data)
+class GrTimeRasterF(gr.top_block):
+ def __init__(self, name, rate, pmin=None, pmax=None):
+ gr.top_block.__init__(self)
+
+ self._name = name
+ self._npts = 100
+ self._rows = 100
+ samp_rate = 1.0
+
+ self._last_data = self._npts*[0,]
+ self._data_len = 0
+
+ self.src = gr.vector_source_f([])
+ self.thr = gr.throttle(gr.sizeof_float, rate)
+ self.snk = qtgui.time_raster_sink_f(samp_rate, self._npts, self._rows,
+ [], [], self._name, 1)
+
+ self.connect(self.src, self.thr, (self.snk, 0))
+
+ self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+
+ def __del__(self):
+ pass
+
+ def qwidget(self):
+ return self.py_window
+
+ def name(self):
+ return self._name
+
+ def update(self, data):
+ # Ask GUI if there has been a change in nsamps
+ npts = int(self.snk.num_cols())
+ if(self._npts != npts):
+
+ # Adjust buffers to accomodate new settings
+ if(npts < self._npts):
+ if(self._data_len < npts):
+ self._last_data = self._last_data[0:npts]
+ else:
+ self._last_data = self._last_data[self._data_len-npts:self._data_len]
+ self._data_len = npts
+ else:
+ self._last_data += (npts - self._npts)*[0,]
+ self._npts = npts
+ self.snk.reset()
+
+ # Update the plot data depending on type
+ if(type(data) == list):
+ if(len(data) > self._npts):
+ self.src.set_data(data)
+ self._last_data = data[-self._npts:]
+ else:
+ newdata = self._last_data[-(self._npts-len(data)):]
+ newdata += data
+ self.src.set_data(newdata)
+ self._last_data = newdata
+
+ else: # single value update
+ if(self._data_len < self._npts):
+ self._last_data[self._data_len] = data
+ self._data_len += 1
+ else:
+ self._last_data = self._last_data[1:]
+ self._last_data.append(data)
+ self.src.set_data(self._last_data)
+
+class GrTimeRasterB(gr.top_block):
+ def __init__(self, name, rate, pmin=None, pmax=None):
+ gr.top_block.__init__(self)
+
+ self._name = name
+ self._npts = 100
+ self._rows = 100
+ samp_rate = 1.0
+
+ self._last_data = self._npts*[0,]
+ self._data_len = 0
+
+ self.src = gr.vector_source_b([])
+ self.thr = gr.throttle(gr.sizeof_char, rate)
+ self.snk = qtgui.time_raster_sink_b(samp_rate, self._npts, self._rows,
+ [], [], self._name, 1)
+
+ self.connect(self.src, self.thr, (self.snk, 0))
+
+ self.py_window = sip.wrapinstance(self.snk.pyqwidget(), QtGui.QWidget)
+
+ def __del__(self):
+ pass
+
+ def qwidget(self):
+ return self.py_window
+
+ def name(self):
+ return self._name
+
+ def update(self, data):
+ # Ask GUI if there has been a change in nsamps
+ npts = self.snk.num_cols()
+ if(self._npts != npts):
+
+ # Adjust buffers to accomodate new settings
+ if(npts < self._npts):
+ if(self._data_len < npts):
+ self._last_data = self._last_data[0:npts]
+ else:
+ self._last_data = self._last_data[self._data_len-npts:self._data_len]
+ self._data_len = npts
+ else:
+ self._last_data += (npts - self._npts)*[0,]
+ self._npts = npts
+ self.snk.reset()
+
+ # Update the plot data depending on type
+ if(type(data) == list):
+ if(len(data) > self._npts):
+ self.src.set_data(data)
+ self._last_data = data[-self._npts:]
+ else:
+ newdata = self._last_data[-(self._npts-len(data)):]
+ newdata += data
+ self.src.set_data(newdata)
+ self._last_data = newdata
+
+ else: # single value update
+ if(self._data_len < self._npts):
+ self._last_data[self._data_len] = data
+ self._data_len += 1
+ else:
+ self._last_data = self._last_data[1:]
+ self._last_data.append(data)
+ self.src.set_data(self._last_data)
+
+
class GrDataPlotterValueTable:
def __init__(self, uid, parent, x, y, xsize, ysize,
headers=['Statistic Key ( Source Block :: Stat Name ) ',
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
index b51888527b..ec31be209f 100755
--- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
@@ -133,6 +133,12 @@ class MAINWindow(QtGui.QMainWindow):
def newPlotterPsdCProxy():
self.newPlotPsdC(key, uid, title)
+ def newPlotterRasterFProxy():
+ self.newPlotRasterF(key, uid, title, pmin, pmax)
+
+ def newPlotterRasterBProxy():
+ self.newPlotRasterB(key, uid, title, pmin, pmax)
+
menu = QtGui.QMenu(self)
menu.setTitle("Item Actions")
menu.setTearOffEnabled(False)
@@ -140,14 +146,14 @@ class MAINWindow(QtGui.QMainWindow):
# object properties
menu.addAction("Properties", newUpdaterProxy)
- # displays available if not complex
+ # displays available
menu.addAction("Plot Time", newPlotterFProxy)
- menu.addAction("Plot PSD", newPlotterPsdFProxy)
-
- # displays available if complex
menu.addAction("Plot Time (cpx)", newPlotterCProxy)
- menu.addAction("Plot Constellation", newPlotterConstProxy)
+ menu.addAction("Plot PSD", newPlotterPsdFProxy)
menu.addAction("Plot PSD cpx", newPlotterPsdCProxy)
+ menu.addAction("Plot Constellation", newPlotterConstProxy)
+ menu.addAction("Plot Raster (real)", newPlotterRasterFProxy)
+ #menu.addAction("Plot Raster (bits)", newPlotterRasterBProxy)
menu.popup(QtGui.QCursor.pos())
@@ -222,6 +228,14 @@ class MAINWindow(QtGui.QMainWindow):
plot = GrDataPlotterPsdC(tag, 32e6, pmin, pmax)
self.createPlot(plot, uid, title)
+ def newPlotRasterF(self, tag, uid, title="", pmin=None, pmax=None):
+ plot = GrTimeRasterF(tag, 32e6, pmin, pmax)
+ self.createPlot(plot, uid, title)
+
+ def newPlotRasterB(self, tag, uid, title="", pmin=None, pmax=None):
+ plot = GrTimeRasterB(tag, 32e6, pmin, pmax)
+ self.createPlot(plot, uid, title)
+
def update(self, knobs, uid):
#sys.stderr.write("KNOB KEYS: {0}\n".format(knobs.keys()))
for plot in self.plots[uid]: