Python Block Tags

From GNU Radio
Jump to navigation Jump to search

Template:TutorialNavigation

TODO:

  • use a threshold
  • set a tag when threshold exceeded
  • feed in a noise source (average it?)
  • tag blocker
  • block to read tag, then change the output
  • make a picture associating tags with samples

The flowgraph will use two Embedded Python Blocks for detecting when the input signal crosses the threshold and setting a tag for it and then reading the tag and updating an output counter with the time since the last detection.

The previous tutorial, Python Block Message Passing demonstrates how to send and receive messages using the Embedded Python Block. The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.

Tags Overview

Tags are a way to convey information alongside digitized RF samples in a time-synchronous fashion. Tags are particularly useful when downstream blocks need to know upon which sample the receiver was tuned to a new frequency, or for including timestamps with specific samples.

Where messages convey information in an asynchronous fashion with no clock-based time guarantee, tags are information which are associated with specific RF samples. Tags ride alongside digitized RF samples in data streams and vectors, including Complex Float 32, Float 32, Byte and all of the other formats.

More information about tags can be found here: Stream Tags

Creating Test Signal

A test signal is needed in order to write tags inside a threshold detection block. Begin by dragging in the blocks for the input signal:

  • GLFSR Source
  • Repeat
  • Multiply Const
  • Add Const
  • Single Pole IIR Filter
  • Throttle
  • QT GUI Time Sink

Change all of the blocks to be Float input and output. The flowgraph should now look like the following:

Threshold: Defining the Block

Threshold: Writing the Tags

The next tutorial, Low Pass Filter Example, demonstrates how to use filtering blocks in GNU Radio.