commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8585 - gnuradio/trunk/gr-wxgui/src/python


From: jblum
Subject: [Commit-gnuradio] r8585 - gnuradio/trunk/gr-wxgui/src/python
Date: Thu, 12 Jun 2008 15:33:41 -0600 (MDT)

Author: jblum
Date: 2008-06-12 15:33:40 -0600 (Thu, 12 Jun 2008)
New Revision: 8585

Modified:
   gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
   gnuradio/trunk/gr-wxgui/src/python/plot.py
Log:
fftsink: y_per_div issue fixed

Modified: gnuradio/trunk/gr-wxgui/src/python/fftsink2.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/fftsink2.py      2008-06-12 19:08:59 UTC 
(rev 8584)
+++ gnuradio/trunk/gr-wxgui/src/python/fftsink2.py      2008-06-12 21:33:40 UTC 
(rev 8585)
@@ -310,7 +310,6 @@
         main_box.Add (self.control_panel, 0, wx.EXPAND)
         self.SetSizerAndFit(main_box)
         
-        self.y_range = None
         self.peak_hold = False
         self.peak_vals = None
         
@@ -395,19 +394,16 @@
         graphics = plot.PlotGraphics (lines,
                                       title=self.fftsink.title,
                                       xLabel = self._units, yLabel = "dB")
-        self.x_range = x_vals[0], x_vals[-1]
-        self.plot.Draw (graphics, xAxis=self.x_range, yAxis=self.y_range)
-        self.update_y_range ()
+        x_range = x_vals[0], x_vals[-1]
+        ymax = self.fftsink.ref_level
+        ymin = self.fftsink.ref_level - self.fftsink.y_per_div * 
self.fftsink.y_divs
+        y_range = ymin, ymax
+        self.plot.Draw (graphics, xAxis=x_range, yAxis=y_range, 
step=self.fftsink.y_per_div)        
 
     def set_peak_hold(self, enable):
         self.peak_hold = enable
         self.peak_vals = None
 
-    def update_y_range (self):
-        ymax = self.fftsink.ref_level
-        ymin = self.fftsink.ref_level - self.fftsink.y_per_div * 
self.fftsink.y_divs
-        self.y_range = self.plot._axisInterval ('min', ymin, ymax)
-
     def on_average(self, evt):
         # print "on_average"
         self.fftsink.set_average(evt.IsChecked())

Modified: gnuradio/trunk/gr-wxgui/src/python/plot.py
===================================================================
--- gnuradio/trunk/gr-wxgui/src/python/plot.py  2008-06-12 19:08:59 UTC (rev 
8584)
+++ gnuradio/trunk/gr-wxgui/src/python/plot.py  2008-06-12 21:33:40 UTC (rev 
8585)
@@ -767,7 +767,7 @@
     def GetXUseScopeTicks(self):
         return self._xUseScopeTicks
 
-    def Draw(self, graphics, xAxis = None, yAxis = None, dc = None):
+    def Draw(self, graphics, xAxis = None, yAxis = None, dc = None, step=None):
         """Draw objects in graphics with specified x and y axis.
         graphics- instance of PlotGraphics with list of PolyXXX objects
         xAxis - tuple with (min, max) axis range to view
@@ -829,7 +829,7 @@
             xticks = None
             xTextExtent= (0,0) # No text for ticks
         if self._ySpec is not 'none':
-            yticks = self._ticks(yAxis[0], yAxis[1])
+            yticks = self._ticks(yAxis[0], yAxis[1], step)
             yTextExtentBottom= dc.GetTextExtent(yticks[0][1])
             yTextExtentTop   = dc.GetTextExtent(yticks[-1][1])
             yTextExtent= (max(yTextExtentBottom[0],yTextExtentTop[0]),
@@ -1277,7 +1277,7 @@
                                     pt[1]-0.5*h)
                 text = 0    # axis values not drawn on right side
 
-    def _ticks(self, lower, upper):
+    def _ticks(self, lower, upper, step=None):
         ideal = (upper-lower)/7.
         log = _numpy.log10(ideal)
         power = _numpy.floor(log)
@@ -1298,9 +1298,12 @@
         else:
             digits = -int(power)
             format = '%'+`digits+2`+'.'+`digits`+'f'
+        #force grid when step is not None
+        if step is not None: grid = step
         ticks = []
         t = -grid*_numpy.floor(-lower/grid)
         while t <= upper:
+            if t == -0: t = 0 #remove neg zero condition
             ticks.append( (t, format % (t,)) )
             t = t + grid
         return ticks





reply via email to

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