Question about hier block

Hi

I’m trying to make a very simple hier block. ( see the code below). When
I
execute my top block i get no error, but the data seems to never enter
the
hier block ( the print-line prints : “()”). What am I doing wrong?

####my hier block#########
from gnuradio import gr
class Trameur(gr.hier_block2):
def init(self):
gr.hier_block2.init(self, “Trameur”,gr.io_signature(1, 1,
gr.sizeof_char),gr.io_signature(1, 1, gr.sizeof_char))

#####input####
self.in_data = gr.vector_sink_b()
self.connect(self ,self.in_data)
self.src_data = self.in_data.data()
            print self.src_data

#######output###########"
self.out_data = gr.vector_source_b (self.src_data)
self.connect(self.out_data , self)

#####################My top block############################

from gnuradio import gr
from Trameur_stanag import Trameur
class top(gr.top_block):
def init(self):
gr.top_block.init(self)

self.src_data =

(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)

self.in_data =   gr.vector_source_b(self.src_data)
self.tramage = Trameur ()
self.sink2=gr.vector_sink()

self.connect( self.in_data, self.tramage)
self.connect(self.tramage, self.sink2)

if name == ‘main’:
try:
tb = top()
tb.run()
except KeyboardInterrupt:
pass

On Fri, Mar 26, 2010 at 05:23:34PM +0100, Axel B. wrote:

Hi

I’m trying to make a very simple hier block. ( see the code below). When I
execute my top block i get no error, but the data seems to never enter the
hier block ( the print-line prints : “()”). What am I doing wrong?

You’re printing from the constructor, before the graph has been run.

On Mon, Mar 29, 2010 at 10:43:08AM +0200, Axel B. wrote:

Hi,

Thanks for taking the time to reply. I changed my code to print the data
after the constuctor. But it is still not working. I guess, I 'm doing
something else wrong.

Have you looked at any of the qa_*.py code?
That code makes extensive use of vector_source’s and vector_sink’s.

Eric

Hi,

Thanks for taking the time to reply. I changed my code to print the data
after the constuctor. But it is still not working. I guess, I 'm doing
something else wrong.

The changed code :
#####################My top block############################

from gnuradio import gr
from Trameur_stanag import Trameur
class top(gr.top_block):
def init(self): gr.top_block.init(self)

self.src_data =
(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)

self.in_data = gr.vector_source_b(self.src_data) self.tramage =
Trameur ()
self.sink2=gr.vector_sink()

self.connect( self.in_data, self.tramage) self.connect(self.tramage,
self.sink2)
def print_data(self)
print “out” , self.sink2.data()

if name == ‘main’: try:
tb = top()
tb.run()
tb.print_data()
except KeyboardInterrupt: pass

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs