On 06/22/2013 08:46 AM, Manu T S wrote:
> 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
> OOT<http://gnuradio.org/redmine/projects/gnuradio/wiki/OutOfTreeModules#Adding-the-block-code>I
> 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?
> 

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

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

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

Reply via email to