TutorialsUsingMessageBlocksPython

From GNU Radio
Jump to navigation Jump to search

Using Message Sinks and piping data to Python

Don't use vector sinks

Seriously, that's not what they were made for. Don't use them.

How to do it: message sinks and sources

Messages provide a method to pass data from the Python domain into the flow graph, or C++ domain, and vice versa. This is useful if you have a flow graph that does some heavy lifting signal processing, and have some simple Python-based post-processing. Some of the graphical sinks use this feature; the data is generated in C++ and then passed to Python which in turn runs the display code.

msg-sink.png

This figure illustrates how it works. A message sink is a sink in a flow graph sense. Any data piped into the message sink is then packed into a message. This message can be fetched from outside the flow graph. Conversely, a message source may be used to inject data into a running flow graph, however it is not easily possible to specify the timing.