discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Printing gr_vector_sink_f data


From: Josh Blum
Subject: Re: [Discuss-gnuradio] Printing gr_vector_sink_f data
Date: Wed, 22 Sep 2010 12:07:54 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8



On 09/22/2010 12:01 PM, sirjanselot wrote:

Hello,

I tried to print what data gr_vector_sink_f contains in the following code:

#!/usr/bin/env python

import howto
from gnuradio import gr, gru
from gnuradio.gr import firdes
from optparse import OptionParser
from gnuradio import blks2

class howto_square (gr.top_block):
        def __init__(self):
                gr.top_block.__init__(self)
                src_data = (-3, 4, -5.5, 2, 3)
                expected_result = (9, 16, 30.25, 4, 9)
                src = gr.vector_source_f (src_data)
                sqr = howto.square_ff ()
                dst = gr.vector_sink_f ()
                self.connect (src, sqr)
                self.connect (sqr, dst)
                self.result_data = dst.data()

right here, you collect the data before running the flow graph

-josh

                                
        def print_data(self):
                print self.result_data

if __name__ == '__main__':
        #parser = OptionParser(option_class=eng_option, usage="%prog: 
[options]")
        #(options, args) = parser.parse_args()
        hw = howto_square()
        hw.run()
        hw.print_data()

But it is always empty.

Any thoughts?

Thanks



reply via email to

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