discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] How to specify vector input signature for gr_sync


From: Josh Blum
Subject: Re: [Discuss-gnuradio] How to specify vector input signature for gr_sync_block.
Date: Sat, 22 Jun 2013 15:43:31 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6


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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 



reply via email to

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