[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] GrBlock Inconsistent IO Size
From: |
Josh Blum |
Subject: |
Re: [Discuss-gnuradio] GrBlock Inconsistent IO Size |
Date: |
Fri, 28 Oct 2011 10:47:45 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 |
Just FYI, I am integrating this work into gnuradio-core as we speak :-)
On 10/28/2011 10:05 AM, Jason Bonior wrote:
> I used grblock and numpy to create a block which would calculate the
> variance of an incoming vector then pass on the result:
>
> class variance(grblock.sync_block):
>
> def __init__(self):
> grblock.sync_block.__init__(
> self,
> name = "variance",
> in_sig = [(numpy.float32, 2048)],
> out_sig = [numpy.float32],
> )
>
> def work(self, input_items, output_items):
> output_items[0][:] = numpy.var(input_items[0])
> print output_items[0][:].shape
> print input_items[0].shape
> return len(output_items[0])
>
> I added the print .shape commands to make sure that the block IO was
> performing as expected. Most of the time I get (1, 2048) and (1, ) as
> I would expect but occasionally I get (2, 2048) (2, ) up to (5, 2048)
> (5,). Has anyone else seen anything like this or know how it might
> affect the performance of the block?
>
Each element of the input vector is an array of items. In this case each
item is a vector of 2048 (I know... its a vector of vectors of vectors).
Its not guaranteed how many items the scheduler will give you. It looks
like usually you get 1 item, but sometimes several. This is consistent
with my observations when dealing with the output of the FFT block.
-Josh