summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrennan Ashton <bashton@brennanashton.com>2018-11-15 16:27:44 -0800
committerMartin Braun <martin.braun@ettus.com>2018-11-22 11:09:00 -0800
commit745b2b2d34cff22468ea9a4a785e82d3398dc4e6 (patch)
treeab34aaca154581a37c9d50c636a69cd10a6d7cf1
parent2e8f3ad85e13045fcaf81368fb9372735c503e68 (diff)
gr-utils: Condense gr_plot commands and fix datatype arg
This removes all the gr_plot_* applications save for: - gr_plot (time-domain) - gr_plot_fft (FFT domain) - gr_plot_psd (Power Spectrum Density)
-rw-r--r--gr-utils/python/utils/CMakeLists.txt9
-rw-r--r--gr-utils/python/utils/README.plot45
-rwxr-xr-xgr-utils/python/utils/gr_plot (renamed from gr-utils/python/utils/gr_plot_fft_f)14
-rwxr-xr-xgr-utils/python/utils/gr_plot_char53
-rw-r--r--gr-utils/python/utils/gr_plot_fft2
-rwxr-xr-xgr-utils/python/utils/gr_plot_fft_c43
-rwxr-xr-xgr-utils/python/utils/gr_plot_float53
-rwxr-xr-xgr-utils/python/utils/gr_plot_int51
-rw-r--r--gr-utils/python/utils/gr_plot_psd2
-rwxr-xr-xgr-utils/python/utils/gr_plot_psd_c44
-rwxr-xr-xgr-utils/python/utils/gr_plot_psd_f44
-rwxr-xr-xgr-utils/python/utils/gr_plot_short53
-rw-r--r--gr-utils/python/utils/plot_data.py42
-rw-r--r--gr-utils/python/utils/plot_fft_base.py10
-rw-r--r--gr-utils/python/utils/plot_psd_base.py10
15 files changed, 67 insertions, 408 deletions
diff --git a/gr-utils/python/utils/CMakeLists.txt b/gr-utils/python/utils/CMakeLists.txt
index 3ce335c4ed..ac2f4b4174 100644
--- a/gr-utils/python/utils/CMakeLists.txt
+++ b/gr-utils/python/utils/CMakeLists.txt
@@ -35,18 +35,11 @@ GR_PYTHON_INSTALL(
GR_PYTHON_INSTALL(
PROGRAMS
gr_modtool
- gr_plot_char
+ gr_plot
gr_plot_const
gr_plot_fft
- gr_plot_fft_c
- gr_plot_fft_f
gr_plot_psd
- gr_plot_psd_c
- gr_plot_psd_f
- gr_plot_float
- gr_plot_int
gr_plot_iq
- gr_plot_short
gr_plot_qt
gr_read_file_metadata
DESTINATION ${GR_RUNTIME_DIR}
diff --git a/gr-utils/python/utils/README.plot b/gr-utils/python/utils/README.plot
index 60f14c669c..1b1cdf1fcb 100644
--- a/gr-utils/python/utils/README.plot
+++ b/gr-utils/python/utils/README.plot
@@ -4,10 +4,10 @@ analysis of files produced by GNU Radio flow graphs. Most of them work
off complex data produced by digital waveforms.
-** gr_plot_float:
-Takes a GNU Radio floating point 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.
+** gr_plot:
+Takes a GNU Radio 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,
@@ -41,43 +41,6 @@ capturing the samples.
-** gr_plot_fft_c:
-Takes a GNU Radio complex binary file and displays the I&Q data versus
-time as well as the frequency domain (FFT) plot. The y-axis values are
-plotted assuming volts as the amplitude of the I&Q streams and
-converted into dBm in the frequency domain (the 1/N power adjustment
-out of the FFT is performed internally).
-
-The script plots a certain block of data at a time, specified on the
-command line as -B or --block. This value defaults to 1000. The start
-position in the file can be set by specifying -s or --start and
-defaults to 0 (the start of 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 and
-frequency axis, set the sample rate (-R or --sample-rate) to the
-sample rate used when capturing the samples.
-
-
-
-** gr_plot_fft_f:
-Takes a GNU Radio floating point binary file and displays the samples
-versus time as well as the frequency domain (FFT) plot. The y-axis
-values are plotted assuming volts as the amplitude of the I&Q streams
-and converted into dBm in the frequency domain (the 1/N power
-adjustment out of the FFT is performed internally).
-
-The script plots a certain block of data at a time, specified on the
-command line as -B or --block. This value defaults to 1000. The start
-position in the file can be set by specifying -s or --start and
-defaults to 0 (the start of 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 and
-frequency axis, set the sample rate (-R or --sample-rate) to the
-sample rate used when capturing the samples.
-
-
** gr_plot_fft:
Takes a GNU Radio binary file (the datatype is specified using the -d
option and defaults to complex64) and displays the samples versus time
diff --git a/gr-utils/python/utils/gr_plot_fft_f b/gr-utils/python/utils/gr_plot
index d1791419bb..67ea941d76 100755
--- a/gr-utils/python/utils/gr_plot_fft_f
+++ b/gr-utils/python/utils/gr_plot
@@ -20,17 +20,15 @@
# Boston, MA 02110-1301, USA.
#
-from gnuradio.plot_fft_base import plot_fft_base
+from __future__ import print_function
+
+from gnuradio.plot_data import plot_data
-# This is a wrapper program for plot_fft_base specifically for float data
def main():
- parser = plot_fft_base.setup_options()
- parser.add_argument("-d", "--data-type", default="float32",
- choices=("float32", ))
+ parser = plot_data.setup_options()
args = parser.parse_args()
-
- dc = plot_fft_base("float32", args.file, args)
+ plot_data(None, args.files, args)
if __name__ == "__main__":
try:
@@ -38,5 +36,3 @@ if __name__ == "__main__":
except KeyboardInterrupt:
pass
-
-
diff --git a/gr-utils/python/utils/gr_plot_char b/gr-utils/python/utils/gr_plot_char
deleted file mode 100755
index dd6803abfd..0000000000
--- a/gr-utils/python/utils/gr_plot_char
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from __future__ import print_function
-
-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."
-
- parser = ArgumentParser(conflict_handler="resolve", description=description)
- parser.add_argument("-B", "--block", type=int, default=1000,
- help="Specify the block size [default=%(default)r]")
- parser.add_argument("-s", "--start", type=int, default=0,
- help="Specify where to start in the file [default=%(default)r]")
- parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
- help="Set the sampler rate of the data [default=%(default)r]")
- parser.add_argument("files", metavar="FILE", nargs="+",
- help="Input file with complex samples")
-
- args = parser.parse_args()
-
- datatype = numpy.int8
- dc = plot_data(datatype, args.files, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gr-utils/python/utils/gr_plot_fft b/gr-utils/python/utils/gr_plot_fft
index 59fc88b994..92a0b2501a 100644
--- a/gr-utils/python/utils/gr_plot_fft
+++ b/gr-utils/python/utils/gr_plot_fft
@@ -29,7 +29,7 @@ def main():
parser = plot_fft_base.setup_options()
args = parser.parse_args()
- dc = plot_fft_base(args.data_type, args.file, args)
+ plot_fft_base(None, args.file, args)
if __name__ == "__main__":
try:
diff --git a/gr-utils/python/utils/gr_plot_fft_c b/gr-utils/python/utils/gr_plot_fft_c
deleted file mode 100755
index 48d3218586..0000000000
--- a/gr-utils/python/utils/gr_plot_fft_c
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from gnuradio.plot_fft_base import plot_fft_base
-
-# This is a wrapper program for plot_fft_base specifically for complex data
-
-def main():
- parser = plot_fft_base.setup_options()
- parser.add_argument("-d", "--data-type", default="complex64",
- choices=("complex64", ))
-
- args = parser.parse_args()
-
- dc = plot_fft_base("complex64", args.file, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
-
-
diff --git a/gr-utils/python/utils/gr_plot_float b/gr-utils/python/utils/gr_plot_float
deleted file mode 100755
index d1f2621eb4..0000000000
--- a/gr-utils/python/utils/gr_plot_float
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from __future__ import print_function
-
-import numpy
-
-from argparse import ArgumentParser
-from gnuradio.plot_data import plot_data
-
-def main():
- description = "Takes a GNU Radio floating point 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."
-
- parser = ArgumentParser(conflict_handler="resolve", description=description)
- parser.add_argument("-B", "--block", type=int, default=1000,
- help="Specify the block size [default=%(default)r]")
- parser.add_argument("-s", "--start", type=int, default=0,
- help="Specify where to start in the file [default=%(default)r]")
- parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
- help="Set the sampler rate of the data [default=%(default)r]")
- parser.add_argument("file", metavar="FILE", nargs='+',
- help="Input file with samples")
-
- args = parser.parse_args()
-
- datatype=numpy.float32
- dc = plot_data(datatype, args.file, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gr-utils/python/utils/gr_plot_int b/gr-utils/python/utils/gr_plot_int
deleted file mode 100755
index aefabcda63..0000000000
--- a/gr-utils/python/utils/gr_plot_int
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-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."
-
- parser = ArgumentParser(conflict_handler="resolve", description=description)
- parser.add_argument("-B", "--block", type=int, default=1000,
- help="Specify the block size [default=%(default)r]")
- parser.add_argument("-s", "--start", type=int, default=0,
- help="Specify where to start in the file [default=%(default)r]")
- parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
- help="Set the sampler rate of the data [default=%(default)r]")
- parser.add_argument("file", metavar="FILE", nargs='+',
- help="Input file");
-
- args = parser.parse_args()
-
- datatype=numpy.int32
- dc = plot_data(datatype, args.file, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gr-utils/python/utils/gr_plot_psd b/gr-utils/python/utils/gr_plot_psd
index b052cbfdd7..891a940684 100644
--- a/gr-utils/python/utils/gr_plot_psd
+++ b/gr-utils/python/utils/gr_plot_psd
@@ -29,7 +29,7 @@ def main():
parser = plot_psd_base.setup_options()
args = parser.parse_args()
- dc = plot_psd_base(args.data_type, args.file, args)
+ plot_psd_base(None, args.file, args)
if __name__ == "__main__":
try:
diff --git a/gr-utils/python/utils/gr_plot_psd_c b/gr-utils/python/utils/gr_plot_psd_c
deleted file mode 100755
index 352a838138..0000000000
--- a/gr-utils/python/utils/gr_plot_psd_c
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from argparse import ArgumentParser
-from gnuradio.plot_psd_base import plot_psd_base
-
-# This is a wrapper program for plot_psd_base specifically for complex data
-
-def main():
- parser = plot_psd_base.setup_options()
- parser.add_argument("-d", "--data-type", default="complex64",
- choices=("complex64", ))
-
- args = parser.parse_args()
-
- dc = plot_psd_base("complex64", args.file, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
-
-
diff --git a/gr-utils/python/utils/gr_plot_psd_f b/gr-utils/python/utils/gr_plot_psd_f
deleted file mode 100755
index ab860e3fb8..0000000000
--- a/gr-utils/python/utils/gr_plot_psd_f
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from argparse import ArgumentParser
-from gnuradio.plot_psd_base import plot_psd_base
-
-# This is a wrapper program for gr_plot_psd specifically for floating point data
-
-def main():
- parser = plot_psd_base.setup_options()
- parser.add_argument("-d", "--data-type", default="complex64",
- choices=("float32", ))
-
- args = parser.parse_args()
-
- dc = plot_psd_base("float32", args.file, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
-
-
diff --git a/gr-utils/python/utils/gr_plot_short b/gr-utils/python/utils/gr_plot_short
deleted file mode 100755
index 119c7b73be..0000000000
--- a/gr-utils/python/utils/gr_plot_short
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2007,2008 Free Software Foundation, Inc.
-#
-# This file is part of GNU Radio
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNU Radio; see the file COPYING. If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street,
-# Boston, MA 02110-1301, USA.
-#
-
-from __future__ import print_function
-
-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."
-
- parser = ArgumentParser(conflict_handler="resolve", description=description)
- parser.add_argument("-B", "--block", type=int, default=1000,
- help="Specify the block size [default=%(default)r]")
- parser.add_argument("-s", "--start", type=int, default=0,
- help="Specify where to start in the file [default=%(default)r]")
- parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
- help="Set the sampler rate of the data [default=%(default)r]")
- parser.add_argument("files", metavar="FILE", nargs="+",
- help="Input file with data (int16_t)")
-
- args = parser.parse_args()
-
- datatype=numpy.int16
- dc = plot_data(datatype, args.files, args)
-
-if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- pass
-
diff --git a/gr-utils/python/utils/plot_data.py b/gr-utils/python/utils/plot_data.py
index dc9346c484..7eed7b5b6e 100644
--- a/gr-utils/python/utils/plot_data.py
+++ b/gr-utils/python/utils/plot_data.py
@@ -26,8 +26,28 @@ from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
+from argparse import ArgumentParser
+
import numpy
+try:
+ from pylab import Button, connect, draw, figure, figtext, get_current_fig_manager, show, plot, rcParams
+except ImportError:
+ print("Please install Python Matplotlib (http://matplotlib.sourceforge.net/) and Python TkInter https://wiki.python.org/moin/TkInter to run this script")
+ raise SystemExit(1)
+
+
+datatype_lookup = {
+ "complex64": numpy.complex64,
+ "float32": numpy.float32,
+ "uint32": numpy.uint32,
+ "int32": numpy.int32,
+ "uint16": numpy.uint16,
+ "int16": numpy.int16,
+ "uint8": numpy.uint8,
+ "int8": numpy.int8,
+}
+
class plot_data(object):
def __init__(self, datatype, filenames, options):
self.hfile = list()
@@ -41,7 +61,9 @@ class plot_data(object):
self.sample_rate = options.sample_rate
self.datatype = datatype
- self.sizeof_data = datatype().nbytes # number of bytes per sample in file
+ if self.datatype is None:
+ self.datatype = datatype_lookup[options.data_type]
+ self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
self.axis_font_size = 16
self.label_font_size = 18
@@ -152,6 +174,24 @@ class plot_data(object):
hf.seek(-hf.tell(),1)
self.update_plots()
+ @staticmethod
+ def setup_options():
+ description = "Takes a GNU Radio 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."
+
+ parser = ArgumentParser(conflict_handler="resolve", description=description)
+ parser.add_argument("-d", "--data-type", default="complex64",
+ choices=("complex64", "float32", "uint32", "int32", "uint16",
+ "int16", "uint8", "int8"),
+ help="Specify the data type [default=%(default)r]")
+ parser.add_argument("-B", "--block", type=int, default=1000,
+ help="Specify the block size [default=%(default)r]")
+ parser.add_argument("-s", "--start", type=int, default=0,
+ help="Specify where to start in the file [default=%(default)r]")
+ parser.add_argument("-R", "--sample-rate", type=float, default=1.0,
+ help="Set the sampler rate of the data [default=%(default)r]")
+ parser.add_argument("files", metavar="FILE", nargs='+',
+ help="Input file with samples")
+ return parser
def find(item_in, list_search):
try:
diff --git a/gr-utils/python/utils/plot_fft_base.py b/gr-utils/python/utils/plot_fft_base.py
index 1b6eb72910..56037e5330 100644
--- a/gr-utils/python/utils/plot_fft_base.py
+++ b/gr-utils/python/utils/plot_fft_base.py
@@ -28,12 +28,14 @@ import numpy
from numpy.fft import fftpack
try:
- from pylab import *
+ from pylab import Button, connect, draw, figure, figtext, get_current_fig_manager, show, rcParams, ceil
except ImportError:
print("Please install Python Matplotlib (http://matplotlib.sourceforge.net/) and Python TkInter https://wiki.python.org/moin/TkInter to run this script")
raise SystemExit(1)
from argparse import ArgumentParser
+from gnuradio.plot_data import datatype_lookup
+
class plot_fft_base(object):
def __init__(self, datatype, filename, options):
@@ -42,7 +44,9 @@ class plot_fft_base(object):
self.start = options.start
self.sample_rate = options.sample_rate
- self.datatype = numpy.complex64
+ self.datatype = datatype
+ if self.datatype is None:
+ self.datatype = datatype_lookup[options.data_type]
self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
self.axis_font_size = 16
@@ -236,7 +240,7 @@ def main():
parser = plot_fft_base.setup_options()
args = parser.parse_args()
- dc = plot_fft_base(args.data_type, args.file, args)
+ plot_fft_base(None, args.file, args)
if __name__ == "__main__":
try:
diff --git a/gr-utils/python/utils/plot_psd_base.py b/gr-utils/python/utils/plot_psd_base.py
index eb9a5a6431..8995a90a38 100644
--- a/gr-utils/python/utils/plot_psd_base.py
+++ b/gr-utils/python/utils/plot_psd_base.py
@@ -26,13 +26,15 @@ from __future__ import unicode_literals
import numpy
try:
- from pylab import *
+ from pylab import Button, connect, draw, figure, figtext, get_current_fig_manager, mlab, show, rcParams, ceil
except ImportError:
print("Please install Matplotlib to run this script (http://matplotlib.sourceforge.net/)")
raise SystemExit(1)
from argparse import ArgumentParser
from gnuradio.eng_arg import eng_float, intx
+from gnuradio.plot_data import datatype_lookup
+
class plot_psd_base(object):
def __init__(self, datatype, filename, options):
@@ -45,7 +47,9 @@ class plot_psd_base(object):
self.dospec = options.enable_spec # if we want to plot the spectrogram
- self.datatype = numpy.complex64
+ self.datatype = datatype
+ if self.datatype is None:
+ self.datatype = datatype_lookup[options.data_type]
self.sizeof_data = self.datatype().nbytes # number of bytes per sample in file
self.axis_font_size = 16
@@ -275,7 +279,7 @@ def main():
parser = plot_psd_base.setup_options()
args = parser.parse_args()
- dc = plot_psd_base(args.data_type, args.file, args)
+ plot_psd_base(None, args.file, args)
if __name__ == "__main__":
try: