Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU Radio: Set minimum input/output buffer size for a Python block

I am writing my own GNU Radio block in Python, and I want to set a minimum buffer size for both (or either) the input and output buffers of that block.

Is there a function or piece of code that can do this?

like image 642
Doe Avatar asked Oct 31 '25 22:10

Doe


1 Answers

You can only set the minimum output buffer size (that's not a problem; every input buffer is the output buffer of another block), using the gr.block.set_min_output_buffer(port, size) call, for example by doing:

  • by adding the call def __init__(self): gr.sync_block.__init__(self, name="block_with_buffer", in_sig=[numpy.float32], out_sig=[numpy.float32]) self.set_min_output_buffer(2**20) in your constructor, or
  • by calling
    your_block_handle.set_min_output_buffer(2**20)
    in whatever python script you're using to set up your flow graph, or
  • by using GNU Radio Companion's "advanced" tab (in your block's property dialog) to set the minimum output buffer size.

However, GNU Radio forgot to wrap that call in its python block class. Hence, you currently can't use that with python blocks, sorry, only with C++ blocks. I'm currently writing a patch for that; if all goes well, you'll see this on the master branch soon :)

like image 58
Marcus Müller Avatar answered Nov 02 '25 13:11

Marcus Müller