How to specify vector input signature for gr_sync_block

I am trying to write code for a block which accepts a vector input and
spits out a vector output. The block is derived from gr_sync_block.
From the tutorial on
OOThttp://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules#Adding-the-block-codeI
have the following information. For a block with single input and
single
output the init method is as given below.

def init(self): gr.sync_block.init(self, name =
“square3_ff”,** in_sig = [numpy.float32],
out_sig = [numpy.float32])

How do I take in a vector input?

Hi,
I am not sure if there are any other types except Complex, Float,
Integer
and Message. But you may wanna look into gr_vector_sink/source_i/f/c.
For
example gr_vector_source_c is a source of gr_complex which gets its data
from a vector where as gr_vector_sink_c is a gr_complex sink which
writes
to a vector. Similarly for int(i) and float(f). May be you can find more
details in doxygen

If I am wrong I hope someone from list will correct me and provide the
right way to do it.

On 06/22/2013 08:46 AM, Manu T S wrote:

out_sig = [numpy.float32])

How do I take in a vector input?

That parameter “numpy.float32” is passed into the dtype for the numpy
array. Anything you can pass to numpy as a dtype can be used.

this unit test outputs a stream of float vectors:

class fc32_to_f32_2(gr.sync_block):
def init(self):
gr.sync_block.init(
self,
name = “fc32_to_f32_2”,
in_sig = [numpy.complex64],
out_sig = [(numpy.float32, 2)],
)

def work(self, input_items, output_items):
    output_items[0][::,0] = numpy.real(input_items[0])
    output_items[0][::,1] = numpy.imag(input_items[0])
    return len(output_items[0])

-josh