summaryrefslogtreecommitdiff
path: root/gr-utils
diff options
context:
space:
mode:
Diffstat (limited to 'gr-utils')
-rw-r--r--gr-utils/src/python/Makefile.am2
-rwxr-xr-xgr-utils/src/python/gr_plot_psd.py20
2 files changed, 12 insertions, 10 deletions
diff --git a/gr-utils/src/python/Makefile.am b/gr-utils/src/python/Makefile.am
index 9c4e222c8..450032266 100644
--- a/gr-utils/src/python/Makefile.am
+++ b/gr-utils/src/python/Makefile.am
@@ -21,7 +21,7 @@
include $(top_srcdir)/Makefile.common
-EXTRA_DIST = \
+EXTRA_DIST += \
$(bin_SCRIPTS) \
README.plot \
pyqt_plot.ui \
diff --git a/gr-utils/src/python/gr_plot_psd.py b/gr-utils/src/python/gr_plot_psd.py
index e88995b72..3f90a7104 100755
--- a/gr-utils/src/python/gr_plot_psd.py
+++ b/gr-utils/src/python/gr_plot_psd.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2007,2008,2011 Free Software Foundation, Inc.
+# Copyright 2007,2008,2010,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -35,6 +35,7 @@ except ImportError:
from optparse import OptionParser
from scipy import log10
+from gnuradio.eng_option import eng_option
class gr_plot_psd:
def __init__(self, datatype, filename, options):
@@ -103,10 +104,10 @@ class gr_plot_psd:
''' Need to do this here and plot later so we can do the fftshift '''
overlap = self.psdfftsize/4
winfunc = scipy.blackman
- psd,freq = self.sp_psd.psd(iq, self.psdfftsize, self.sample_rate,
- window = lambda d: d*winfunc(self.psdfftsize),
- noverlap = overlap, visible=False)
- psd = 10.0*log10(abs(fftpack.fftshift(psd)))
+ psd,freq = mlab.psd(iq, self.psdfftsize, self.sample_rate,
+ window = lambda d: d*winfunc(self.psdfftsize),
+ noverlap = overlap)
+ psd = 10.0*log10(abs(psd))
return (psd, freq)
def make_plots(self):
@@ -192,8 +193,8 @@ class gr_plot_psd:
xmin = max(0, int(ceil(self.sample_rate*(newxlim[0]))))
xmax = min(int(ceil(self.sample_rate*(newxlim[1]))), len(self.iq))
- iq = self.iq[xmin : xmax]
- time = self.time[xmin : xmax]
+ iq = scipy.array(self.iq[xmin : xmax])
+ time = scipy.array(self.time[xmin : xmax])
iq_psd, freq = self.dopsd(iq)
@@ -241,14 +242,15 @@ def setup_options():
usage="%prog: [options] input_filename"
description = "Takes a GNU Radio binary file (with specified data type using --data-type) and displays the I&Q data versus time as well as the power spectral density (PSD) 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. 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. Finally, the size of the FFT to use for the PSD and spectrogram plots can be set independently with --psd-size and --spec-size, respectively. The spectrogram plot does not display by default and is turned on with -S or --enable-spec."
- parser = OptionParser(conflict_handler="resolve", usage=usage, description=description)
+ parser = OptionParser(option_class=eng_option, conflict_handler="resolve",
+ usage=usage, description=description)
parser.add_option("-d", "--data-type", type="string", default="complex64",
help="Specify the data type (complex64, float32, (u)int32, (u)int16, (u)int8) [default=%default]")
parser.add_option("-B", "--block", type="int", default=8192,
help="Specify the block size [default=%default]")
parser.add_option("-s", "--start", type="int", default=0,
help="Specify where to start in the file [default=%default]")
- parser.add_option("-R", "--sample-rate", type="float", default=1.0,
+ parser.add_option("-R", "--sample-rate", type="eng_float", default=1.0,
help="Set the sampler rate of the data [default=%default]")
parser.add_option("", "--psd-size", type="int", default=1024,
help="Set the size of the PSD FFT [default=%default]")