[Discuss-gnuradio] Python block, itemsize mismatch

2014-03-10 Thread David Halls
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])

the xml is

... sink
namein/name
typecomplex/type
  /sink
  source
namebA1/name
typebyte/type
  /source
  source
namebA2/name
typebyte/type
  /source
  source
nameb2/name
typebyte/type
  /source...

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

I hope it is just a silly mistake. Can anyone help?

Regards,

David



NOTE: The information in this email and any attachments may be confidential 
and/or legally privileged. This message may be read, copied and used only by 
the intended recipient. If you are not the intended recipient, please destroy 
this message, delete any copies held on your system and notify the sender 
immediately.

Toshiba Research Europe Limited, registered in England and Wales (2519556). 
Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, 
England. Web: www.toshiba.eu/research/trl
---
 This email has been scanned for email related threats and delivered safely by 
Mimecast.
 For more information please visit http://www.mimecast.com
---

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


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

2014-03-10 Thread Activecat
On Tue, Mar 11, 2014 at 5:29 AM, Martin Braun martin.br...@ettus.comwrote:

 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
___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


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

2014-03-10 Thread David Halls
You're a genius! It works.

Interestingly for a float it requires numpy.float32 or a similar error occurs.

D

From: discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org 
[discuss-gnuradio-bounces+david.halls=toshiba-trel@gnu.org] on behalf of 
Martin Braun [martin.br...@ettus.com]
Sent: 10 March 2014 21:29
To: discuss-gnuradio@gnu.org
Subject: Re: [Discuss-gnuradio] Python block, itemsize mismatch

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 xml is

 ... sink
 namein/name
 typecomplex/type
 /sink
 source
 namebA1/name
 typebyte/type
 /source
 source
 namebA2/name
 typebyte/type
 /source
 source
 nameb2/name
 typebyte/type
 /source...

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

 I hope it is just a silly mistake. Can anyone help?

 Regards,

 David

 

 NOTE: The information in this email and any attachments may be
 confidential and/or legally privileged. This message may be read, copied
 and used only by the intended recipient. If you are not the intended
 recipient, please destroy this message, delete any copies held on your
 system and notify the sender immediately.

 Toshiba Research Europe Limited, registered in England and Wales
 (2519556). Registered Office 208 Cambridge Science Park, Milton Road,
 Cambridge CB4 0GZ, England. Web: www.toshiba.eu/research/trl
 http://www.toshiba.eu/research/trl


 
 This email has been scanned for email related threats and delivered
 safely by Mimecast.
 For more information please visit http://www.mimecast.com
 


 ___
 Discuss-gnuradio mailing list
 Discuss-gnuradio@gnu.org
 https://lists.gnu.org/mailman/listinfo/discuss-gnuradio



___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio




NOTE: The information in this email and any attachments may be confidential 
and/or legally privileged. This message may be read, copied and used only by 
the intended recipient. If you are not the intended recipient, please destroy 
this message, delete any copies held on your system and notify the sender 
immediately.

Toshiba Research Europe Limited, registered in England and Wales (2519556). 
Registered Office 208 Cambridge Science Park, Milton Road, Cambridge CB4 0GZ, 
England. Web: www.toshiba.eu/research/trl
---
 This email has been scanned for email related threats and delivered safely by 
Mimecast.
 For more information please visit http://www.mimecast.com
---

___
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio