diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-05-28 17:04:09 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2007-05-28 17:04:09 +0000 |
commit | 9880e7bb383054aa43681b52ebd33c8fd4cb8fcb (patch) | |
tree | c9cd097baefda9ec392da2944fb799cbffabaa40 /gr-wxgui/src/python/fftsink2.py | |
parent | f29776e2c39c06c958e7b4dfeae8883b47305969 (diff) |
Merged r5547:5542 from jcorgan/num into trunk. Converts from using Python Numeric to numpy. Trunk passes distcheck. gr-radio-astronomy still needs conversion.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@5553 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-wxgui/src/python/fftsink2.py')
-rwxr-xr-x | gr-wxgui/src/python/fftsink2.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gr-wxgui/src/python/fftsink2.py b/gr-wxgui/src/python/fftsink2.py index b591add121..cb7bb8c077 100755 --- a/gr-wxgui/src/python/fftsink2.py +++ b/gr-wxgui/src/python/fftsink2.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2003,2004,2005,2006 Free Software Foundation, Inc. +# Copyright 2003,2004,2005,2006,2007 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -24,7 +24,7 @@ from gnuradio import gr, gru, window from gnuradio.wxgui import stdgui2 import wx import gnuradio.wxgui.plot as plot -import Numeric +import numpy import threading import math @@ -209,7 +209,7 @@ class input_watcher (threading.Thread): start = itemsize * (nitems - 1) s = s[start:start+itemsize] - complex_data = Numeric.fromstring (s, Numeric.Float32) + complex_data = numpy.fromstring (s, numpy.float32) de = DataEvent (complex_data) wx.PostEvent (self.event_receiver, de) del de @@ -252,7 +252,7 @@ class fft_window (plot.PlotCanvas): if self.peak_vals is None: self.peak_vals = dB else: - self.peak_vals = Numeric.maximum(dB, self.peak_vals) + self.peak_vals = numpy.maximum(dB, self.peak_vals) dB = self.peak_vals x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq)) @@ -267,20 +267,20 @@ class fft_window (plot.PlotCanvas): units = "kHz" if self.fftsink.input_is_real: # only plot 1/2 the points - x_vals = ((Numeric.arrayrange (L/2) + x_vals = ((numpy.arange (L/2) * (self.fftsink.sample_rate * sf / L)) + self.fftsink.baseband_freq * sf) - points = Numeric.zeros((len(x_vals), 2), Numeric.Float64) + points = numpy.zeros((len(x_vals), 2), numpy.float64) points[:,0] = x_vals points[:,1] = dB[0:L/2] else: # the "negative freqs" are in the second half of the array - x_vals = ((Numeric.arrayrange (-L/2, L/2) + x_vals = ((numpy.arange (-L/2, L/2) * (self.fftsink.sample_rate * sf / L)) + self.fftsink.baseband_freq * sf) - points = Numeric.zeros((len(x_vals), 2), Numeric.Float64) + points = numpy.zeros((len(x_vals), 2), numpy.float64) points[:,0] = x_vals - points[:,1] = Numeric.concatenate ((dB[L/2:], dB[0:L/2])) + points[:,1] = numpy.concatenate ((dB[L/2:], dB[0:L/2])) lines = plot.PolyLine (points, colour='BLUE') |