summaryrefslogtreecommitdiff
path: root/gnuradio-core/src/python
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2013-02-20 17:33:05 -0500
committerTom Rondeau <trondeau@vt.edu>2013-02-20 18:36:45 -0500
commit844a6e15b34d8106752bbf3783b3eb8b65728cac (patch)
tree9af8e62eac7668ce950c7c555d0299499b491880 /gnuradio-core/src/python
parent11746e7de98462a6d6a9917e0500077ed063a1d7 (diff)
ctrlport: made display type in ControlPort setup field into an options mask.
Options are used to determine default plot type, type of plots available, initial states. qtgui: fixed enabling stem plot to properly check the menu option.
Diffstat (limited to 'gnuradio-core/src/python')
-rw-r--r--gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py12
-rwxr-xr-xgnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor78
-rwxr-xr-xgnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py4
3 files changed, 65 insertions, 29 deletions
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
index 1990e21aa4..27858b575b 100644
--- a/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/GrDataPlotter.py
@@ -68,6 +68,9 @@ class GrDataPlotterC(gr.top_block):
def semilogy(self, en=True):
self.snk.enable_semilogy(en)
+ def stem(self, en=True):
+ self.snk.enable_stem_plot(en)
+
def update(self, data):
# Ask GUI if there has been a change in nsamps
npts = self.snk.nsamps()
@@ -147,6 +150,9 @@ class GrDataPlotterF(gr.top_block):
def semilogy(self, en=True):
self.snk.enable_semilogy(en)
+ def stem(self, en=True):
+ self.snk.enable_stem_plot(en)
+
def update(self, data):
# Ask GUI if there has been a change in nsamps
npts = self.snk.nsamps()
@@ -219,6 +225,12 @@ class GrDataPlotterConst(gr.top_block):
def name(self):
return self._name
+ def scatter(self, en=True):
+ if(en):
+ self.snk.set_line_style(0, 0)
+ else:
+ self.snk.set_line_style(0, 1)
+
def update(self, data):
# Ask GUI if there has been a change in nsamps
npts = self.snk.nsamps()
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
index 4625a2d863..60a810b04e 100755
--- a/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/gr-ctrlport-monitor
@@ -115,17 +115,28 @@ class MAINWindow(QtGui.QMainWindow):
else:
pmax = 1.1*pmax
+ # Use display option mask of item to set up available plot
+ # types and default options.
+ disp = self.knobprops[uid][key].display
+ cplx = disp & gr.DISPOPTCPLX | disp & gr.DISPXY
+ strip = disp & gr.DISPOPTSTRIP
+ stem = disp & gr.DISPOPTSTEM
+ log = disp & gr.DISPOPTLOG
+ scatter = disp & gr.DISPOPTSCATTER
+
def newUpdaterProxy():
self.newUpdater(key, radio)
def newPlotterFProxy():
- self.newPlotF(key, uid, title, pmin, pmax)
+ self.newPlotF(key, uid, title, pmin, pmax,
+ log, strip, stem)
def newPlotterCProxy():
- self.newPlotC(key, uid, title, pmin, pmax)
+ self.newPlotC(key, uid, title, pmin, pmax,
+ log, strip, stem)
def newPlotterConstProxy():
- self.newPlotConst(key, uid, title, pmin, pmax)
+ self.newPlotConst(key, uid, title, pmin, pmax, scatter)
def newPlotterPsdFProxy():
self.newPlotPsdF(key, uid, title)
@@ -147,13 +158,15 @@ class MAINWindow(QtGui.QMainWindow):
menu.addAction("Properties", newUpdaterProxy)
# displays available
- menu.addAction("Plot Time", newPlotterFProxy)
- menu.addAction("Plot Time (cpx)", newPlotterCProxy)
- 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)
+ if(cplx == 0):
+ menu.addAction("Plot Time", newPlotterFProxy)
+ menu.addAction("Plot PSD", newPlotterPsdFProxy)
+ menu.addAction("Plot Raster (real)", newPlotterRasterFProxy)
+ #menu.addAction("Plot Raster (bits)", newPlotterRasterBProxy)
+ else:
+ menu.addAction("Plot Time", newPlotterCProxy)
+ menu.addAction("Plot PSD", newPlotterPsdCProxy)
+ menu.addAction("Plot Constellation", newPlotterConstProxy)
menu.popup(QtGui.QCursor.pos())
@@ -182,20 +195,27 @@ class MAINWindow(QtGui.QMainWindow):
else:
pmax = 1.1*pmax
- if(knobprop.display == GNURadio.DisplayType.DISPXYSCATTER):
- self.newPlotConst(tag, uid, title, pmin, pmax)
- elif(knobprop.display == GNURadio.DisplayType.DISPTIMESERIESF):
- self.newPlotF(tag, uid, title, pmin, pmax)
- elif(knobprop.display == GNURadio.DisplayType.DISPTIMESERIESC):
- self.newPlotC(tag, uid, title, pmin, pmax)
- elif(knobprop.display == GNURadio.DisplayType.DISPLOGTIMESERIESF):
- self.newPlotF(tag, uid, title, pmin, pmax, True)
- elif(knobprop.display == GNURadio.DisplayType.DISPLOGTIMESERIESC):
- self.newPlotC(tag, uid, title, pmin, pmax, True)
- elif(knobprop.display == GNURadio.DisplayType.DISPSTRIPCHARTF):
- self.newPlotC(tag, uid, title, pmin, pmax, False, True)
- elif(knobprop.display == GNURadio.DisplayType.DISPSTRIPCHARTC):
- self.newPlotC(tag, uid, title, pmin, pmax, False, True)
+ disp = knobprop.display
+ if(disp & gr.DISPTIME):
+ strip = disp & gr.DISPOPTSTRIP
+ stem = disp & gr.DISPOPTSTEM
+ log = disp & gr.DISPOPTLOG
+ if(disp & gr.DISPOPTCPLX == 0):
+ self.newPlotF(tag, uid, title, pmin, pmax,
+ log, strip, stem)
+ else:
+ self.newPlotC(tag, uid, title, pmin, pmax,
+ log, strip, stem)
+
+ elif(disp & gr.DISPXY):
+ scatter = disp & gr.DISPOPTSCATTER
+ self.newPlotConst(tag, uid, title, pmin, pmax, scatter)
+
+ elif(disp & gr.DISPPSD):
+ if(disp & gr.DISPOPTCPLX == 0):
+ self.newPlotPsdF(tag, uid, title)
+ else:
+ self.newPlotPsdC(tag, uid, title)
def createPlot(self, plot, uid, title):
plot.start()
@@ -216,20 +236,24 @@ class MAINWindow(QtGui.QMainWindow):
plots.remove(p)
break
- def newPlotConst(self, tag, uid, title="", pmin=None, pmax=None):
+ def newPlotConst(self, tag, uid, title="", pmin=None, pmax=None,
+ scatter=False):
plot = GrDataPlotterConst(tag, 32e6, pmin, pmax)
+ plot.scatter(scatter)
self.createPlot(plot, uid, title)
def newPlotF(self, tag, uid, title="", pmin=None, pmax=None,
- logy=False, stripchart=False):
+ logy=False, stripchart=False, stem=False):
plot = GrDataPlotterF(tag, 32e6, pmin, pmax, stripchart)
plot.semilogy(logy)
+ plot.stem(stem)
self.createPlot(plot, uid, title)
def newPlotC(self, tag, uid, title="", pmin=None, pmax=None,
- logy=False, stripchart=False):
+ logy=False, stripchart=False, stem=False):
plot = GrDataPlotterC(tag, 32e6, pmin, pmax, stripchart)
plot.semilogy(logy)
+ plot.stem(stem)
self.createPlot(plot, uid, title)
def newPlotPsdF(self, tag, uid, title="", pmin=None, pmax=None):
diff --git a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py
index a8b6de8c53..6de5d5fc9f 100755
--- a/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py
+++ b/gnuradio-core/src/python/gnuradio/ctrlport/qa_cpp_py_binding.py
@@ -98,12 +98,12 @@ class test_cpp_py_binding(gr_unittest.TestCase):
v5 = gr.RPC_get_vector_float("pyland", "fvec", "unit_5_float_vector",
"Python Exported Float Vector", [], [], [],
- gr.DISPTIMESERIESC)
+ gr.DISPTIME | gr.DISPOPTCPLX)
v5.activate(get5)
v6 = gr.RPC_get_vector_gr_complex("pyland", "cvec", "unit_6_gr_complex_vector",
"Python Exported Complex Vector", [], [], [],
- gr.DISPXYSCATTER)
+ gr.DISPXY | gr.DISPOPTSCATTER)
v6.activate(get6)
# print some variables locally