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: sirjanselot
Subject: Re: [Discuss-gnuradio] Printing gr_vector_sink_f data
Date: Wed, 22 Sep 2010 12:47:11 -0700 (PDT)

So what you are saying is when I create an instance of the class, only the
data and blocks are initialized and glued together, but the object didn't
run yet.  So source will never get to sink unless I use the run() method and
then I can print the data.  

Let me know if this if I am correct. 

I did fix it.  I put self.result_data = self.dst.data() in the print_data
method and made the necessary changes and it worked.


Josh Blum-2 wrote:
> 
> 
> 
> 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
> 
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Printing-gr_vector_sink_f-data-tp29782854p29783239.html
Sent from the GnuRadio mailing list archive at Nabble.com.




reply via email to

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