summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrondeau2008-10-25 21:47:50 +0000
committertrondeau2008-10-25 21:47:50 +0000
commit0c743f55580109e868610f534b5b9310988f8a23 (patch)
treea5226f9b9570a919477d0a0975f4fdd1608021af
parent0ccf912e55f03fd3623e481e16860680a8a12f66 (diff)
downloadgnuradio-0c743f55580109e868610f534b5b9310988f8a23.tar.gz
gnuradio-0c743f55580109e868610f534b5b9310988f8a23.tar.bz2
gnuradio-0c743f55580109e868610f534b5b9310988f8a23.zip
fixing time axes and zoom function
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9845 221aa14e-8319-0410-a670-987f0aec2ac5
-rwxr-xr-xgr-utils/src/python/gr_plot_fft.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/gr-utils/src/python/gr_plot_fft.py b/gr-utils/src/python/gr_plot_fft.py
index fa205e69a..69953f681 100755
--- a/gr-utils/src/python/gr_plot_fft.py
+++ b/gr-utils/src/python/gr_plot_fft.py
@@ -87,8 +87,8 @@ class gr_plot_fft:
show()
def get_data(self):
- position = self.hfile.tell()/self.sizeof_data
- self.text_file_pos.set_text("File Position: %d" % (position))
+ 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):
@@ -97,8 +97,8 @@ class gr_plot_fft:
self.iq_fft = self.dofft(self.iq)
tstep = 1.0 / self.sample_rate
- self.time = [tstep*position + tstep*(position + i) for i in xrange(len(self.iq))]
-
+ self.time = [tstep*(self.position + i) for i in xrange(len(self.iq))]
+
self.freq = self.calc_freq(self.time, self.sample_rate)
def dofft(self, iq):
@@ -160,15 +160,15 @@ class gr_plot_fft:
self.draw_time()
self.draw_fft()
+ self.xlim = self.sp_iq.get_xlim()
draw()
def zoom(self, event):
newxlim = self.sp_iq.get_xlim()
- #if(newxlim != self.xlim):
- if(0):
+ if(newxlim != self.xlim):
self.xlim = newxlim
- xmin = max(0, int(ceil(self.sample_rate*self.xlim[0])))
- xmax = min(int(ceil(self.sample_rate*self.xlim[1])), len(self.iq))
+ xmin = max(0, int(ceil(self.sample_rate*(self.xlim[0] - self.position))))
+ xmax = min(int(ceil(self.sample_rate*(self.xlim[1] - self.position))), len(self.iq))
iq = self.iq[xmin : xmax]
time = self.time[xmin : xmax]