diff options
author | Marcus Müller <marcus@hostalia.de> | 2018-08-25 01:23:10 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-11-02 22:15:53 +0100 |
commit | 65a3df1665a8286c82307828891577613a37d70a (patch) | |
tree | 510634e8f453a6cbf4f5287897ab7c09d5a7ef4c | |
parent | 990de8eed1bf7d4d1a7e9e453b32906ca2860949 (diff) |
remove completely unused scipy from gr-util plot apps
-rwxr-xr-x | gr-utils/python/utils/gr_plot_char | 10 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_const | 22 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_float | 8 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_int | 10 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_iq | 16 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_qt | 20 | ||||
-rwxr-xr-x | gr-utils/python/utils/gr_plot_short | 10 |
7 files changed, 33 insertions, 63 deletions
diff --git a/gr-utils/python/utils/gr_plot_char b/gr-utils/python/utils/gr_plot_char index 3199919fa9..dd6803abfd 100755 --- a/gr-utils/python/utils/gr_plot_char +++ b/gr-utils/python/utils/gr_plot_char @@ -22,15 +22,11 @@ from __future__ import print_function -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) - from argparse import ArgumentParser from gnuradio.plot_data import plot_data +import numpy + def main(): description = "Takes a GNU Radio byte/char binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." @@ -46,7 +42,7 @@ def main(): args = parser.parse_args() - datatype = scipy.int8 + datatype = numpy.int8 dc = plot_data(datatype, args.files, args) if __name__ == "__main__": diff --git a/gr-utils/python/utils/gr_plot_const b/gr-utils/python/utils/gr_plot_const index 2ec54c3585..6d0484391e 100755 --- a/gr-utils/python/utils/gr_plot_const +++ b/gr-utils/python/utils/gr_plot_const @@ -22,11 +22,7 @@ from __future__ import print_function -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) +import numpy try: from pylab import * @@ -44,7 +40,7 @@ class draw_constellation: self.start = options.start self.sample_rate = options.sample_rate - self.datatype = scipy.complex64 + self.datatype = numpy.complex64 self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file self.axis_font_size = 16 @@ -83,17 +79,17 @@ class draw_constellation: def get_data(self): self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data)) try: - iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") else: - # retesting length here as newer version of scipy does not throw a MemoryError, just + # retesting length here as newer version of numpy does not throw a MemoryError, just # returns a zero-length array if(len(iq) > 0): - self.reals = scipy.array([r.real for r in iq]) - self.imags = scipy.array([i.imag for i in iq]) + self.reals = numpy.array([r.real for r in iq]) + self.imags = numpy.array([i.imag for i in iq]) - self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) + self.time = numpy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) return True else: print("End of File") @@ -145,8 +141,8 @@ class draw_constellation: draw() def zoom(self, event): - newxlim = scipy.array(self.sp_iq.get_xlim()) - curxlim = scipy.array(self.xlim) + newxlim = numpy.array(self.sp_iq.get_xlim()) + curxlim = numpy.array(self.xlim) if(newxlim[0] != curxlim[0] or newxlim[1] != curxlim[1]): self.xlim = newxlim r = self.reals[int(ceil(self.xlim[0])) : int(ceil(self.xlim[1]))] diff --git a/gr-utils/python/utils/gr_plot_float b/gr-utils/python/utils/gr_plot_float index 4fd86549e2..d1f2621eb4 100755 --- a/gr-utils/python/utils/gr_plot_float +++ b/gr-utils/python/utils/gr_plot_float @@ -22,11 +22,7 @@ from __future__ import print_function -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) +import numpy from argparse import ArgumentParser from gnuradio.plot_data import plot_data @@ -46,7 +42,7 @@ def main(): args = parser.parse_args() - datatype=scipy.float32 + datatype=numpy.float32 dc = plot_data(datatype, args.file, args) if __name__ == "__main__": diff --git a/gr-utils/python/utils/gr_plot_int b/gr-utils/python/utils/gr_plot_int index b4051fa15f..aefabcda63 100755 --- a/gr-utils/python/utils/gr_plot_int +++ b/gr-utils/python/utils/gr_plot_int @@ -20,15 +20,11 @@ # Boston, MA 02110-1301, USA. # -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) - from argparse import ArgumentParser from gnuradio.plot_data import plot_data +import numpy + def main(): description = "Takes a GNU Radio integer binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." @@ -44,7 +40,7 @@ def main(): args = parser.parse_args() - datatype=scipy.int32 + datatype=numpy.int32 dc = plot_data(datatype, args.file, args) if __name__ == "__main__": diff --git a/gr-utils/python/utils/gr_plot_iq b/gr-utils/python/utils/gr_plot_iq index f27f75d412..b767ae632f 100755 --- a/gr-utils/python/utils/gr_plot_iq +++ b/gr-utils/python/utils/gr_plot_iq @@ -22,11 +22,7 @@ from __future__ import print_function -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) +import numpy try: from pylab import * @@ -43,7 +39,7 @@ class draw_iq: self.start = options.start self.sample_rate = options.sample_rate - self.datatype = scipy.complex64 + self.datatype = numpy.complex64 self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file self.axis_font_size = 16 @@ -81,13 +77,13 @@ class draw_iq: def get_data(self): self.text_file_pos.set_text("File Position: %d" % (self.hfile.tell()//self.sizeof_data)) try: - self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) + self.iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length) except MemoryError: print("End of File") else: - self.reals = scipy.array([r.real for r in self.iq]) - self.imags = scipy.array([i.imag for i in self.iq]) - self.time = scipy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) + self.reals = numpy.array([r.real for r in self.iq]) + self.imags = numpy.array([i.imag for i in self.iq]) + self.time = numpy.array([i*(1/self.sample_rate) for i in range(len(self.reals))]) def make_plots(self): # if specified on the command-line, set file pointer diff --git a/gr-utils/python/utils/gr_plot_qt b/gr-utils/python/utils/gr_plot_qt index 854ecc53b8..6a23e2b7af 100755 --- a/gr-utils/python/utils/gr_plot_qt +++ b/gr-utils/python/utils/gr_plot_qt @@ -1,11 +1,5 @@ #!/usr/bin/env python - -try: - import scipy - from scipy import fftpack -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) +import numpy try: from matplotlib import mlab @@ -42,7 +36,7 @@ class SpectrogramData(Qwt.QwtRasterData): def __init__(self, f, t): Qwt.QwtArrayData.__init__(self, Qt.QRectF(0, 0, 0, 0)) - self.sp = scipy.array([[0], [0]]) + self.sp = numpy.array([[0], [0]]) def set_data(self, xfreq, ytime, data): self.sp = data @@ -84,9 +78,9 @@ class gr_plot_qt(QtGui.QMainWindow): self.sample_rate = options.sample_rate self.psdfftsize = options.psd_size self.specfftsize = options.spec_size - self.winfunc = scipy.blackman + self.winfunc = numpy.blackman self.sizeof_data = 8 - self.datatype = scipy.complex64 + self.datatype = numpy.complex64 self.pen_width = 1 self.iq = list() self.time = list() @@ -328,7 +322,7 @@ class gr_plot_qt(QtGui.QMainWindow): self.hfile.seek(start*self.sizeof_data, os.SEEK_SET) self.position = start try: - iq = scipy.fromfile(self.hfile, dtype=self.datatype, + iq = numpy.fromfile(self.hfile, dtype=self.datatype, count=end-start) if(len(iq) < (end-start)): @@ -355,7 +349,7 @@ class gr_plot_qt(QtGui.QMainWindow): window=winpoints, scale_by_freq=False) - self.iq_psd = 10.0*scipy.log10(abs(fftpack.fftshift(iq_psd))) + self.iq_psd = 10.0*numpy.log10(abs(numpy.fft.fftshift(iq_psd))) self.freq = freq - self.sample_rate/2.0 def get_specgram(self): @@ -366,7 +360,7 @@ class gr_plot_qt(QtGui.QMainWindow): window=winpoints, scale_by_freq=False) - self.iq_spec = 10.0*scipy.log10(abs(iq_spec)) + self.iq_spec = 10.0*numpy.log10(abs(iq_spec)) self.spec_f = f self.spec_t = t diff --git a/gr-utils/python/utils/gr_plot_short b/gr-utils/python/utils/gr_plot_short index d367ea381f..119c7b73be 100755 --- a/gr-utils/python/utils/gr_plot_short +++ b/gr-utils/python/utils/gr_plot_short @@ -22,15 +22,11 @@ from __future__ import print_function -try: - import scipy -except ImportError: - print("Please install SciPy to run this script (http://www.scipy.org/)") - raise SystemExit(1) - from argparse import ArgumentParser from gnuradio.plot_data import plot_data +import numpy + def main(): description = "Takes a GNU Radio short integer binary file and displays the samples versus time. You can set the block size to specify how many points to read in at a time and the start position in the file. By default, the system assumes a sample rate of 1, so in time, each sample is plotted versus the sample number. To set a true time axis, set the sample rate (-R or --sample-rate) to the sample rate used when capturing the samples." @@ -46,7 +42,7 @@ def main(): args = parser.parse_args() - datatype=scipy.int16 + datatype=numpy.int16 dc = plot_data(datatype, args.files, args) if __name__ == "__main__": |