GrBlock Inconsistent IO Size

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?


Jason Bonior

Just FYI, I am integrating this work into gnuradio-core as we speak :slight_smile:

On 10/28/2011 10:05 AM, Jason Bonior wrote:

        out_sig = [numpy.float32],

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

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