diff options
author | Tom Rondeau | 2011-01-16 14:06:30 -0500 |
---|---|---|
committer | Tom Rondeau | 2011-01-16 14:06:30 -0500 |
commit | 6c97e6ca62ae4690994f0b7d6f11cf0b0e615858 (patch) | |
tree | bd16a46ed116830c6edc832505750570d6758d96 /gr-utils/src/python/plot_data.py | |
parent | cb3520203232d958962bd3b871f22675fe9c6bb5 (diff) | |
parent | 58a1356ed70994c0f24afa8a276b7e62979c28cf (diff) | |
download | gnuradio-6c97e6ca62ae4690994f0b7d6f11cf0b0e615858.tar.gz gnuradio-6c97e6ca62ae4690994f0b7d6f11cf0b0e615858.tar.bz2 gnuradio-6c97e6ca62ae4690994f0b7d6f11cf0b0e615858.zip |
Merge branch 'master' into next
* master:
Fixing up fft and constellation plot to better handle zooming.
Fixing zooming capabilities. Time axis does not track any longer due to what looks like a matplotlib bug that resets the xlims after the zoom occurs.
Fixing up other plotting tools for data read errors.
Using .min and .max on scipy arrays instead of min() max(); seems to be more portable.
Fix how the end of a file is handled.
PFB resampler: fix it this way to avoid the signed/unsigned warning.
PFB resampler: fixes bug where filter could be looking past the number of inputs.
Conflicts:
gr-utils/src/python/gr_plot_psd.py
Diffstat (limited to 'gr-utils/src/python/plot_data.py')
-rw-r--r-- | gr-utils/src/python/plot_data.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gr-utils/src/python/plot_data.py b/gr-utils/src/python/plot_data.py index 08cdd6030..15012e589 100644 --- a/gr-utils/src/python/plot_data.py +++ b/gr-utils/src/python/plot_data.py @@ -1,5 +1,5 @@ # -# Copyright 2007,2008 Free Software Foundation, Inc. +# Copyright 2007,2008,2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -81,13 +81,13 @@ class plot_data: def get_data(self, hfile): self.text_file_pos.set_text("File Position: %d" % (hfile.tell()//self.sizeof_data)) - f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length) - #print "Read in %d items" % len(self.f) - if(len(f) == 0): + try: + f = scipy.fromfile(hfile, dtype=self.datatype, count=self.block_length) + except MemoryError: print "End of File" else: - self.f = f - self.time = [i*(1/self.sample_rate) for i in range(len(self.f))] + self.f = scipy.array(f) + self.time = scipy.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]) @@ -107,8 +107,8 @@ class plot_data: # Subplot for real and imaginary parts of signal self.plot_f += plot(self.time, self.f, 'o-') - maxval = max(maxval, max(self.f)) - minval = min(minval, min(self.f)) + maxval = max(maxval, self.f.max()) + minval = min(minval, self.f.min()) self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) @@ -122,8 +122,8 @@ class plot_data: for hf,p in zip(self.hfile,self.plot_f): self.get_data(hf) p.set_data([self.time, self.f]) - maxval = max(maxval, max(self.f)) - minval = min(minval, min(self.f)) + maxval = max(maxval, self.f.max()) + minval = min(minval, self.f.min()) self.sp_f.set_ylim([1.5*minval, 1.5*maxval]) |