[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] still having trouble getting started
From: |
Eric Blossom |
Subject: |
Re: [Discuss-gnuradio] still having trouble getting started |
Date: |
Mon, 13 Jun 2005 12:16:31 -0700 |
User-agent: |
Mutt/1.5.6i |
On Sun, Jun 12, 2005 at 05:38:34PM -0700, John E. Don Carlos wrote:
> I also want to save the signal to file and put this code in tvrx_debug.py.
> I saved about 5 GB before i stopped the program even though i set nsamples =
> 2e6 in head.
>
> nsamples = 2e6
> head = gr.head(gr.sizeof_gr_complex, int(nsamples))
> save_file=gr.file_sind(gr.sizeof_gr_complex,"ATSC_sig.dat")
> self.connect(self.u, save_file)
>
> the fft block is also connected at the same time.
>
> Since i'm using the usrp, i used gr.sizeof_gr_complex.
>
> Is there a way to limit the file to the size specified in head?
>
> I am assuming that the data is I Q interleaved floats)?
>
> Thanks,
> John
Sorry, forgot to mention that you should use fg.run()
not fg.start() followed by fg.stop(). Also be sure that head is
upstream of all of your sinks (if you're using more than one). head
effectively returns "EOF" after it has processed nsamples.
#!/usr/bin/env python
from gnuradio import gr
from gnuradio import mc4020
def build_graph():
nsamples = 2e6
input_rate = 20e6
fg = gr.flow_graph()
src = mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V)
head = gr.head(gr.sizeof_short, int(nsamples))
dst = gr.file_sink(gr.sizeof_short, 'output.dat')
fg.connect (src, head, dst)
return fg
def main():
fg = build_graph()
fg.run()
if __name__ == '__main__':
main()