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: Sun, 12 Jun 2005 17:38:34 -0700

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




-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf
Of Eric Blossom
Sent: Thursday, June 09, 2005 12:12 PM
To: jmdaniel
Cc: address@hidden
Subject: Re: [Discuss-gnuradio] still having trouble getting started


On Thu, Jun 09, 2005 at 02:49:09PM -0400, jmdaniel wrote:
> Hello,
>
> I've had gnuradio up and running for about 2 weeks now and have been
getting
> through the examples with success.  I'm still a little fuzzy on somethings
> though.  How exactly can I get a mc4020 source to right to a file.  I am
aware
> of gr_file_sink but how do i use it?  Do I have to write something in c++,
> compile it and access it from python or can I already import gr_file_sink
from
> somewhere?  I have more questions but the answer to this one should set me
in
> the right direction.  Many thanks.
>
> John Daniel
> Virginia Tech
> address@hidden

Hi John,

No need to compile anything.  The small bit of python below should
work for you.  It copies short samples from the mc4020 source into the
the file called 'output.dat' until you press the Enter key.
MCC_CH3_EN specifies that you want to use the 3rd input (zero based).
MCC_ALL_1V specifies that your input voltage is in +/- 1V.
MCC_ALL_5V is the other choice.

If you want to grab a specific number of samples, you can add the gr.head
block.

#!/usr/bin/env python

from gnuradio import gr
from gnuradio import mc4020

def build_graph():
    fg = gr.flow_graph()
    input_rate = 20e6
    src = mc4020.source (input_rate, mc4020.MCC_CH3_EN | mc4020.MCC_ALL_1V)
    dst = gr.file_sink(gr.sizeof_short, 'output.dat')
    fg.connect (src, dst)
    return fg

def main():
    fg = build_graph()
    fg.start()
    raw_input('Press Enter to Exit: ')
    fg.stop()

if __name__ == '__main__':
    main()



# using head...

    nsamples = 2e6
    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)




_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio





reply via email to

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