[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Spectrum_sense of a smaller banwidth
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] Spectrum_sense of a smaller banwidth |
Date: |
Tue, 10 Mar 2009 11:04:59 -0700 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Tue, Mar 10, 2009 at 10:48:10AM -0700, David Adrian wrote:
> Thanks for the reply Eric, here is what I have now:
>
> #!/usr/bin/env python
>
> from gnuradio import gr, gru, window
> from gnuradio import usrp
>
> from gnuradio.wxgui import stdgui, fftsink, scopesink
> import wx
>
> class topBlock(gr.top_block):
> def __init__(self):
> gr.top_block.__init__(self)
>
> fftsize = 256
> udecim = 256
>
> mywin = window.blackmanharris(fftsize)
> fft = gr.fft_vcc(fftsize, True, mywin)
>
> signal = usrp.source_c(0,udecim) # signal from Basic RX,
> decimation=256
>
> ss2v = gr.stream_to_vector(gr.sizeof_gr_complex, fftsize)
> v2ss = gr.vector_to_stream(gr.sizeof_gr_complex, fftsize)
>
> f_sink = gr.file_sink(gr.sizeof_gr_complex,"output.dat")
>
> self.connect(signal, ss2v, fft, v2ss, f_sink)
>
> # Do stuff with fsink.data()
>
>
> def main():
> print "Initilizing.."
> tb = topBlock()
> print "Flowgraph start.."
> tb.start()
>
> print "Exiting.."
>
> if __name__ == "__main__":
> main()
>
> But the output.dat file is empty. What I want to do here is to
> calculate the fft of a bunch of samples and from there to extract
> the bin with the maximum value in order to be able later to "follow"
> that signal in a aprox 200 Hz bandwidth
> Adrian
>
Use tb.run() instead of tb.start().
As written this exits immediately.
Eric