discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] howto module ... please help


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] howto module ... please help
Date: Mon, 1 Nov 2010 17:14:44 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Nov 01, 2010 at 03:29:25PM -0700, Michael Civ wrote:
> Hello, I posted this a week ago and received no response. Any comments or 
> suggestions would be greatly appreciate.
> 
> I recently got python programs to successfully import the howto 
> module, but I cannot use the functions:
> 

Michael,

I just built gnuradio and howto from the git master (Fedora 13 on x86-64).
It doesn't SEGFAULT for me leading me to think that you have a hosed-
up GNU Radio installation on your system.  Is there any chance that
you've got more than one installation?  Perhaps one from a .deb or
.rpm and one from source?  If so, uninstall the packaged one.

Also, what you really want is something like the code below.
Otherwise the dst.data() is always empty, since the graph hasn't run
when you first print it out.

Eric

$ cd gnuradio
$ ./bootstrap && ./configure --disable-docs
$ (make -j12 && make check && make install) 2>&1 | tee make.log
$ cd gr-howto-write-a-block/
$ ./bootstrap 
$ ./configure
$ make && make check && make install



#!/usr/bin/env python

from gnuradio import gr
import howto

class my_top_block(gr.top_block):
  def __init__(self):
    gr.top_block.__init__(self)

    src_nums = (4, 5, 6)
    src = gr.vector_source_f (src_nums)
    sqr = howto.square_ff ()
    dst = gr.vector_sink_f ()
    self.dst = dst
    self.connect (src, sqr)
    self.connect (sqr, dst)
    print "src: ", src
    print "sqr: ", sqr
    print "dst.data: ", dst.data()

if __name__ == '__main__':
    tb = my_top_block()
    tb.run()
    print "dst.data: ", tb.dst.data()


$ /tmp/test.py
src:  <gr_block vector_source_f (1)>
sqr:  <gr_block square_ff (2)>
dst.data:  ()
dst.data:  (16.0, 25.0, 36.0)



reply via email to

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