Gr.hier_block2 in Python

So, I’ve been thinking about my ideas with respect to a “universal”
source block that would allow runtime selection of FCD, UHD, or RTL-SDR
blocks.

Is it possible to specify a source block purely in Python using
gr.hier_block2?

If so, then the Python code could construct and plug in the appropriate
actual source block “under the covers”, based on some
yet-to-be-determined syntax at runtime. It could even use the
conditional-importing goo in Python to decide whether you have
any/all of the appropriate hardware-specific support configured in
the build.


Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium

On Wed, Apr 18, 2012 at 18:01, Marcus D. Leech [email protected]
wrote:

Is it possible to specify a source block purely in Python using
gr.hier_block2?

Yes. Just specify the input signature with gr.io_signature(0,0,0),
and the output with whatever you need, probably gr.io_signature(1,1,
gr.sizeof_gr_complex) .

Internally just connect the output of whatever block you instantiate
to the output of the hier_block2 the usual way.

Johnathan