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