summaryrefslogtreecommitdiff
path: root/gr-utils/python/utils/plot_data.py
diff options
context:
space:
mode:
authorAndrej Rode <mail@andrejro.de>2018-06-23 23:41:42 +0200
committerAndrej Rode <mail@andrejro.de>2018-06-24 00:03:35 +0200
commit167a6152bad060fc53dd29e0fa79ef83eff1be5b (patch)
treea01049672d9d7d1bf3d295ed96698a323941f8e8 /gr-utils/python/utils/plot_data.py
parent3c8e6008b092287246234001db7cf1a4038300da (diff)
parentfcd002b6ac82e1e0c1224e24506410ff0833e1aa (diff)
Merge branch 'python3_fix' into next
Manual merge conflict resolution has been applied to following conflicts: * Typos: * gnuradio-runtime/python/gnuradio/ctrlport/GrDataPlotter.py * gr-blocks/python/blocks/qa_wavfile.py * gr-filter/examples/gr_filtdes_api.py * grc/blocks/parameter.xml * gr-uhd/python/uhd/__init__.py * ValueError -> RuntimeError: * gr-blocks/python/blocks/qa_hier_block2.py * relative Imports & other Py3k: * gr-digital/python/digital/psk_constellations.py * gr-digital/python/digital/qam_constellations.py * gr-digital/python/digital/test_soft_decisions.py * gr-digital/python/digital/gfsk.py * SequenceCompleter: * gr-utils/python/modtool/modtool_add.py * gr-utils/python/modtool/modtool_rename.py * gr-utils/python/modtool/modtool_rm.py * Updated API on next: * gr-blocks/grc/blocks_file_source.xml * gr-blocks/python/blocks/qa_file_source_sink.py * gr-qtgui/grc/qtgui_time_sink_x.xml * GRC Py3k Updates: * grc/core/Block.py * grc/core/Constants.py * grc/core/Platform.py * grc/core/utils/odict.py * grc/gui/Actions.py * grc/gui/Block.py * grc/gui/Executor.py * grc/gui/Port.py
Diffstat (limited to 'gr-utils/python/utils/plot_data.py')
-rw-r--r--gr-utils/python/utils/plot_data.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/gr-utils/python/utils/plot_data.py b/gr-utils/python/utils/plot_data.py
index 7d80c714fe..a054147114 100644
--- a/gr-utils/python/utils/plot_data.py
+++ b/gr-utils/python/utils/plot_data.py
@@ -22,20 +22,24 @@
Utility to help plotting data from files.
"""
+from __future__ import print_function
+from __future__ import division
+from __future__ import unicode_literals
+
try:
import scipy
except ImportError:
- print "Please install SciPy to run this script (http://www.scipy.org/)"
- raise SystemExit, 1
+ print("Please install SciPy to run this script (http://www.scipy.org/)")
+ raise SystemExit(1)
try:
from pylab import *
except ImportError:
- print "Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)"
- raise SystemExit, 1
+ print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
+ raise SystemExit(1)
-class plot_data:
+class plot_data(object):
def __init__(self, datatype, filenames, options):
self.hfile = list()
self.legend_text = list()
@@ -86,10 +90,10 @@ class plot_data:
try:
f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
- print "End of File"
+ print("End of File")
else:
self.f = scipy.array(f)
- self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.f))])
+ self.time = scipy.array([i*(1 / self.sample_rate) for i in range(len(self.f))])
def make_plots(self):
self.sp_f = self.fig.add_subplot(2,1,1, position=[0.075, 0.2, 0.875, 0.6])
@@ -162,6 +166,6 @@ class plot_data:
def find(item_in, list_search):
try:
- return list_search.index(item_in) != None
+ return list_search.index(item_in) != None
except ValueError:
- return False
+ return False