Embedded Python Block

From GNU Radio
Revision as of 18:17, 16 September 2019 by 777arc (talk | contribs)
Jump to navigation Jump to search

Allows you to create a new (custom) block, in Python, without needing to make and install an Out of Tree Module (OOT). The example block (pre-populated code when you add the block to your flowgraph) simply takes the input stream and multiplies it by a constant. Note that the structure of this Python block matches the structure of an Out of Tree Module (OOT) Python block, it's essentially a Python OOT block built into a grc flowgraph.

For some platforms the open with Default Text Editor button may do nothing, in which case you have to manually choose the text editor.

When you update the Python code, as long as there are no errors the block will automatically update. If you are adding new code and it seems like nothing is changing, there is probably an error in your code.

Note that every parameter needs a default argument, due to the way your code gets parsed, and if you have a vector length equal to a variable, the default value must be "hardcoded".

Parameters

You decide the parameters of your custom block =)

Example Flowgraph

Insert description of flowgraph here, then show a screenshot of the flowgraph and the output if there is an interesting GUI. Currently we have no standard method of uploading the actual flowgraph to the wiki or git repo, unfortunately. The plan is to have an example flowgraph showing how the block might be used, for every block, and the flowgraphs will live in the git repo.