discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] fft display frequency spotting


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] fft display frequency spotting
Date: Wed, 3 Aug 2005 13:52:14 -0700
User-agent: Mutt/1.5.6i

On Tue, Aug 02, 2005 at 01:54:09PM -0400, cswiger wrote:
> Gang - getting an accurate frequency reading from an fft display is pretty
> easy. This works for me:
> 
>    import wx.lib.evtmgr as em
>   ...
> 
>    # add an fft display to panel_7, nice size, avg on and weaver IF
>    # offset
>    fft = fftsink.fft_sink_c (self.fg, self.panel_7, fft_size=512, \
>      sample_rate=af_sample_rate, baseband_freq=-1.8e3, average=True, \
>      size=(680,240))
>    self.fg.connect (self.xlate_L, fft)
> 
>    # for mouse position reporting on fft display
>    em.eventManager.Register(self.Mouse, wx.EVT_LEFT_DOWN, fft.win)
> 
>   ...
> 
>    def Mouse(self,event):
>        fRel = ( event.GetX() - 48 ) / 15.2 - 20
>        print eng_notation.num_to_str(self.frequency + (fRel*1e3))
> 
> 
> Voila - just click on the peak or feature of interest and read it's
> frequency off the console. Change centers, scales and offsets to fit
> your freq range and window size.
> 
> --Chuck

Chuck, 

There's a method in gr-wxgui/src/python/plot.py that maps mouse x/y to
model space: GetClosestPoint.  The plot.py builtin example uses it.

Using it will allow you to remove the magic numbers and it also should
work when you resize the window.

Eric




reply via email to

[Prev in Thread] Current Thread [Next in Thread]