PDU Lambda

From GNU Radio
Jump to navigation Jump to search

Added in 3.10

This block allows stateless manipulation of PDU metadata fields and uniform vectors through python lambda functions. In uniform vector mode, the lambda function will be applied with the python-ified uniform vector as the argument. In metadata dictionary mode, the lambda function will be applied to the python-ified value associated with the PMT key the block is configured with.

The following python modules are imported for use:

import numpy as np
import pmt, math, time

These should also be imported in the flowgraph implementing this block (if utilized). Exceptions during the function call will be caught and printed to the screen. In the event an exception is thrown, the data will be emitted as it was received.

Examples of use:

  • Phase demodulation of a complex PDU: Uniform Vector Mode with function:
   lambda x: np.unwrap(np.angle(x))
  • Scale metadata field `val1`: Metadata mode, separate QT range block with name `k`:
   lambda x: k*x

Parameters

(R): Run-time adjustable

Function (R)
default: 'lambda x: x*10'
Mode (R)
options: [Metadata, Uniform Vector, Raw Message]
Key (R)
default: 'pmt.intern("key")'

Messages

Inputs

pdu
input message

Outputs

pdu
output message

Example Flowgraph

This flowgraph can be found at [1]

Pdu lamdba chirp fg.png

Example Output

Pdu lambda chirp out.png

Source Files

C++ files
TODO
Header files
TODO
Public header files
TODO
Block definition
[2]