summaryrefslogtreecommitdiff
path: root/gr-wxgui/src/python
diff options
context:
space:
mode:
authorjblum2008-06-12 21:33:40 +0000
committerjblum2008-06-12 21:33:40 +0000
commitfbf6561921e39beb69caaca9f7012c17314530d7 (patch)
tree4420a481bb08e58a6905cc52baf060697211d140 /gr-wxgui/src/python
parent1c8207ec547f0f5513e29fa6f3cc2037c407bc45 (diff)
downloadgnuradio-fbf6561921e39beb69caaca9f7012c17314530d7.tar.gz
gnuradio-fbf6561921e39beb69caaca9f7012c17314530d7.tar.bz2
gnuradio-fbf6561921e39beb69caaca9f7012c17314530d7.zip
fftsink: y_per_div issue fixed
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8585 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src/python')
-rwxr-xr-xgr-wxgui/src/python/fftsink2.py14
-rw-r--r--gr-wxgui/src/python/plot.py9
2 files changed, 11 insertions, 12 deletions
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/src/python/fftsink2.py
index 8c8d2d8f8..423097674 100755
--- a/gr-wxgui/src/python/fftsink2.py
+++ b/gr-wxgui/src/python/fftsink2.py
@@ -310,7 +310,6 @@ class fft_window (wx.Panel):
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 @@ class fft_window (wx.Panel):
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())
diff --git a/gr-wxgui/src/python/plot.py b/gr-wxgui/src/python/plot.py
index 837ff947b..c104b0ea5 100644
--- a/gr-wxgui/src/python/plot.py
+++ b/gr-wxgui/src/python/plot.py
@@ -767,7 +767,7 @@ class PlotCanvas(wx.Window):
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 @@ class PlotCanvas(wx.Window):
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 @@ class PlotCanvas(wx.Window):
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 @@ class PlotCanvas(wx.Window):
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