summaryrefslogtreecommitdiff
path: root/gr-radio-astronomy/src/python
diff options
context:
space:
mode:
authormleech2006-10-11 02:36:24 +0000
committermleech2006-10-11 02:36:24 +0000
commit076fd769e77a757d582c50856be20b0f8f16c224 (patch)
treea0a514039c70535c5c1c3451fa3ea57bf55ecd2e /gr-radio-astronomy/src/python
parentdefd1701b49abc08b0fa6d18ca6c5410f6b97dc2 (diff)
downloadgnuradio-076fd769e77a757d582c50856be20b0f8f16c224.tar.gz
gnuradio-076fd769e77a757d582c50856be20b0f8f16c224.tar.bz2
gnuradio-076fd769e77a757d582c50856be20b0f8f16c224.zip
Added "Spectral Cursor" functionality into the waterfall display.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@3772 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gr-radio-astronomy/src/python')
-rwxr-xr-xgr-radio-astronomy/src/python/ra_waterfallsink.py16
-rwxr-xr-xgr-radio-astronomy/src/python/usrp_ra_receiver.py18
2 files changed, 20 insertions, 14 deletions
diff --git a/gr-radio-astronomy/src/python/ra_waterfallsink.py b/gr-radio-astronomy/src/python/ra_waterfallsink.py
index f2244773f..1e9fbdccb 100755
--- a/gr-radio-astronomy/src/python/ra_waterfallsink.py
+++ b/gr-radio-astronomy/src/python/ra_waterfallsink.py
@@ -193,7 +193,7 @@ class ra_waterfall_window (wx.Panel):
wx.Panel.__init__(self, parent, id, pos, size, style, name)
self.fftsink = fftsink
- self.bm = wx.EmptyBitmap(1024, 300, -1)
+ self.bm = wx.EmptyBitmap(1024, 512, -1)
self.scale_factor = self.fftsink.scaling
@@ -211,6 +211,7 @@ class ra_waterfall_window (wx.Panel):
wx.EVT_CLOSE (self, self.on_close_window)
self.Bind(wx.EVT_RIGHT_UP, self.on_right_click)
+ self.Bind(wx.EVT_MOTION, self.on_motion)
self.input_watcher = input_watcher(fftsink.msgq, fftsink.fft_size, self)
@@ -295,7 +296,7 @@ class ra_waterfall_window (wx.Panel):
dc1 = wx.MemoryDC()
dc1.SelectObject(self.bm)
- dc1.Blit(0,1,1024,300,dc1,0,0,wx.COPY,False,-1,-1)
+ dc1.Blit(0,1,1024,512,dc1,0,0,wx.COPY,False,-1,-1)
x = max(abs(self.fftsink.sample_rate), abs(self.fftsink.baseband_freq))
if x >= 1e9:
@@ -330,8 +331,6 @@ class ra_waterfall_window (wx.Panel):
idx = min(WATERFALL_WIDTH-1,idx)
x_positions[idx] = idx
y_values[idx] = y_values[idx] + value
- #dc1.SetPen(self.pens[value])
- #dc1.DrawRectangle(x_pos*p_width, 0, p_width, 1)
else: # complex fft
for x_pos in range(0, d_max): # positive freqs
value = int(dB[x_pos] * scale_factor)
@@ -340,8 +339,6 @@ class ra_waterfall_window (wx.Panel):
idx = min(WATERFALL_WIDTH-1,idx)
x_positions[idx] = idx
y_values[idx] = y_values[idx] + value
- #dc1.SetPen(self.pens[value])
- #dc1.DrawRectangle(x_pos*p_width + d_max, 0, p_width, 1)
for x_pos in range(0 , d_max): # negative freqs
value = int(dB[x_pos+d_max] * scale_factor)
value = min(255, max(0, value))
@@ -349,8 +346,6 @@ class ra_waterfall_window (wx.Panel):
idx = min(WATERFALL_WIDTH-1,idx)
x_positions[idx] = idx
y_values[idx] = y_values[idx] + value
- #dc1.SetPen(self.pens[value])
- #dc1.DrawRectangle(x_pos*p_width, 0, p_width, 1)
for i in range(0,WATERFALL_WIDTH):
yv = y_values[i]/x_scale
@@ -371,6 +366,11 @@ class ra_waterfall_window (wx.Panel):
item.Check(pred())
self.PopupMenu(menu, event.GetPosition())
+ def on_motion(self, event):
+ if not self.fftsink.xydfunc == None:
+ pos = event.GetPosition()
+ self.fftsink.xydfunc(pos)
+
def on_scaling(self, evt):
Id = evt.GetId()
if Id == self.id_scaling_100:
diff --git a/gr-radio-astronomy/src/python/usrp_ra_receiver.py b/gr-radio-astronomy/src/python/usrp_ra_receiver.py
index 8236d42c5..fc56a1199 100755
--- a/gr-radio-astronomy/src/python/usrp_ra_receiver.py
+++ b/gr-radio-astronomy/src/python/usrp_ra_receiver.py
@@ -226,11 +226,11 @@ class app_flow_graph(stdgui.gui_flow_graph):
self.scope = ra_fftsink.ra_fft_sink_c (self, panel,
fft_size=int(self.fft_size), sample_rate=self.fft_input_rate,
fft_rate=int(self.fft_rate), title="Spectral",
- ofunc=self.fft_outfunc, xydfunc=None)
+ ofunc=self.fft_outfunc, xydfunc=self.xydfunc)
else:
self.scope = ra_waterfallsink.ra_waterfallsink_c (self, panel,
fft_size=int(self.fft_size), sample_rate=self.fft_input_rate,
- fft_rate=int(self.fft_rate), title="Spectral", ofunc=self.fft_outfunc, xydfunc=self.xydfunc)
+ fft_rate=int(self.fft_rate), title="Spectral", ofunc=self.fft_outfunc, xydfunc=self.xydfunc_waterfall)
# Set up ephemeris data
self.locality = ephem.Observer()
@@ -467,10 +467,9 @@ class app_flow_graph(stdgui.gui_flow_graph):
parent=self.panel, sizer=vbox1, label="Current LMST", weight=1)
vbox1.Add((4,0), 0, 0)
- if self.waterfall == False:
- myform['spec_data'] = form.static_text_field(
- parent=self.panel, sizer=vbox1, label="Spectral Cursor", weight=1)
- vbox1.Add((4,0), 0, 0)
+ myform['spec_data'] = form.static_text_field(
+ parent=self.panel, sizer=vbox1, label="Spectral Cursor", weight=1)
+ vbox1.Add((4,0), 0, 0)
vbox2 = wx.BoxSizer(wx.VERTICAL)
g = self.subdev.gain_range()
@@ -870,6 +869,13 @@ class app_flow_graph(stdgui.gui_flow_graph):
s2 = "\n%.3fkm/s" % vs
self.myform['spec_data'].set_value(s+s2)
+ def xydfunc_waterfall(self,pos):
+ lower = self.observing - (self.seti_fft_bandwidth / 2)
+ upper = self.observing + (self.seti_fft_bandwidth / 2)
+ binwidth = self.seti_fft_bandwidth / 1024
+ s = "%.6fMHz" % ((lower + (pos.x*binwidth)) / 1.0e6)
+ self.myform['spec_data'].set_value(s)
+
def toggle_cal(self):
if (self.calstate == True):
self.calstate = False