On Mon, May 25, 2009 at 09:34:51PM +0300, Alysson Menezes wrote:
> 
> Hello everybody. I was trying to use the gnuradio complex_to_float
> () block just to understand its functioning. Unfortunately, the
> conversion not happened and apparently there was no problem. The
> code is below. What's the problem with this so simple code?

Hi Alysson,

I've attach a modified version of your code that works with GNU Radio
3.1 and 3.2.  I suggest that you try using the 3.2 release.

If you happen to be running Ubuntu 9.04 (Jaunty) you can download
prebuilt binaries:

  http://gnuradio.org/trac/wiki/DebianPackages

Otherwise, please download the source and build it:

  http://gnuradio.org/trac/wiki/Download
  http://gnuradio.org/trac/wiki/BuildGuid


> One more thing, it would be so helpful a dictionary with all the
> gnuradio blocks and usage examples. Examples are fundamental to help
> us reach a good level to be able to contribute for the gnuradio
> project, without waste so much time. Thank you very much.

http://gnuradio.org/doc/doxygen/index.html
http://gnuradio.org/doc/doxygen/modules.html

There are many examples, see

  gnuradio-examples/python/*/*


If you haven't already, please take a look at

  http://gnuradio.org/trac/wiki
  http://gnuradio.org/trac/wiki/ReportingErrors

Welcome!
Eric
#!/usr/bin/env python

from gnuradio import gr, eng_notation, gru, window, blks2
from gnuradio import audio
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from optparse import OptionParser
from gnuradio import gr_unittest


class my_top_block(gr.top_block):
    def __init__(self):
        gr.top_block.__init__(self)
        self.data = (1+2j, 3+4j, 5+6j)
        self.src = gr.vector_source_c (self.data)
        self.converte = gr.complex_to_float()
        self.re_sink = gr.vector_sink_f ()
        self.im_sink = gr.vector_sink_f ()
        self.connect (self.src, (self.converte,0))
        self.connect ((self.converte,0), self.re_sink)
        self.connect((self.converte,1), self.im_sink)

if __name__ == '__main__' :
    tb = my_top_block()
    try:
        tb.run()
    except KeyboardInterrupt:
        pass

    print "src data: ", tb.data
    print "real: ", tb.re_sink.data()
    print "imag: ", tb.im_sink.data()


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

Reply via email to