summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcorgan2007-11-08 19:46:06 +0000
committerjcorgan2007-11-08 19:46:06 +0000
commit9e9d90d528c8833c5b6a0a0982d7df198b6c9451 (patch)
tree4104d48074555bd0e674c172f6a7029dcc008c0e
parent3d2a76f4eeede13bdb4fcf628409a0086ae61737 (diff)
downloadgnuradio-9e9d90d528c8833c5b6a0a0982d7df198b6c9451.tar.gz
gnuradio-9e9d90d528c8833c5b6a0a0982d7df198b6c9451.tar.bz2
gnuradio-9e9d90d528c8833c5b6a0a0982d7df198b6c9451.zip
Adds 'ctrl-double-click to re-center on maximum power' to usrp_fft.py
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6837 221aa14e-8319-0410-a670-987f0aec2ac5
-rwxr-xr-xgr-utils/src/python/usrp_fft.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/gr-utils/src/python/usrp_fft.py b/gr-utils/src/python/usrp_fft.py
index 5aee24fe6..fae5ae4cd 100755
--- a/gr-utils/src/python/usrp_fft.py
+++ b/gr-utils/src/python/usrp_fft.py
@@ -28,7 +28,7 @@ from gnuradio.wxgui import stdgui2, fftsink2, waterfallsink2, scopesink2, form,
from optparse import OptionParser
import wx
import sys
-
+import numpy
def pick_subdevice(u):
"""
@@ -261,8 +261,18 @@ class app_top_block(stdgui2.std_top_block):
def evt_left_dclick(self, event):
(ux, uy) = self.scope.win.GetXY(event)
- target_freq = ux/self.scope.win._scale_factor
- self.set_freq(target_freq)
+ if event.CmdDown():
+ # Re-center on maximum power
+ points = self.scope.win._points
+ ind = numpy.argmax(points[:,1])
+ (freq, pwr) = points[ind]
+ target_freq = freq/self.scope.win._scale_factor
+ 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, "USRP FFT", nstatus=1)