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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Eric Blossom Sent: Thursday, June 09, 2005 12:12 PM To: jmdaniel Cc: discuss-gnuradio@gnu.org 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 > [EMAIL PROTECTED] 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 Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio _______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org http://lists.gnu.org/mailman/listinfo/discuss-gnuradio