discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Python block, itemsize mismatch


From: Activecat
Subject: Re: [Discuss-gnuradio] Python block, itemsize mismatch
Date: Tue, 11 Mar 2014 08:45:08 +0800

On Tue, Mar 11, 2014 at 5:29 AM, Martin Braun <address@hidden> wrote:
On 03/10/2014 06:57 PM, David Halls wrote:
> Hi,
>
> I get the following error connecting 'OFDM Serializer' (GNU Radio block
> with complex output), to my own Python block 'blsd_dec_bfb' (with
> complex input)
>
> "ValueError: itemsize mismatch: ofdm_serializer_vcc0:0 using 8,
> blsd_dec_bfb0:0 using 16"
>
> This is the code in the beginning of my block
>
> "class blsd_dec_bfb(gr.basic_block):
> """
> docstring for block blsd_dec_bfb
> """
> def __init__(self, num_packets=1, K=50, K2=20, kA1=4, NA1=8,
> num_carriers=64):
> gr.basic_block.__init__(self,
> name="blsd_dec_bfb",
> in_sig=[numpy.complex],
> out_sig=[numpy.uint8,numpy.uint8,numpy.uint8])"

I think you need to do numpy.complex64 -- not 100%, can you please tell
us if this worked.

M

> The colours match in the GRC, and it lets me run it (i.e. no complaints
> about type mismatch before run-time).


The "float" and "gr_complex" data type in c++ usually match with "numpy.float32" and "numpy.complex64" in python.
The "int" in c++ matches "numpy.int32" in python.
So far I haven't encountered any exception.

c++                           python
--------------------------------------------------------  
float              <----->    numpy.float32
gr_complex   <----->    numpy.complex64
int                <----->    numpy.int32

Regards,
Activecat

reply via email to

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