summaryrefslogtreecommitdiff
path: root/gr-uhd/apps/uhd_fft
diff options
context:
space:
mode:
Diffstat (limited to 'gr-uhd/apps/uhd_fft')
-rwxr-xr-xgr-uhd/apps/uhd_fft46
1 files changed, 23 insertions, 23 deletions
diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft
index 0267ce46f..8bb5e0d2b 100755
--- a/gr-uhd/apps/uhd_fft
+++ b/gr-uhd/apps/uhd_fft
@@ -1,24 +1,24 @@
#!/usr/bin/env python
#
# Copyright 2012 Free Software Foundation, Inc.
-#
+#
# This file is part of GNU Radio
-#
+#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
-#
+#
# GNU Radio is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-#
+#
from gnuradio import gr, gru
from gnuradio import uhd
@@ -44,7 +44,7 @@ class app_top_block(stdgui2.std_top_block):
self.frame = frame
self.panel = panel
-
+
parser = OptionParser(option_class=eng_option)
parser.add_option("-a", "--args", type="string", default="",
help="UHD device address args , [default=%default]")
@@ -84,7 +84,7 @@ class app_top_block(stdgui2.std_top_block):
sys.exit(1)
self.options = options
self.show_debug_info = True
-
+
self.u = uhd.usrp_source(device_addr=options.args,
stream_args=uhd.stream_args(cpu_format='fc32',
otw_format=options.wire_format, args=options.stream_args))
@@ -99,7 +99,7 @@ class app_top_block(stdgui2.std_top_block):
self.u.set_samp_rate(options.samp_rate)
input_rate = self.u.get_samp_rate()
-
+
if options.waterfall:
self.scope = \
waterfallsink2.waterfall_sink_c (panel, fft_size=1024,
@@ -111,7 +111,7 @@ class app_top_block(stdgui2.std_top_block):
else:
self.scope = fftsink2.fft_sink_c (panel,
fft_size=options.fft_size,
- sample_rate=input_rate,
+ sample_rate=input_rate,
ref_scale=options.ref_scale,
ref_level=20.0,
y_divs = 12,
@@ -125,7 +125,7 @@ class app_top_block(stdgui2.std_top_block):
self._build_gui(vbox)
self._setup_events()
-
+
# set initial values
if options.gain is None:
@@ -137,7 +137,7 @@ class app_top_block(stdgui2.std_top_block):
# if no freq was specified, use the mid-point
r = self.u.get_freq_range()
options.freq = float(r.start()+r.stop())/2
-
+
self.set_gain(options.gain)
if self.show_debug_info:
@@ -165,9 +165,9 @@ class app_top_block(stdgui2.std_top_block):
def _form_set_freq(kv):
return self.set_freq(kv['freq'])
-
+
vbox.Add(self.scope.win, 10, wx.EXPAND)
-
+
# add control area at the bottom
self.myform = myform = form.form()
hbox = wx.BoxSizer(wx.HORIZONTAL)
@@ -184,11 +184,11 @@ class app_top_block(stdgui2.std_top_block):
if g.stop() <= g.start():
glow = 0.0
ghigh = 1.0
-
+
else:
glow = g.start()
ghigh = g.stop()
-
+
myform['gain'] = form.slider_field(parent=self.panel,
sizer=hbox, label="Gain",
weight=3,
@@ -234,7 +234,7 @@ class app_top_block(stdgui2.std_top_block):
# FIXME figure out how to have this be a subpanel that is always
# created, but has its visibility controlled by foo.Show(True/False)
-
+
def _form_set_samp_rate(kv):
return self.set_samp_rate(kv['samprate'])
@@ -265,7 +265,7 @@ class app_top_block(stdgui2.std_top_block):
vbox.Add(hbox, 0, wx.EXPAND)
vbox.AddSpacer(5)
-
+
def set_freq(self, target_freq):
"""
Set the center frequency we're interested in.
@@ -299,12 +299,12 @@ class app_top_block(stdgui2.std_top_block):
self.myform['samprate'].set_value(self.u.get_samp_rate())
# uhd set_samp_rate never fails; always falls back to closest requested.
- return True
+ return True
def _setup_events(self):
if not self.options.waterfall and not self.options.oscilloscope:
self.scope.win.Bind(wx.EVT_LEFT_DCLICK, self.evt_left_dclick)
-
+
def evt_left_dclick(self, event):
(ux, uy) = self.scope.win.GetXY(event)
if event.CmdDown():
@@ -317,17 +317,17 @@ class app_top_block(stdgui2.std_top_block):
ind = int(points.shape()[0]/2)
else:
ind = numpy.argmax(points[:,1])
-
+
(freq, pwr) = points[ind]
target_freq = freq/self.scope.win._scale_factor
print ind, freq, pwr
- self.set_freq(target_freq)
+ self.set_freq(target_freq)
else:
# Re-center on clicked frequency
target_freq = ux/self.scope.win._scale_factor
self.set_freq(target_freq)
-
-
+
+
def main ():
app = stdgui2.stdapp(app_top_block, "UHD FFT", nstatus=1)
app.MainLoop()