Skip to content

Rpps

rpps

RPPS: RF Parameter Processor Suite, a generic signal processor/generator library

Everything is driven by operators: * encodes / modulates / scrambles, / undoes it, + runs a DSP stage, >> writes to a sink. The data carries its sample rate and the state of every stage from block to block. The design (the model, categories, contracts, streaming rules) is in rpps.base; how to use it is in the guides of the documentation site (https://anonoei.github.io/RPPS/).

Where things are

Packages follow the categories of rpps.base; data goes samples -> symbols -> channel bits -> data bits -> packets.

Package What is in it
rpps.source files and their formats, WAV, SigMF, sockets, radios through pysdrlib (imported only when used); sinks
rpps.signal filters (FIR, IIR, windows, pulses, fractional delay, polyphase channelizer), sample (resampling), channelize, DCBlock, Deemphasis, Conjugate, channel (the simulated medium); loops (the per-sample DCBlock, Deemphasis)
rpps.sync first class: time.OerderMeyr, phase.MPower, phase.DDCarrier, equalize.BlockLS, CPSync, tracked by track; FrameSync, Delimiter, PilotPhase, PilotEqualizer, Align, Puncture, Acquire, Lock, AcquireFEC, acquire_code, Squelch, AGC, PeakAGC, Burst, BurstTx, Bursts (many carriers, a burst time plan), PlanTx, Preamble, ToneLock. Second class: loops (MM (Gardner), TLL, Costas, AGC, PeakAGC, Squelch, pll, LMS, CMA)
rpps.wave Shape/Matched, Stagger, FM/FMDemod, OFDMTx/OFDMRx, AMDemod, SSBDemod, demod; loops (the per-sample AMDemod)
rpps.symbol Constellation (PSK, QAM, APSK, ASK), Differential, Spread/Despread, Carriers, Header, Pilots, PhaseScramble
rpps.code FEC, interleaving, rate matching (code.types), scramblers (code.scram), Line, Marker, Uncoded
rpps.link CRCs, HDLC, Header (fields, CRC, payload length)
rpps.grid resource grids of OFDM systems: LTE and 5G NR cell search, grids, physical channels
rpps.profile a whole signal from one config file, both directions: loading, steps, header-driven control, runners
rpps.parallel a profile's frame-parallel region: executors, scheduler, batch kernels
rpps.sequence recurrences, Gold sequences, chip codes, words: what scramblers, spreaders and searches share
rpps.plan burst time plans (TDMA, MF-TDMA, hopping, trains): superframes, frames, timeslots, burst types, assignments; from a definition, a forward link's tables (DVB-RCS2) or the bursts themselves
rpps.analysis outside the data path: spectra, rates, surveys, blind analysis of modulation and FEC; can write definitions
rpps.base Data, Pipe, Stage, BitStage, Pipeline, Stream, Tee, type tags, control, kernels
rpps.math, rpps.utils, rpps.viz finite fields and GF(2) algebra; helpers; plots (pip install rpps[viz])

Imports run down this list: nothing in the data path imports analysis, profile or parallel (tests/unit/policy/test_layering.py; the one exception is AcquireFEC, which imports analysis.identify inside the call). import rpps loads numpy and RPPS only: no scipy, matplotlib or pysdrlib until something asks for them.

Constellations, pulses, filters, sequences, scramblers, codes, headers, tables and profiles are definitions that ship with the package (python -m rpps ls lists them; rp.load("<resource>/<name>") loads any); add your own with rpps.add_config_path. How hard decoders and timing work is rpps.set_effort (levels and measured gains in rpps._effort). The per-sample loops and decoders run in C++ (rpps._native) with a Python fallback.

rpps._effort

How hard the receiver works: speed against recovered SNR

rp.set_effort("max")                 # from now on
with rp.effort("fast"):              # for a block of code
    out = rx(block)
RPPS_EFFORT=max python ...           # for a process

Levels (looked up when a stage or decoder runs, so a level can change mid-stream):

fast       the cheapest work that still decodes at good SNR: max-log demapping, half the decoder iterations, half
           the polar list, one Chase bit less, cubic timing interpolation
balanced   the default: what each definition says (its iterations, list, Chase bits, demapper, min-sum), timing
           interpolation that keeps the interpolation error under the pulse's own truncation at 3 samples per
           symbol and more
max        the most SNR at more cost: decoders iterate further (up to 4x; each codeword still stops when it
           converges, so the cost is mostly near the threshold), LDPC by sum-product, 4x the polar list, one Chase
           bit more, log-MAP turbo decoding, a timing interpolator at the pulse's own floor at 2 samples per symbol

A definition's settings stay the base: a level scales them (an LDPC definition with 50 iterations runs 50 balanced, 200 max), and a value set on an operator is that operator's base. rpps rx --effort sets it from the shell.

Setting fast max
LDPC / turbo / TPC iterations (iters) x0.5 x4, stopping early
LDPC check update (check) min-sum sum-product
Polar list (list) x0.5 x4 (successive cancellation lists 4)
TPC Chase-II bits (chase) -1 +1
Max-log or exact (maxlog: demapper, BCJR, turbo) max-log exact, no extrinsic scaling
Timing interpolation (interp_taps) cubic 12-tap windowed sinc (balanced: 8 taps below 4 sps, 12 below 2)
Blind RS scan by decodes (rs_decode_scan) off: zero syndromes only on (as balanced): seconds a stream with no RS
Blind profile retries (retries: another constellation, 2x, 1/2 the rate) none (balanced 2) 4

Measured (tools/effort_bench.py, FER 1e-1, one thread; Mbit/s at the threshold, where max iterates most):

Chain Es/N0 dB fast / balanced / max Mbit/s fast / balanced / max
LDPC DVB-S2 64800 1/2, QPSK 1.08 / 0.94 / 0.75 2.2 / 1.2 / 0.96
LDPC DVB-S2 16200 3/5, 8PSK 6.16 / 6.09 / 5.62 7.7 / 2.7 / 0.79
Turbo LTE K=6144, QPSK -0.84 / -1.31 / -1.62 1.6 / 0.85 / 0.10
Turbo LTE K=40, QPSK -0.34 / -0.41 / -0.49 0.47 / 0.24 / 0.073
Polar NR DCI (K 63, E 432), QPSK -4.97 / -5.25 / -5.67 0.22 / 0.12 / 0.032
Polar NR PBCH, QPSK -8.50 / -8.85 / -9.32 0.19 / 0.097 / 0.029
Polar (256,128) + CRC-16, QPSK 1.29 / 1.13 / 0.90 0.92 / 0.38 / 0.098
TPC (64,57)^2, BPSK 2.81 / 2.16 / 1.69 0.36 / 0.13 / 0.032
Conv K7 1/2 (Viterbi), QPSK 3.61 / 3.61 / 3.61 7.9 / 5.6 / 5.6

Timing at 2 sps: EVM floor -28.0 / -48.5 / -55.4 dB (pulse truncation -56) at the same speed.

Other decoding behaviour worth knowing:

  • LDPC is layered (checks coloured once per code), about half the iterations of flooding: normalized min-sum, or sum-product at max (phi tabulated, 1.7x min-sum's time an iteration, fewer iterations).
  • Soft values go as far as something uses them: additive descrambling flips LLR signs, Forney deinterleaving moves LLRs, BCJR hands on a-posteriori LLRs (RS uses them for erasures, keeping two checks spare), differential decoding is the product detector y conj(y[n-1]).
  • A decoder returns its status, it never keeps it (decode(x, status=True)). A code step puts the errors on its output (data.errors, not carried further) and sets data.failed from them (the last code with a verdict decides); later steps carry failed, and a link header drops a frame with any failed item whatever its CRC says. The parallel region drops such rows.
  • Under 4 sps Oerder & Meyr takes its square-law line at 2, 4... times the rate, to 4 samples a symbol (at 2 sps it aliased onto its mirror); it times from 1 sample a symbol.

Functions:

Name Description
level

The effort level in force

set_effort

Set the effort level from now on: "fast", "balanced" or "max". Returns the level it replaces

effort

The effort level for a with block

get

A setting at the level in force

interp_taps

Taps of the timing interpolation at the level in force for sps samples per symbol: balanced keeps cubic (4) from 4

scale

A count at the level in force ("iters", "list"): its own (base) scaled, at least 1

shift

A count at the level in force ("chase"): its own (base) plus the level's step, at least 1

choice

A choice at the level in force ("maxlog", "check"): the level's, else the operator's own (base)

level

level()

The effort level in force

Source code in src/rpps/_effort.py
def level():
    """The effort level in force"""
    return _level

set_effort

set_effort(level)

Set the effort level from now on: "fast", "balanced" or "max". Returns the level it replaces

Source code in src/rpps/_effort.py
def set_effort(level):
    """Set the effort level from now on: "fast", "balanced" or "max". Returns the level it replaces"""
    global _level
    old, _level = _level, _check(level)
    return old

effort

effort(level)

The effort level for a with block

Source code in src/rpps/_effort.py
@contextlib.contextmanager
def effort(level):
    """The effort level for a `with` block"""
    old = set_effort(level)
    try:
        yield
    finally:
        set_effort(old)

get

get(name)

A setting at the level in force

Source code in src/rpps/_effort.py
def get(name):
    """A setting at the level in force"""
    return SETTINGS[name][_level]

interp_taps

interp_taps(sps)

Taps of the timing interpolation at the level in force for sps samples per symbol: balanced keeps cubic (4) from 4 samples a symbol, where its error (-49 dB) is under the pulse's own truncation, takes 8 under it (cubic: -26 dB at 2), and 12 under 2 samples a symbol (a band-limited signal sampled close to its width: 8 taps lose a few dB there)

Source code in src/rpps/_effort.py
def interp_taps(sps):
    """Taps of the timing interpolation at the level in force for `sps` samples per symbol: balanced keeps cubic (4) from 4
    samples a symbol, where its error (-49 dB) is under the pulse's own truncation, takes 8 under it (cubic: -26 dB at 2),
    and 12 under 2 samples a symbol (a band-limited signal sampled close to its width: 8 taps lose a few dB there)"""
    v = SETTINGS["interp_taps"][_level]
    return v if v is not None else (4 if sps >= 4 else 8 if sps >= 2 else 12)

scale

scale(name, base)

A count at the level in force ("iters", "list"): its own (base) scaled, at least 1

Source code in src/rpps/_effort.py
def scale(name, base):
    """A count at the level in force ("iters", "list"): its own (`base`) scaled, at least 1"""
    return max(1, int(round(base*SETTINGS[name][_level])))

shift

shift(name, base)

A count at the level in force ("chase"): its own (base) plus the level's step, at least 1

Source code in src/rpps/_effort.py
def shift(name, base):
    """A count at the level in force ("chase"): its own (`base`) plus the level's step, at least 1"""
    return max(1, int(base) + SETTINGS[name][_level])

choice

choice(name, base)

A choice at the level in force ("maxlog", "check"): the level's, else the operator's own (base)

Source code in src/rpps/_effort.py
def choice(name, base):
    """A choice at the level in force ("maxlog", "check"): the level's, else the operator's own (`base`)"""
    v = SETTINGS[name][_level]
    return base if v is None else v

rpps.errors

Exceptions

Classes:

Name Description
RPPSError

Base of the RPPS exceptions

StreamError

Data does not fit the stage or stream it was given to (wrong type, rate or state)

ConfigError

A definition (modulation, code, scrambler...) does not exist or is malformed

ConfigWarning

A definition or profile step has a key nothing read: a misspelling, or a setting the method it names does not take

NoLock

No signal to lock to (rpps.sync.Lock): reason says why, line is the symbol-rate line's strength when one was measured

RPPSError

Bases: Exception

Base of the RPPS exceptions

StreamError

Bases: RPPSError

Data does not fit the stage or stream it was given to (wrong type, rate or state)

ConfigError

Bases: RPPSError, LookupError

A definition (modulation, code, scrambler...) does not exist or is malformed

ConfigWarning

Bases: UserWarning

A definition or profile step has a key nothing read: a misspelling, or a setting the method it names does not take

NoLock

NoLock(reason, line=None)

Bases: RPPSError

No signal to lock to (rpps.sync.Lock): reason says why, line is the symbol-rate line's strength when one was measured

Source code in src/rpps/errors.py
def __init__(self, reason, line=None):
    super().__init__(reason)
    self.reason, self.line = reason, line