summaryrefslogtreecommitdiff
path: root/gr-utils
diff options
context:
space:
mode:
authorTom Rondeau2011-01-15 17:15:11 -0500
committerTom Rondeau2011-01-15 17:15:11 -0500
commit3ad8f8ed993cccae7492bf0fa8519ebe15567101 (patch)
tree784f649a2ce399d787c8ecfba0692d6bea5a3496 /gr-utils
parent9d306b27ceabfd0dd498acc2f2694bca08e4ed1f (diff)
downloadgnuradio-3ad8f8ed993cccae7492bf0fa8519ebe15567101.tar.gz
gnuradio-3ad8f8ed993cccae7492bf0fa8519ebe15567101.tar.bz2
gnuradio-3ad8f8ed993cccae7492bf0fa8519ebe15567101.zip
Fix how the end of a file is handled.
Diffstat (limited to 'gr-utils')
-rwxr-xr-xgr-utils/src/python/gr_plot_psd.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/gr-utils/src/python/gr_plot_psd.py b/gr-utils/src/python/gr_plot_psd.py
index 0e3dbecd9..b386d35ab 100755
--- a/gr-utils/src/python/gr_plot_psd.py
+++ b/gr-utils/src/python/gr_plot_psd.py
@@ -60,8 +60,10 @@ class gr_plot_psd:
rcParams['xtick.labelsize'] = self.axis_font_size
rcParams['ytick.labelsize'] = self.axis_font_size
- self.text_file = figtext(0.10, 0.95, ("File: %s" % filename), weight="heavy", size=self.text_size)
- self.text_file_pos = figtext(0.10, 0.92, "File Position: ", weight="heavy", size=self.text_size)
+ self.text_file = figtext(0.10, 0.95, ("File: %s" % filename),
+ weight="heavy", size=self.text_size)
+ self.text_file_pos = figtext(0.10, 0.92, "File Position: ",
+ weight="heavy", size=self.text_size)
self.text_block = figtext(0.35, 0.92, ("Block Size: %d" % self.block_length),
weight="heavy", size=self.text_size)
self.text_sr = figtext(0.60, 0.915, ("Sample Rate: %.2f" % self.sample_rate),
@@ -86,9 +88,9 @@ class gr_plot_psd:
def get_data(self):
self.position = self.hfile.tell()/self.sizeof_data
self.text_file_pos.set_text("File Position: %d" % self.position)
- self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
- #print "Read in %d items" % len(self.iq)
- if(len(self.iq) == 0):
+ try:
+ self.iq = scipy.fromfile(self.hfile, dtype=self.datatype, count=self.block_length)
+ except MemoryError:
print "End of File"
else:
tstep = 1.0 / self.sample_rate