Monday, July 26, 2021

Re: GRC port type assignment in Python Block

Hi Jerrid,

Your attempt at using structures to map to a complex type is sensible, but it appears that GRC doesn't parse this very well for at least the embedded python blocks.  The UHD blocks are c++ based which just uses the io_signature object in the constructor which specifies a size, not a type.

You may want to try just using non-vectored int16's as an interleaved stream and deinterleave in your python block

Josh

On Thu, Jul 22, 2021 at 7:21 PM Jerrid Plymale <jerrid.plymale@canyon-us.com> wrote:

Hello All,

 

I am trying to write a python block that will convert shorts to complex int16, and I am having some difficulties. I have a need for this block so that I can read int16 data from a file using the file source block, and then transmit that data to a USRP X310 using a UHD USRP sink using complex int16 input type.

 

The problem I am having is being able to set out_sig within the block init to a numpy dtype representation of complex int16. I tried using the following: np.dtype([('re', np.int16), ('im', np.int16)]). I get the following error when using this: Can't map dtype([('re', '<i2'), ('im', '<i2')]) to GRC port type.

 

Does anyone know of a way to set the out_sig in a python block to a complex int16 type that will map to the complex int16 GRC port type? I figure this must be doable if the UHD USRP blocks have complex int16 GRC port types.

 

Best Regards,

Jerrid

No comments:

Post a Comment