summaryrefslogtreecommitdiff
path: root/gr-utils/python/utils/plot_data.py
diff options
context:
space:
mode:
authorMarcus Müller <marcus@hostalia.de>2018-08-24 23:00:55 +0200
committerMarcus Müller <marcus@hostalia.de>2018-11-02 22:15:53 +0100
commit797994a11ac5ec6bee9ea01c092947d0c34115f1 (patch)
tree7381f53008ba56e6b93398fa92be482d12da4f43 /gr-utils/python/utils/plot_data.py
parente07751acc8424f4dd987f79c32dd247ed347902c (diff)
Replace scipy/pylab where numpy/pyplot is sufficient
This should reduce the number of times users are prompted to install pylab || scipy when they'd actually get away with functionality fully contained in numpy and matplotlib. This only solves the obvious cases. There's some usage of `pylab.mlab` that would need more than 20s of consideration.
Diffstat (limited to 'gr-utils/python/utils/plot_data.py')
-rw-r--r--gr-utils/python/utils/plot_data.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/gr-utils/python/utils/plot_data.py b/gr-utils/python/utils/plot_data.py
index a054147114..dc9346c484 100644
--- a/gr-utils/python/utils/plot_data.py
+++ b/gr-utils/python/utils/plot_data.py
@@ -26,18 +26,7 @@ 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)
-
-try:
- from pylab import *
-except ImportError:
- print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
- raise SystemExit(1)
-
+import numpy
class plot_data(object):
def __init__(self, datatype, filenames, options):
@@ -88,12 +77,12 @@ class plot_data(object):
def get_data(self, hfile):
self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data))
try:
- f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length)
+ f = numpy.fromfile(hfile, dtype=self.datatype, count=self.block_length)
except MemoryError:
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.f = numpy.array(f)
+ self.time = numpy.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])