commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9845 - gnuradio/trunk/gr-utils/src/python


From: trondeau
Subject: [Commit-gnuradio] r9845 - gnuradio/trunk/gr-utils/src/python
Date: Sat, 25 Oct 2008 15:47:50 -0600 (MDT)

Author: trondeau
Date: 2008-10-25 15:47:50 -0600 (Sat, 25 Oct 2008)
New Revision: 9845

Modified:
   gnuradio/trunk/gr-utils/src/python/gr_plot_fft.py
Log:
fixing time axes and zoom function

Modified: gnuradio/trunk/gr-utils/src/python/gr_plot_fft.py
===================================================================
--- gnuradio/trunk/gr-utils/src/python/gr_plot_fft.py   2008-10-25 21:44:06 UTC 
(rev 9844)
+++ gnuradio/trunk/gr-utils/src/python/gr_plot_fft.py   2008-10-25 21:47:50 UTC 
(rev 9845)
@@ -87,8 +87,8 @@
         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 @@
             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 @@
         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]





reply via email to

[Prev in Thread] Current Thread [Next in Thread]