discuss-gnuradio
[Top][All Lists]
Advanced

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

RE: [Discuss-gnuradio] still having trouble getting started


From: John E. Don Carlos
Subject: RE: [Discuss-gnuradio] still having trouble getting started
Date: Mon, 13 Jun 2005 15:57:23 -0700

Eric,
I am somewhat overwhelmed by the flow-graph classes.  The USRP program
(tvrx_debug.py) that I started with seems to be using a different style

def main ():
        app = stdgui.stdapp (app_flow_graph, '"USRP FFT")
        app.MainLoop  ()

things are connected up using

self.connect(src,dst)

Anyway, i did move the head earlier in the program before the fftsink - but
the file still keeps growing and growing until i stop the program.

Since i'm learning by trial and error modifications to existing code without
fully understanding the all the underlying mechanisms, any advise on which
style to use would be much appreciated.  Perhaps there is an easy way to
adapt, otherwise, i'll recode it up as you suggest,
Thanks,
John



-----Original Message-----
From: Eric Blossom [mailto:address@hidden
Sent: Monday, June 13, 2005 12:17 PM
To: John E. Don Carlos
Cc: jmdaniel; address@hidden
Subject: Re: [Discuss-gnuradio] still having trouble getting started


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()





reply via email to

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