discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Spectrum_sense of a smaller banwidth


From: David Adrian
Subject: Re: [Discuss-gnuradio] Spectrum_sense of a smaller banwidth
Date: Tue, 10 Mar 2009 10:48:10 -0700 (PDT)

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

You need to insert a gr.stream_to_vector block between the usrp and
the fft.  Also, using vector_sink_c is not recommended for anything
but QA code that runs with a small number of samples.  If used like
you are trying to use it, it will consume all of the memory on your
system.  Use a gr.file_sink instead.

Eric


reply via email to

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