# Numpy to blob

**URL:** <https://www.ruby-forum.com/t/numpy-to-blob/236165>\
**Category:** GNU Radio\
**Created:** [August 11, 2013, 11:20pm UTC](https://www.ruby-forum.com/t/numpy-to-blob/236165 "2013-08-11T23:20:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 11, 2013, 11:20pm UTC](https://www.ruby-forum.com/t/numpy-to-blob/236165/1 "2013-08-11T23:20:42Z")

</div>

Hi,

in pmt\_to\_python.py, there is the following function:

def numpy\_to\_blob§:  
p = p.view(np.uint8)  
b = pmt.make\_blob(len§)  
pmt.blob\_data(b)[:] = p  
return b

What is the assumed input here? It doesn’t seem to work with an ordinary  
1D NumPy uint8 array. The pmt.make\_blob() function wants to behave like  
a C++ function, and expects two arguments, address and array length.

What is the best way to convert NumPy arrays to blobs?

(grextras and all the other stuff Josh was pointing to a couple of days  
ago seem to have gone from github.)  
Thanks,  
Peter
