Friday, August 23, 2019

Re: [Discuss-gnuradio] Create a general block using a GRC 'misc Python block'

OK, I came up with a viable solution:
- generate a string with comma-separated values
- calculate the number of entries
- scan the string, storing the 1's and 0's as bytes in output_items[0]

This avoids the problem of appending data to a numpy array. If you are
interested in the finished Morse code generator, see
https://pastebin.com/XJqDzh6K

Cheers!
--
Barry Duggan KV4FV

On Wed, 21 Aug 2019 19:43:35 -0400, Barry Duggan wrote:

Hi,

I would like to write a source block using a GRC 'misc Python block'
which reads text from 'input' and generates a vector with a variable
number of 1's and 0's depending on the text. My problem is determining
how to address the output vector to store/append the values. Can this
even be done in Python? My attempts to create a general block using the
GRC 'misc Python block' have failed because it doesn't recognize the
"general_work()" method.

So, my questions are:

1) Can I append a value to output_items[0] using numpy? Wouldn't that
create another array?
2) Can I use a GRC 'misc Python block' at all, or must I create an Out
Of Tree block?

I haven't found any of the GR tutorials which address this issue.

Any help or direction will be appreciated greatly!
--

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

No comments:

Post a Comment