Analysis
rpps.analysis ¶
Analysis: blind estimation and measurement at any representation, outside the data path. The tree follows what is analysed, the way config/ and the implementation packages do:
- spectrum: what is in a capture and at what rate. find (the signals' boxes at a false-alarm rate, the streaming Finder), signal (the survey: find_signals, Survey), psd, cyclic (symbol rate and carrier lines with a calibrated false alarm, the SCF), scf (every cycle frequency, FRESH), pencil (matrix-pencil lines), waveform (tones, OFDM and which system, bursts, envelope), ofdm_pilots (an OFDM grid and its pilots), burst (TDMA bursts on a shared preamble), separate (two co-channel signals), hopping (frequency hopping)
- modulation: what carries the symbols (rate, timing, modulation, offset and phase are rp.sync.detect). cumulants (the constellation's family, blind to noise), fsk (FSK / MSK / GMSK), cpm (GMSK and SOQPSK by a per-survivor detector), pm (residual-carrier PM and its subcarriers), quality (a gate on hard decisions; Es/N0 is rp.sync.quality), impairments (compression, IQ imbalance, phase noise, neighbours), cancel (regenerate and subtract: what hides under a signal)
- sequence: what was XOR'd in or spread with. recurrence (every recurrence to degree 24, LFSRs, keystreams), scrambler (self-synchronising and additive scramblers), spread (DSSS chip rate and code)
- code: which code. conv (puncture: patterns on a known mother code; rsc: turbo constituents and interleaver; tcm: trellis-coded modulation), block (linear: length, alignment and checks by rank, BCH / cyclic, product; ldpc; rs; polar), interleave (block and Forney interleavers)
- framing: how the stream is cut. frames (frame period and unique word on symbols), payload (what decoded bits carry), telemetry (PM telemetry end to end), crc (the CRC frames carry: generator, init, xorout, what it covers), fields (what each bit of a header is), marked (frames behind a sync marker, their scrambler and RS code)
- code/conv/mother, framing/bits: a convolutional mother code's generators; sync markers, frame length and HDLC on bits
- identify: which code a hard-bit stream carries, peeling layers (
identify, which rp.sync.AcquireFEC runs,solve) - result: what the searches return (Hypothesis, Report, Guess) and
pick - signal_profile:
profile(source), every step that processes each signal in a capture, and what is left unsolved - catalogue: measured features to named systems (config/system), with the reasons
Results feed the configured stages (
Guess.savewrites a config/fec definition, a found punctured code as a child of its mother code; rp.sync.Detection fills meta.stream.det;identify.CodeDetectionnames the profile that decodes a stream).
Which tool answers which question¶
Tools for signals no definition covers. Each states its statistic and chance level, so "nothing found" is an answer; each
module's docstring has the method, reference and limits. Numpy only, outside the data path (nothing in the data path
imports it, except AcquireFEC inside the call). Most take baseband at a few times the signal's width (some noise floor
beside it), locked symbols, or bits. identify.solve peels layers off a decoder's output in turn; structure that holds
at every alignment (constant bits, idle words) is not taken for a code. Rank methods need about n + 48 clean words of n
bits; strong codes at low SNR are beyond them on channel bits.
What is it, and at what rate
| Question | Tool | How (and limits) |
|---|---|---|
| symbol rate, carrier order and offset | spectrum.cyclic.features |
lines of \|x\|^2, x^M and the discriminator against a median floor, calibrated false alarms; rate by harmonic comb |
| every cycle frequency (signals sharing a band) | spectrum.scf.cycle_frequencies, coherence |
FFT-accumulation spectral coherence, conjugate too |
| which constellation | modulation.cumulants.classify |
C40 ... C84 against each constellation's; orders within QAM / ASK need the SNR |
| FSK / MSK / GMSK, CPM index | modulation.fsk.analyze, cpm_index |
instantaneous frequency; h from the phase lattice |
| GMSK / SOQPSK bits, which pulse | modulation.cpm.demodulate, identify |
per-survivor Viterbi, each survivor its own carrier loop |
| OFDM pilot pattern | spectrum.ofdm_pilots.discover, grid |
grid from CP peaks; period from coherent repetition; pilot lattice, boost, empty cells |
| TDMA bursts, frame and slots | burst.demodulate |
each burst on its shared preamble, mid-amble or postamble (shared_segments), data-aided carrier and phase; its symbol clock followed; LLRs (Bursts.llrs); blind when nothing is shared |
| two co-channel signals of equal power | spectrum.separate.estimate, separate |
each one's carrier, timing and phase; joint sequence estimate |
| which named system | catalogue.match, features |
measured features against systems from their standards, weighted |
| which shipped profile | profile |
each fixed-rate one's receive on its channel; its checks verify |
| PM, residual carrier, subcarriers | modulation.pm.analyze, subcarrier, nrz |
carrier tracked, phase around it |
| DSSS | sequence.spread.period, chip_rate, code, despread |
windowed autocorrelation variance; code from eigenvectors |
| frequency hopping | spectrum.hopping.track, dehop |
short-time spectrum clustered into channels and dwells |
| kind of waveform | spectrum.waveform.classify |
tones, OFDM numerology against known systems, bursts, envelope kurtosis |
| tones in a short record, neighbours | spectrum.pencil.lines, modulation.impairments.neighbours |
matrix pencil; bands split at valleys and level steps |
Is the lock good, and what is left
| Question | Tool | How |
|---|---|---|
| can hard decisions be trusted | modulation.quality.gate |
rotation, drift, near-boundary decisions against the measured Es/N0 |
| how much is locked; what is underneath | modulation.cancel.cancel, align |
regenerate, subtract, residual against the floor |
| amplifier, IQ, phase noise | modulation.impairments.amplifier, iq, phase_noise |
ring gains and turns; image ratio; phase error from neighbours |
| separate an interferer | spectrum.scf.fresh |
least-squares FRESH filter trained on a reference (not blind) |
Which code, scrambler, interleaver
| Question | Tool | How |
|---|---|---|
| convolutional code (rate 1/n, K) | code.conv.mother.scan_conv, scan_defined_conv |
generator-pair parity relation against chance; the configured codes by re-encoding |
| puncture of a known mother code | code.conv.puncture.search |
every rate P/(P+1) pattern through the Viterbi decoder |
| Reed-Solomon over GF(256) | code.block.rs.search |
shared roots by Galois-field Fourier transform at every byte phase |
| binary block code | code.block.linear.solve_block |
length from rank deficiency, checks from the null space; then cyclic / BCH, product or LDPC |
| block code from soft values (too noisy for the rank) | code.block.linear.soft_dual, soft_find_length, solve_block(llr=, soft_length=) |
subsets of the likeliest clean words; checks kept on the tanh-product syndrome (BCH(63,51) named to 5 dB Eb/N0, hard bits above 6) |
| additive scrambler | sequence.scrambler.additive_search, explain, search |
Berlekamp-Massey over windows; polynomials factored into known scramblers |
| scrambler taps | sequence.recurrence.search, lfsr, keystream |
every recurrence to degree 24 at once; any degree by Berlekamp-Massey |
| trellis code on PSK labels | code.conv.tcm.search |
Walsh-Hadamard over label windows, every rotation and labelling |
| turbo constituent and interleaver | code.conv.rsc.constituent, turbo_interleaver, turbo_interleaver_soft |
2-bit-label check; permutation from clean or noisy frames |
| LDPC (IRA, QC, large) | code.block.ldpc.staircase, qc_staircase, qc_dual, qc_size, progressive |
one GF(2) solve per structure (a DVB-S2 table from k/360 + 12 clean frames) |
| cyclic / BCH roots | code.block.ldpc.roots |
zero counts at every beta^j against chance |
| polar frozen bits | code.block.polar.frozen, recognize, search |
per-position likelihood over frames (rate 1/2 at -2 dB from 200 frames) |
| interleaver | code.interleave.block_search, forney_search, column_delays |
rank deficiency for the size; candidates scored by the code coming back |
What the bits are
| Question | Tool | How |
|---|---|---|
| frame period and unique word on symbols | framing.frames.find, cut, bursts |
coherence per position over candidate periods |
| sync markers, frame length, HDLC | framing.bits.find_sync, frame_length, scan_hdlc |
hits at a period, autocorrelation, flags and FCS against chance |
| frames behind a sync marker, their scrambler and code | framing.marked.layer |
a marker at one period; scramblers restarted per frame; RS words decoding at each depth, against chance |
| PM telemetry end to end | framing.telemetry.analyze |
BPSK per subcarrier, line code, frame period, counters |
| what each header bit is | framing.fields.map |
constants, counters (either bit order, per terminal), ids, length fields, enums, random; a link header definition |
| code blocks a burst is made of | burst.units |
burst lengths as overhead + n units, the unit to a symbol or so |
| a burst time plan, and whether one explains the bursts | burst.learn_plan, check_plan |
BTU, frame, slots from the starts; each burst in a slot of its carrier and kind, the plan's origin and clock fitted (rp.viz.bursts, burst_timing, plan_evidence draw them) |
| a burst's layout, and how many transmitters | burst.demodulate with rp.viz.burst_stack, burst_terminals |
the bursts of a kind lined up on their known symbols (where they agree); a cluster per transmitter in offset and power |
| which CRC, over which bits | framing.crc.search |
GCD of frame differences (RevEng's method on bit streams); init and xorout from two lengths; config/crc names |
| framing in decoded bits | framing.payload.signatures |
E1/T1, ATM, GFP, HDLC, IPv4, CCSDS ASM, MPEG-TS, fixed bits, each against chance |
| structured, scrambled or random | framing.payload.verdict |
signatures, bias, linear complexity, compressibility |
| encrypted, or only compressed | framing.randomness.test |
NIST SP 800-22 frequency, block, runs, serial, approximate entropy, cusum; byte chi-square and entropy |
Modules:
| Name | Description |
|---|---|
catalogue |
A catalogue of radio systems by what the blind tools measure: features in, named systems out, with the reasons |
result |
What the blind code searches return: a Hypothesis (a structure and how far its test sits from chance), a Report |
catalogue ¶
A catalogue of radio systems by what the blind tools measure: features in, named systems out, with the reasons
f = rp.analysis.catalogue.features(fsk=r, frequency=935.2e6) # from tool results (or a dict by hand)
for m in rp.analysis.catalogue.match(f)[:3]:
print(m) # "GSM (3GPP TS 45.004/45.002): 0.93 - modulation gmsk, baud 270833 ~ 270833, frame ..."
Features (any subset; a tool result fills the ones it measures, features maps them):
modulation a family name: gmsk msk gfsk 2fsk 4fsk bpsk qpsk oqpsk 8psk pi4dqpsk 16qam 16apsk 32apsk soqpsk ofdm ppm
css 8vsb pm fm am (rpps.analysis tools' own names are mapped: Detection.mod, FSK.name, cpm schemes)
baud symbol rate (Hz); chip_rate and code_length for spread signals
bt, h a Gaussian pulse's bandwidth-time, a CPM / FSK index
beta a root-raised-cosine roll-off
scs, cp OFDM subcarrier spacing (Hz) and cyclic prefix (s); pilot_spacing, pilot_step, pilot_period (symbols)
frame, slots a TDMA / TDD frame (s) and its slots
bandwidth occupied (Hz); frequency (Hz: the carrier, a weak hint: allocations differ by region)
burst True for bursts (TDMA, MF-TDMA, packets), False for a continuous carrier
sync the synchronisation signal seen: pss_sss (LTE), ssb (NR); ssb_period (s) an NR SSB burst period
subcarrier, subcarrier_baud a PM telemetry subcarrier (Hz) and its symbol rate (rp.analysis.framing.telemetry)
profile the shipped profile that decoded it (rp.analysis.profile's profile_name): strong evidence
modulation cw: an unmodulated carrier or a beacon (the waveform step's tones)
Each system lists values (a number, a list of allowed numbers, a (lo, hi) range, or a set of names) with a relative
tolerance. A feature both sides have scores +weight when it agrees and -weight when it contradicts; the score is the
sum over the most it could have been plus prior (so a fit on one feature ranks below a fit on several: 1 is
approached as more agrees; below 0 more contradicts than agrees), and the reasons say which. Nothing measured that a
system lacks counts either way. A positive score needs two agreeing features that are not weak (frequency,
bandwidth), or one strong one (baud, chip_rate, scs, code_length, profile, subcarrier): a carrier's frequency alone,
or a modulation alone, names nothing. Systems the features can't tell apart are reported tied, not ordered. A blind tool reads some modulations as
others (pi/4-DQPSK as 8PSK, GMSK as MSK or 2-FSK, C4FM as 4-FSK): systems list what they are seen as too.
Classes:
| Name | Description |
|---|---|
Match |
|
Functions:
| Name | Description |
|---|---|
load_system |
A config/system definition as |
systems |
Every system in config/system (user layers too), loaded once: [dict], in reference order |
family |
A modulation name from any tool as the catalogue's family name (lower case, aliases folded) |
match |
Systems ranked by how well measured features fit (see the module): [Match], best first; systems no feature |
features |
The catalogue's features from rpps.analysis results: det (modulation.Detection), fsk (fsk.FSK), cpm (cpm.CPM or a |
Match ¶
match: name, ref, score (-1..1), agree [(feature, reading)], contradict [(feature, reading)], tied (the names
of other systems the features can't tell this one from: the same score and agreement)
Source code in src/rpps/analysis/catalogue.py
load_system ¶
A config/system definition as match takes it: {"name": its title, "ref", "id": its reference, "profile",
"tags", and each feature}
Source code in src/rpps/analysis/catalogue.py
systems ¶
Every system in config/system (user layers too), loaded once: [dict], in reference order
Source code in src/rpps/analysis/catalogue.py
family ¶
A modulation name from any tool as the catalogue's family name (lower case, aliases folded)
match ¶
Systems ranked by how well measured features fit (see the module): [Match], best first; systems no feature could be compared on are left out. tolerance: {feature: relative tolerance} over the defaults (a coarse measurement deserves a wider one)
Source code in src/rpps/analysis/catalogue.py
features ¶
features(det=None, fsk=None, cpm=None, ofdm=None, pilots=None, bursts=None, spread=None, frequency=None, **more)
The catalogue's features from rpps.analysis results: det (modulation.Detection), fsk (fsk.FSK), cpm (cpm.CPM or a scheme name), ofdm (waveform.OFDM), pilots (ofdm_pilots.Pilots), bursts (burst.Bursts or waveform.Bursts), spread ((chip rate, code length)), frequency (Hz); more: any feature by name (it wins)
Source code in src/rpps/analysis/catalogue.py
result ¶
What the blind code searches return: a Hypothesis (a structure and how far its test sits from chance), a Report
of all of them, a Guess (a definition to save), and pick, the one that stands out at one alignment only
Classes:
| Name | Description |
|---|---|
Hypothesis |
|
Report |
Ranked hypotheses and a verdict |
Guess |
A guessed definition (a code, a scrambler, a CRC). Decoding only happens from a saved config: |
Functions:
| Name | Description |
|---|---|
pick |
The best hypothesis that stands out, if the code fits these bits at its alignment only |
Hypothesis ¶
Attributes:
| Name | Type | Description |
|---|---|---|
p |
The chance of a z this high from chance alone (one-sided Gaussian tail) |
Source code in src/rpps/analysis/result.py
Report ¶
Ranked hypotheses and a verdict
Methods:
| Name | Description |
|---|---|
p |
h's p-value (the best's by default) over every hypothesis tried (Bonferroni: its own times |
Attributes:
| Name | Type | Description |
|---|---|---|
verdict |
The best hypothesis if it stands out from chance, else None |
Source code in src/rpps/analysis/result.py
p ¶
h's p-value (the best's by default) over every hypothesis tried (Bonferroni: its own times trials, at
most 1): what the z_crit threshold tests at 0.01
Source code in src/rpps/analysis/result.py
Guess ¶
A guessed definition (a code, a scrambler, a CRC). Decoding only happens from a saved config: save it, then load
it (rp.code.load("block/guess/
Methods:
| Name | Description |
|---|---|
save |
Write config/ |
Source code in src/rpps/analysis/result.py
save ¶
Write config/
Source code in src/rpps/analysis/result.py
pick ¶
The best hypothesis that stands out, if the code fits these bits at its alignment only
A code fits its own bits at one alignment (puncture phase, codeword start). Bits that fit at several did not come from it: constant bits (an unmodulated carrier) are a codeword of every linear code at every alignment, and bits repeated by a symbol rate locked too high fit a repetition code at all but a few. fits(h, other): other is as good
Source code in src/rpps/analysis/result.py
rpps.analysis.burst ¶
TDMA bursts demodulated one by one: each acquired on the preamble the bursts share, as a TDMA receiver must
r = rp.analysis.burst.demodulate(x, Fs) # or mod=, baud=, preamble= (symbols) when known
print(r) # "12 bursts, qpsk at 100.0 kBd, a 48-symbol preamble; frame 4.615 ms, 8 slots; EVM 6.1% median"
b = r.bursts[0]
b.symbols, b.bits, b.cfo, b.evm, b.slot, b.frame # carrier-, timing- and phase-corrected symbols, decided bits
Every burst comes from another transmitter (or the same one after a gap), with its own carrier offset, phase and symbol timing, and is too short to train loops on: so each is acquired on its own, data-aided, from the preamble.
- rpps.analysis.framing.frames.bursts gates the bursts (bursts that touch cut apart at a guard time or a power step:
frames.split) and acquires each blind (rate, modulation, offset); bursts too short
for that keep only their span. The modulation is the bursts' majority, the rate their median (or
mod/baud). - The preamble: the leading run of symbols the bursts agree on, as phase steps (rpps.analysis.framing.frames.preamble, or
shared_preamblefor a short one, whichever is longer), orpreamblegiven. A network's burst types each carry a unique word of their own: when the bursts share fewer thanmin_sharedsymbols, they are grouped by length and each group's own preamble found (burst_kinds); each burst is acquired on its kind's. Known symbols elsewhere (a mid-amble, a postamble:shared_segments) serve the same way, at their offset; with none at all, each burst is returned as acquired blind (Bursts.blind: its phase known only to the constellation's symmetry). Its symbols are rebuilt from the steps and turned onto the constellation (one rotation for all bursts: the M-fold phase ambiguity is the same for every burst, so their bits agree with each other). - In each burst the preamble is found by correlating its shaped waveform in pieces (the pieces' magnitudes added: a carrier offset costs little), then the fractional timing that best matches the preamble's phase steps (blind to the carrier), then from z_k = y_k conj(p_k) over the preamble: the carrier offset (the mean turn of z_k z*_{k-1}) and the phase and gain (sum z_k with the turn taken out).
- The burst's symbols, from the preamble to the end of the gate, are taken at that timing and corrected. A burst of
several
windows has its symbol clock followed (retime): the matched filter's energy peak in each window (rpps.sync.time.mat.best_tau), a line through them anchored on the preamble (the clock offset,clock). A second- phase from decisions on the constellation's points, tracked across 32-symbol windows (rpps.sync.phase.decided), follows what is left of the carrier through the data; decisions give bits, the soft demapper LLRs (llr, noise from the burst's own symbols), and the error vector magnitude. - The TDMA structure: the period of the bursts' starts (rpps.analysis.spectrum.waveform.on_off, else
frame) and the slots, clusters of the starts within a frame (to withinslot_tolsymbols): each burst's frame and slot. Limits: the clock is followed as a straight line (a constant offset over the burst), from windows of a few hundred symbols; a burst whose preamble is weaker than the data's noise floor allows is reported withokFalse and no bits.
A network's burst time plan (rpps.plan) from the bursts rp.sync.Bursts detects: learn_plan (the BTU, the frame, each
carrier's slots and the kinds of burst in them), and whether a plan, learned or told, explains the bursts:
check_plan (each burst in a slot of its carrier and kind, the plan's origin and clock fitted to them; rp.viz.bursts
draws it, folded on the superframe or along the capture).
Modules: preamble (what the bursts share), demod (each burst acquired and demodulated; the frame and slots),
plan (units, learn_plan, check_plan).
what a receiver runs is in the data path, which may not import this package.
- rpps.sync.burst:
Burst(bursts gated from a stream by energy),BurstTx(bursts placed in a stream) - rpps.sync.plan:
Bursts(bursts cut where a burst time plan puts them),PlanTx - rpps.profile.burst: the runners for a profile's
burststep (receive and transmit) - rpps.plan: burst time plans as definitions; rpps.viz.plots.bursts draws bursts against them
Modules:
| Name | Description |
|---|---|
demod |
Each burst acquired on its preamble and demodulated ( |
plan |
A network's burst time plan (rpps.plan) from the bursts rp.sync.Bursts detects: the code blocks a burst is made of |
preamble |
What a TDMA network's bursts share: the preamble ( |
demod ¶
Each burst acquired on its preamble and demodulated (acquire, retime, demodulate), and the TDMA frame and slots
the bursts' starts show. See rpps.analysis.burst
Classes:
| Name | Description |
|---|---|
BurstResult |
One burst: start (sample of its preamble's first symbol, fractional), symbols, bits, llr (per bit, log(P0/P1), the |
Bursts |
What |
Functions:
| Name | Description |
|---|---|
acquire |
The preamble |
retime |
Symbol centres c (samples of x, one a symbol) with the symbol clock's offset taken out, and that offset |
demodulate |
Every burst of x, demodulated on its own from its preamble (see the module). Bursts of several kinds, each with a |
BurstResult ¶
One burst: start (sample of its preamble's first symbol, fractional), symbols, bits, llr (per bit, log(P0/P1), the
preamble's included, as bits), cfo (Hz), clock (its symbol clock's offset, a fraction: +1e-4 is 100 ppm fast), phase
(rad), gain, score (the preamble's correlation 0..1), evm (rms, of the data after the preamble), frame, slot, kind
(which of the preambles it was acquired on), known ((first, length): the known symbols in symbols), ok
Attributes:
| Name | Type | Description |
|---|---|---|
payload |
The symbols without the known ones |
Source code in src/rpps/analysis/burst/demod.py
Bursts ¶
What demodulate gives: the bursts and what they share
bursts [BurstResult], mod, baud, beta, preamble (symbols: the most common kind's), preambles (every
kind's), offsets (each kind's known symbols from the bursts' start; negative: from their end), frame (s, None), slots
(offsets within the frame, s), blind (no known symbols: each burst's phase only to the constellation's symmetry),
period (symbols: a unique word repeating that often within each burst, at its own phase (offsets [None]); a burst's
known is its first), frame (s: the period the bursts' pattern repeats at, every slot in the same frames of it; None
when the starts fall on no slot grid), plan_frame (s: the burst time plan's frame, learn_plan's: half or less of
frame where terminals get slots in alternate frames of it; None when not found or not fitting the starts)
Methods:
| Name | Description |
|---|---|
llrs |
Each demodulated burst's LLRs (of |
Source code in src/rpps/analysis/burst/demod.py
llrs ¶
Each demodulated burst's LLRs (of kind only, when given), without its known symbols' unless preamble: a
list, the bursts' lengths differing
Source code in src/rpps/analysis/burst/demod.py
acquire ¶
The preamble pre (symbols) in samples x at Fs: (start sample of its first symbol (fractional), score 0..1,
cfo (rad a symbol), phase, gain), or None when x is too short. search: (lo, hi) samples where the first symbol may be
(default: anywhere)
Source code in src/rpps/analysis/burst/demod.py
retime ¶
Symbol centres c (samples of x, one a symbol) with the symbol clock's offset taken out, and that offset
The offset is the symbol rate's, a fraction: positive when the symbols come faster than sps. It is the matched
filter's energy peak (best_tau) in each window of window symbols but those over the known symbols skip ((first, stop): a repeating
pattern's energy can peak between its symbols), unwrapped, a line through them (Theil-Sen: the median slope between
windows) turned about symbol anchor (where the preamble set the timing; with offset, the timing there from the
windows too, for an acquisition on a short word). c and 0 when fewer than three windows
Source code in src/rpps/analysis/burst/demod.py
demodulate ¶
demodulate(x, Fs, mod=None, baud=None, beta=None, preamble=None, offset=0, frame=None, slot_tol=16, min_score=0.5, min_shared=16, **kw)
Every burst of x, demodulated on its own from its preamble (see the module). Bursts of several kinds, each with a
preamble of its own (burst_kinds: by length, when they share fewer than min_shared symbols), are each acquired on
their kind's. With no preamble they share, known symbols elsewhere (shared_segments: a mid-amble, a postamble);
with none at all, each burst blind (Bursts.blind). preamble: known symbols given, offset symbols after the
burst's start (negative: before its end). kw: frames.gate's
Source code in src/rpps/analysis/burst/demod.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | |
plan ¶
A network's burst time plan (rpps.plan) from the bursts rp.sync.Bursts detects: the code blocks a burst is made of
(units), the plan learned (learn_plan), and whether a plan explains the bursts (check_plan). See rpps.analysis.burst
Classes:
| Name | Description |
|---|---|
Units |
|
NoPlan |
learn_plan found no frame period; |
PlanCheck |
check_plan's answer: how well a burst time plan explains the bursts detected. |
Functions:
| Name | Description |
|---|---|
units |
The block a burst's length is made of: lengths (symbols a burst, e.g. len(b.symbols) of a kind's bursts) as |
learn_plan |
A burst time plan (rpps.plan) from detected bursts, for a network whose forward link is not heard: its BTU, frame |
check_plan |
How well a burst time plan (rpps.plan: learned, a definition or from a forward link) explains detected bursts: |
Units ¶
units: unit (symbols), err (its standard error: the lengths are known to a few symbols, so a unit is often
only known to one either way), overhead (symbols besides the units: preamble, header, tail), counts ({units a burst:
bursts}), fit (share of bursts within tol of overhead + n*unit)
Source code in src/rpps/analysis/burst/plan.py
NoPlan ¶
Bases: ValueError
learn_plan found no frame period; scores: what it tried (as a Guess's, for rp.viz.plan_evidence)
PlanCheck ¶
check_plan's answer: how well a burst time plan explains the bursts detected.
plan; origin (plan clock ticks at the capture's first sample) and rate (the network clock's offset from the
capture's, a fraction): a capture time t [s] is plan tick origin + tclock(1 + rate); cf (the capture's centre in
the plan's frequencies); bursts (the bursts as records: freq, start, length, kind); per burst its status:
"slot" in a slot of its carrier (its start to tol of the slot's burst start), of its kind, and fitting it
"kind" in a slot whose tx type is another kind's (its unique word, kind or word in the tx type's fields)
"long" in a slot, but running past the slot's end by more than tol
"none" no slot of its carrier starts near it: the plan does not explain it
its window (rpps.plan.Window; None where "none") and error (s: its start minus its window's burst start, nan
where "none"); windows, every window starting within the bursts' span, and filled, how many bursts each holds
Methods:
| Name | Description |
|---|---|
tick |
The plan's clock at capture time t [s] |
time |
The capture time [s] of plan tick |
Attributes:
| Name | Type | Description |
|---|---|---|
explained |
The fraction of the bursts in a slot of their own kind that they fit |
|
rms |
The rms start error [s] of the bursts in slots |
Source code in src/rpps/analysis/burst/plan.py
tick ¶
units ¶
The block a burst's length is made of: lengths (symbols a burst, e.g. len(b.symbols) of a kind's bursts) as
overhead + n*unit, n the units in that burst (1, 2, 3...: MF-TDMA slots of one, two, three code blocks), or None.
Lengths are known to within the gate's slack (tol symbols), so the unit is the largest one their differences are
all near multiples of (in hold of the pairs), with at least two different multiples among them (a unit longer
than every difference fits trivially), then unit and overhead refitted by least squares. What lengths cannot tell:
the overhead is the least that fits (100 symbols and 84-symbol units read as 16 and one unit more), and a unit
whose bursts all hold an even number of it reads as twice the size
Source code in src/rpps/analysis/burst/plan.py
learn_plan ¶
learn_plan(bursts, quantum=None, max_btus=4096, clock=27000000.0, purity=0.95, tol=0.1, carriers=None)
A burst time plan (rpps.plan) from detected bursts, for a network whose forward link is not heard: its BTU, frame
period, a frame type per carrier, its slots and their tx types. Returns a Guess to save (config/plan/guess/rp.plan.load("guess/<name>")), whose plan is the Plan itself and scores what it was chosen
on (each BTU's score, each frame period's purity and why it was passed over: rp.viz.plan_evidence draws them).
bursts: rp.sync.Bursts' output (each its ctx["burst"]: carrier freq, start; its length) or dicts {freq, start, length [s], kind (a burst type: its unique word), rate}. quantum: the BTU [s] when known. carriers: [{freq, width, rate}] the bursts were detected on (rp.sync.Bursts'): each frame type's bandwidth and symbol rate.
- The BTU: the quantum of the bursts' start differences (every slot starts on the grid of its frame): the largest q
whose multiples the differences sit on, to
tolof q, made exact over the whole capture (each start's count of BTUs, over a span doubling from the first burst: the slope of a line through them), and taken only where 90% of the starts sit on its grid (a mean of differences passes near a q they only nearly fit). - The frame: the shortest period of M BTUs at which every (carrier, BTU in the frame) holds one kind of burst
(
purityof them; length clusters stand for kinds not given), with bursts at two or more places of it. - A frame type per carrier: its slots where bursts were seen (as many BTUs as the longest burst of the kind needs),
single-BTU slots between; a tx type per kind (
kindin its fields, andwordwhen the kind is a word's name), its offset the bursts' median offset from the slot's start. The superframe starts at the first burst's frame start. Only what the bursts show is learned: slots never used are single BTUs, carriers never used are not in it.
Source code in src/rpps/analysis/burst/plan.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
check_plan ¶
How well a burst time plan (rpps.plan: learned, a definition or from a forward link) explains detected bursts:
each burst placed in the slot of its carrier whose burst start is nearest its own, and judged (PlanCheck: "slot",
"kind", "long", "none"). A right plan puts every burst in a slot of its kind; a wrong BTU or frame leaves bursts in
none, or drifting through their slots (error growing with time); a wrong slot layout puts them in other kinds'.
bursts: rp.sync.Bursts' output or dicts {freq [Hz from the capture's centre], start [s], length [s], kind}, as
learn_plan takes. origin: plan ticks at the capture's first sample (a forward link's clock reference); None: voted
for (known only to a whole superframe: the one nearest the capture's start is taken), as rp.sync.Bursts acquires it (each of votes bursts spread over the capture votes for the origins that put it
on a slot of its carrier, of its kind when both are known; the most voted wins). rate: the network clock's offset.
fit: refine the origin and rate on the bursts placed (a line through their start errors, its slope taken where it is
over three standard errors), placing them again.
cf: the capture's centre in the plan's frequencies. tol: how far [s] a burst's start may be from its slot's (None:
half the shortest BTU). Plans whose sequences have different superframe durations are voted on the longest.
Source code in src/rpps/analysis/burst/plan.py
preamble ¶
What a TDMA network's bursts share: the preamble (shared_preamble, preamble_symbols), known symbols elsewhere
(shared_segments: a mid-amble, a postamble), a word repeated through each burst (periodic_word), and burst kinds,
each with a word of its own (burst_kinds). See rpps.analysis.burst
Classes:
| Name | Description |
|---|---|
Segment |
|
Functions:
| Name | Description |
|---|---|
shared_preamble |
The leading run of symbols the bursts share, as phase steps: (length in steps, steps, where it starts in each |
preamble_symbols |
Symbols of a preamble from its phase steps d[n] = s[n] conj(s[n-1]) (rpps.analysis.framing.frames.preamble), turned so |
shared_segments |
Runs of symbols every burst carries at the same place: a preamble, a mid-amble, a postamble ([Segment], longest |
periodic_word |
(unique word on the constellation, period in symbols) when long bursts hold frames with one unique word, each at |
burst_kinds |
(preambles [symbols], member [kind index or None per burst]): one shared by all the bursts, when they share at least |
Segment ¶
shared_segments: steps (d[n] = s[n] conj(s[n-1]) the bursts agree on), offset (symbols from the bursts' start
to the segment's first symbol; negative: from their end, a postamble), agree (|mean| of the steps over bursts)
Source code in src/rpps/analysis/burst/preamble.py
shared_preamble ¶
The leading run of symbols the bursts share, as phase steps: (length in steps, steps, where it starts in each
burst's symbols), or (0, None, None). Like rpps.analysis.framing.frames.preamble, but aligned on a short window (win steps
near the start, so a preamble shorter than framing's 64-step window aligns too), each burst against a dozen others'
starts (the longest, the first, some spread over the list), the reference being the burst the others agree with
most
Source code in src/rpps/analysis/burst/preamble.py
preamble_symbols ¶
Symbols of a preamble from its phase steps d[n] = s[n] conj(s[n-1]) (rpps.analysis.framing.frames.preamble), turned so
they sit on the constellation points (one rotation, chosen from the points' own symmetry)
Source code in src/rpps/analysis/burst/preamble.py
shared_segments ¶
Runs of symbols every burst carries at the same place: a preamble, a mid-amble, a postamble ([Segment], longest
first). Phase steps, so each burst's own carrier phase drops out. Each burst is aligned on a reference by a lag
within search symbols: the one with the best window of min_len steps (a known run of that length adds up to its
length, random steps to its square root), once from the start and once from the end (bursts of several lengths
sharing a postamble); the reference is the burst the others agree with most (of the first refs). A run is where
the bursts' steps lie within 45 degrees of their mean: all of 3, all but one of 4 or more (up to agree: a weak
burst's decision error), gaps of a step or two where a majority still agrees bridged; at least min_len steps, and
longer where chance would make one (M: the steps' alphabet, M-PSK; false_alarm over every position)
Source code in src/rpps/analysis/burst/preamble.py
periodic_word ¶
(unique word on the constellation, period in symbols) when long bursts hold frames with one unique word, each at
its own phase; else None. Every lag from 16 to a min_frames-th of the shortest of the tries longest bursts is
folded (_fold_coherence: O(n) a lag); at a lag, each burst's longest circular run of positions coherent from
frame to frame above thr (over 8 frames a position passes 0.8 by chance one time in 170, so a run of min_len
over every position and lag is rare, where a unique word's sit near 1). The first lag where two bursts hold such a
run, of the same length and phase steps, is the period (its multiples pass too); the word is that run's symbols
averaged over one burst's frames. A word of U symbols every P adds only U/P to an autocorrelation, which a comb
over it finds about half the time on bursts of 8 frames; the fold finds it every time
Source code in src/rpps/analysis/burst/preamble.py
burst_kinds ¶
(preambles [symbols], member [kind index or None per burst]): one shared by all the bursts, when they share at least
min_shared symbols; else one per group of bursts of a length (lengths within 16 symbols or 2 %: a network's burst
types, each with its own unique word), groups of at least min_group with at least min_shared symbols in common.
Most bursts first. A burst in no group has None (it is tried on every kind's)
Source code in src/rpps/analysis/burst/preamble.py
rpps.analysis.code ¶
Which code (see rpps.analysis)
Modules:
| Name | Description |
|---|---|
interleave |
Interleavers found blind: a block interleaver's size and shape, a convolutional one's branches and delay, and columns |
interleave ¶
Interleavers found blind: a block interleaver's size and shape, a convolutional one's branches and delay, and columns of a grid sent out of step
r = rp.analysis.code.interleave.block_search(bits) # size N (rank), then rows x columns
r = rp.analysis.code.interleave.forney_search(bits, [(12, 17, 8), ...]) # which (I, M, symbol) gives code structure back
d = rp.analysis.code.interleave.column_delays(bits, rows, cols) # each column's shift in rows (a product code's
# parity column sent a row late)
A block interleaver keeps whole codewords inside each block of N bits, so the stream's rank deficiency first shows at L = N (Sicot, Houcke & Barbier 2009) as it would at a code's length: rpps.analysis.code.block.linear.find_length finds N. Read back in the order written (each factorization N = rows x columns, either way), the code's own length shows again, short.
A convolutional (Forney) interleaver has no block: its branches delay by multiples of M symbols. Each candidate (from the standards, or a grid) is undone, and the stream is scored by the code structure that comes back: by default the strongest linear recurrence (rpps.analysis.sequence.recurrence), which a convolutional code's parity check is.
column_delays: bits are rows of cols bits, rows to a frame, and each column of a frame is a codeword of a column code
(a product code). A column sent d rows late is not; its checks hold again when it is read d rows back. The column code's
checks are found from all the columns (most are right), then each column's shift is the one they hold best at.
Classes:
| Name | Description |
|---|---|
Shape |
A block interleaver found: size (bits), offset (first block), rows, cols (written by rows, read by columns: the |
Functions:
| Name | Description |
|---|---|
recurrence_z |
How much linear code structure bits have: the z of their strongest recurrence of degree up to max_degree (0: none) |
block_search |
A block interleaver's size from the rank deficiency, then the row x column shape whose undoing shows a short code |
forney_undo |
A Forney deinterleaver: symbols of |
forney_search |
Undo each (I, M, symbol) candidate (default FORNEY) at each start (a branch and a bit within the symbol) and score |
column_delays |
Each column's shift in rows (positive: sent that many rows late) that makes it a codeword of the column code again. |
Shape ¶
A block interleaver found: size (bits), offset (first block), rows, cols (written by rows, read by columns: the order the bits came in was cols x rows), code (the code length seen once read back), deficiency
Source code in src/rpps/analysis/code/interleave.py
recurrence_z ¶
How much linear code structure bits have: the z of their strongest recurrence of degree up to max_degree (0: none)
Source code in src/rpps/analysis/code/interleave.py
block_search ¶
A block interleaver's size from the rank deficiency, then the row x column shape whose undoing shows a short code
Source code in src/rpps/analysis/code/interleave.py
forney_undo ¶
A Forney deinterleaver: symbols of symbol bits, branch j (of I, the first symbol on branch 0) delayed by
(I - 1 - j) M symbols (rpps.code.types.interleave.forney's decode, without a code object)
Source code in src/rpps/analysis/code/interleave.py
forney_search ¶
Undo each (I, M, symbol) candidate (default FORNEY) at each start (a branch and a bit within the symbol) and score the result. Returns [(score, (I, M, symbol), start bit)], best first
Source code in src/rpps/analysis/code/interleave.py
column_delays ¶
Each column's shift in rows (positive: sent that many rows late) that makes it a codeword of the column code again.
bits: frames of rows x cols bits, row by row, from offset. kw: rpps.analysis.code.block.linear.sparse_checks's.
Returns (delays (cols,), fraction of frames the column's checks hold on at that delay (cols,), checks H)
Source code in src/rpps/analysis/code/interleave.py
rpps.analysis.code.block ¶
Block codes: linear / cyclic / BCH / product, LDPC, Reed-Solomon, polar
Modules:
| Name | Description |
|---|---|
ldpc |
Blind LDPC and algebraic block codes, past what one search finds: staircase (IRA) codes, progressive reconstruction, roots |
linear |
Blind binary block codes: length, alignment, parity checks, and which kind of code it is (cyclic / BCH, product, LDPC) |
polar |
A polar code's frozen positions, blind: which of the u bits are always 0, and which construction froze them |
rs |
Blind Reed-Solomon identification: length, field, generator and alignment of an unknown RS code over GF(256) |
ldpc ¶
Blind LDPC and algebraic block codes, past what one search finds: staircase (IRA) codes, progressive reconstruction, roots
H, holds = rp.analysis.code.block.ldpc.staircase(words, k) # dual-diagonal parity (DVB-S2, 802.11n, 802.16e, 5G NR)
H, holds, rounds = rp.analysis.code.block.ldpc.progressive(llr) # checks found, frames cleaned with them, more found, ...
r = rp.analysis.code.block.ldpc.roots(words) # a binary cyclic code's roots: BCH and its distance
z = rp.analysis.code.block.ldpc.circulant_size(words, k) # quasi-cyclic: the circulant size
V, c, holds = rp.analysis.code.block.ldpc.qc_generator(words, k, z) # its generator, (k/z) x ((n-k)/z) circulants
H, rank = rp.analysis.code.block.ldpc.qc_checks(V, z) # and sparse checks from it
staircase: an IRA code's parity part is dual-diagonal: parity bit j is parity bit j-1 plus a sum of information bits, the row of A in H = [A | staircase]. With k information bits first, d_j = p_j + p_{j-1} is a linear function of them, the same for every word: over k + some words, one GF(2) elimination of the information bits solves every row at once (no search for sparse dual words: Valembois, Cluzeau, Canteaut-Chabaud would look for each). Noisy bits: the most reliable words are used, several subsets, and each row is kept by its vote and checked on words it was not solved from.
progressive: the checks one search finds (rpps.analysis.code.block.linear.sparse_checks: information sets) decode the frames (min-sum on the partial H), the decoded frames have fewer errors, and the next search finds checks the first could not, until no new ones come (Cluzeau 2006, block code reconstruction with iterative decoding; the ISIT 2024 progressive QC-LDPC reconstruction reaches ~100x the bit error rate of one search).
quasi-cyclic (qc_generator, qc_checks): a QC code's generator is circulants, so each word gives z equations at once and a few dozen words solve it (k/z + 9 of them, where a dense search for dual words needs over k); the sparse checks are then found in the generator itself, as sums of a few shifted parity blocks whose information dependences nearly cancel (an LDPC code's dense generator hides them from a word-level search unless words are many).
roots: a binary cyclic code of length n | 2^m - 1 is its generator's roots: every codeword c has c(beta^j) = 0 at them (the Vandermonde parity checks). Evaluated at every beta^j, words of the code are zero at the roots and a fraction 2^-m elsewhere; a word with an error is not zero there either, so the zero fraction is the clean words' share, which stands far over 2^-m at a few percent of clean words. Consecutive roots give a BCH code's designed distance.
Classes:
| Name | Description |
|---|---|
Roots |
Result of |
QCStaircase |
Result of |
Functions:
| Name | Description |
|---|---|
staircase |
Rows of an IRA code's H from aligned words (W, n) whose first k positions are the information bits and the rest |
qc_generator |
The generator of a quasi-cyclic code (circulant size z) from aligned words (W, n) with the k information bits |
circulant_size |
The circulant size of a quasi-cyclic code: the smallest z (of |
qc_checks |
Sparse parity checks of the quasi-cyclic code qc_generator found: H ((n - k), n) over [information k | parity |
posterior |
A-posteriori LLRs of words (B, n) through the checks H (c, n) by normalized min-sum, flooding (all checks at once): |
progressive |
Checks of aligned frames (W, n) of LLRs (log P(0)/P(1)), found again and again on frames cleaned by the checks |
roots |
Roots of a binary cyclic code from aligned words (W, n), position i the coefficient of x^i (reverse: of |
qc_staircase |
A DVB-S2-style IRA code (information bits in groups of Z, each adding to parity rows x + m q, parity accumulated) |
qc_dual |
The circulant check blocks of a quasi-cyclic code (every column block of Z, rows and columns cycled alike: 802.11n, |
qc_size |
Circulant sizes Z (dividing n) at which aligned clean codewords (W, n) have checks that stay checks cycled within |
Roots ¶
Result of roots: n, m, roots (exponents j of beta = alpha^((2^m - 1)/n), sorted), zero (fraction of words zero at
each root), generator (int, bit i the coefficient of x^i), k (n - degree), designed (BCH designed distance: 1 + the
longest run of consecutive roots), clean (estimated share of words without an error)
Source code in src/rpps/analysis/code/block/ldpc.py
QCStaircase ¶
Result of qc_staircase: table (per information group, the parity addresses x: DVB-S2's address table), checks
(positions per check, as rpps.code.types.ira.ira_checks gives), holds (per row class, on held-out frames), Z
Source code in src/rpps/analysis/code/block/ldpc.py
staircase ¶
Rows of an IRA code's H from aligned words (W, n) whose first k positions are the information bits and the rest the parity bits in accumulator order. extra: parity positions (indices into the parity part) that some rows also involve (802.11n's first parity column is weight 3): they join the information bits as regressors. Returns (H (n-k, n) uint8, fraction of held-out words each row holds on)
Source code in src/rpps/analysis/code/block/ldpc.py
qc_generator ¶
The generator of a quasi-cyclic code (circulant size z) from aligned words (W, n) with the k information bits first: parity bit o of parity block J is sum over information blocks b and s of u[b, (o - s) % z] V[b, J, s], plus c[J z + o] (zero for a linear code; a coset's constant otherwise). A shift of every information block by one shifts every parity block by one, so the k x (n - k) generator is (k/z) x ((n - k)/z) circulants, each one row of z bits: each word gives z equations in the k + z unknowns of a parity block, and the coefficients are the same for every parity block, so one elimination over about k/z + 9 words solves them all. Noisy bits: the most reliable words, several subsets, each parity block's solution kept by how many held-out equations it satisfies. Information bits that never vary (a header's constants) leave the system short of rank: their share falls to the constant, which the held-out words, having the same constants, still bear out. Returns (V (k/z, (n-k)/z, z) uint8, c (n - k,) uint8, holds ((n-k)/z,): the fraction of held-out parity bits each block's solution predicts)
Source code in src/rpps/analysis/code/block/ldpc.py
circulant_size ¶
The circulant size of a quasi-cyclic code: the smallest z (of sizes, default every common divisor of k and n - k
from 2) whose qc_generator predicts held-out words (every parity block's fraction >= hold), or None. kw: its
Source code in src/rpps/analysis/code/block/ldpc.py
qc_checks ¶
Sparse parity checks of the quasi-cyclic code qc_generator found: H ((n - k), n) over [information k | parity n - k], full rank when they are found, lightest block rows first.
A block row of checks is a sum of shifted parity blocks whose information dependences cancel but for a few bits:
x^a p_J1 + x^b p_J2 (+ x^c p_J3 (+ x^d p_J4)) = a sparse sum of information bits, for every shift together (z checks).
LDPC codes have them with few terms (the generator, H_p^-1 H_u, is dense: a search for sparse dual words in the words
themselves needs many), so: every pair and triple of parity blocks over all shifts, and quadruples by meeting in the
middle (pairs whose dependences nearly agree: locality-sensitive hashing on reps random 40-bit projections), each
kept when its information part has at most max_weight bits and it adds rank. Returns (H, rank)
Source code in src/rpps/analysis/code/block/ldpc.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
posterior ¶
A-posteriori LLRs of words (B, n) through the checks H (c, n) by normalized min-sum, flooding (all checks at once): what the checks known so far say about each bit (rpps.code.types.ldpc.flood)
Source code in src/rpps/analysis/code/block/ldpc.py
progressive ¶
Checks of aligned frames (W, n) of LLRs (log P(0)/P(1)), found again and again on frames cleaned by the checks found so far (see the module). kw: rpps.analysis.code.block.linear.sparse_checks's. Stops when a round adds no rank. Returns (H (c, n): a basis of the checks found, lightest first, then more light ones; holds on the original hard bits; [rank after each round])
Source code in src/rpps/analysis/code/block/ldpc.py
roots ¶
Roots of a binary cyclic code from aligned words (W, n), position i the coefficient of x^i (reverse: of x^(n-1-i)). m: the field (default the smallest with n | 2^m - 1)
Source code in src/rpps/analysis/code/block/ldpc.py
qc_staircase ¶
A DVB-S2-style IRA code (information bits in groups of Z, each adding to parity rows x + m q, parity accumulated)
from aligned codewords (W, n), information first: its address table, from about k/Z + extra clean words (the most
reliable ones, by rel |LLR|; trials subsets, each row class keeping the solution that holds best)
Source code in src/rpps/analysis/code/block/ldpc.py
qc_dual ¶
The circulant check blocks of a quasi-cyclic code (every column block of Z, rows and columns cycled alike: 802.11n,
802.16e, 5G NR's lifted base graphs) from aligned clean codewords (W, n), about n/Z + extra of them. The circulant
system's null space holds every check row (a base row's shifts are base rows too); its sparse vectors, found by
information sets over it, are the blocks' rows. Returns base rows (b, n) uint8, one per circulant block, lightest
first: row j of a block is its base row with every block of Z cycled by j
Source code in src/rpps/analysis/code/block/ldpc.py
qc_size ¶
Circulant sizes Z (dividing n) at which aligned clean codewords (W, n) have checks that stay checks cycled within every block of Z: {Z: how many independent ones}. The code's own Z has them all (n - k); its divisors and multiples some, other sizes none: the largest is the code's
Source code in src/rpps/analysis/code/block/ldpc.py
linear ¶
Blind binary block codes: length, alignment, parity checks, and which kind of code it is (cyclic / BCH, product, LDPC)
Rows of L bits from a stream of codewords of length n: when L is a multiple of n (and for most alignments when L = n), every
row holds whole codewords at the same place, so the rows satisfy the code's parity checks and the matrix of rows is short of
full rank. Random bits, or rows of any other length, are not (with EXTRA more rows than columns, a random matrix is short
2^-EXTRA of the time). That finds the length; the alignment is where rows of n bits are shortest of rank; the checks are the
null space of the rows (recover_dual, which tolerates some words with errors).
Then what kind of code
cyclic (BCH, cyclic Hamming and Golay, shortened ones too): every codeword is a multiple of the generator g(x), so g is the
greatest common divisor of codewords. Its full length is the order of x modulo g; a narrow-sense BCH code is the one whose
generator is the product of the minimal polynomials of alpha, alpha^3, ..., alpha^(2t-1) in some GF(2^m).
product (turbo product codes): rows are codewords of one code and, stacked n2 at a time, columns of another.
LDPC: the checks found have low weight (sparse_checks, which takes soft values to pick the cleanest words).
The rank methods need about n + EXTRA rows of n bits with few errors: lengths up to roughly sqrt(len(bits)), at a bit error rate well below 1/n^2 (after a decoder, or a strong signal). What they find is a Guess: decoded once saved.
Functions:
| Name | Description |
|---|---|
deficiency |
L minus the rank of rows of L bits from |
alignment |
(offset, deficiency at each offset): where rows of n bits are shortest of rank |
find_length |
Codeword length of a binary block code: (n, offset, {length: deficiency}) or (None, None, deficiencies) |
frame_units |
The length of a block code whose words lie end to end from where each frame starts: rows are bits that each start |
to_poly |
Bits, first the highest power, as a polynomial int |
cyclic_generator |
g(x) of a cyclic code from aligned codewords (W, n): the commonest gcd of two words that has degree r (= n - k). With |
primitive_polys |
Primitive polynomials of degree m (x is a generator of GF(2^m)) |
bch_of |
The narrow-sense BCH definition with generator g, if it is one: {"type": "bch", ...} or None |
product |
Rows of n1 bits stacked n2 at a time, whose columns are codewords too: (n2, row phase, deficiency) or None. |
sparse_checks |
Low-weight parity checks of aligned words (W, n): (H (c, n) uint8, fraction of words each holds on) |
lightest |
The sparsest description of the checks H span: a basis taken lightest first, then every check no heavier than its |
trivial_checks |
When checks of weight 1 and 2 (bits that hold one value, pairs that are equal or opposite, in |
recurrence |
(degree, taps, fraction holding) when the bits follow one short linear recurrence (shorter than n: what makes every |
solve_block |
Find a binary block code in bits: its length, alignment, checks, and kind. Returns [(Hypothesis, Guess or None)] |
soft_score |
z of each check h (rows of H) on words of LLRs (W, n): the sum over words of prod_{j in h} tanh(llr_j/2) (each |
soft_dual |
Parity checks of a linear block code of length n from soft values (LLRs, positive = 0): |
soft_find_length |
Codeword length from soft values: the shortest n (rows of n from |
recover_dual |
Recover parity checks of an unknown linear block code of length n from (noisy) hard bits |
deficiency ¶
L minus the rank of rows of L bits from offset, the largest over segments stretches of the bits (an error in a row
adds to the rank, so the cleanest stretch counts). 0 for random bits; the number of independent checks for a code. None
when there are fewer than L + extra rows
Source code in src/rpps/analysis/code/block/linear.py
alignment ¶
(offset, deficiency at each offset): where rows of n bits are shortest of rank
Source code in src/rpps/analysis/code/block/linear.py
find_length ¶
Codeword length of a binary block code: (n, offset, {length: deficiency}) or (None, None, deficiencies)
The rank deficiency shows at multiples of n (and at n itself for most alignments): n is the smallest divisor of the first deficient length at which some alignment is deficient. Structure at most lengths (constant bits, a repetition) is not a block code.
Source code in src/rpps/analysis/code/block/linear.py
frame_units ¶
The length of a block code whose words lie end to end from where each frame starts: rows are bits that each start
at a frame's start (a burst's payload after its preamble, a frame's after its unique word), of any lengths. For each
n the words at 0, n, 2n... of every row are stacked: a code of length n leaves them short of rank. Returns (n,
deficiency) for the shortest that is, or (None, 0). Rows are many short frames where find_length wants one long
stream: a code laid out per frame breaks at every frame's end there, here it doesn't. As for find_length, n + extra
words at a time (a word with a bit error adds to the rank: fewer words, fewer of them), the best of trials draws
Source code in src/rpps/analysis/code/block/linear.py
to_poly ¶
Bits, first the highest power, as a polynomial int
cyclic_generator ¶
g(x) of a cyclic code from aligned codewords (W, n): the commonest gcd of two words that has degree r (= n - k). With errors in some words their gcds differ; codewords' share g. Returns (g, fraction of words g divides) or (None, 0)
Source code in src/rpps/analysis/code/block/linear.py
primitive_polys ¶
Primitive polynomials of degree m (x is a generator of GF(2^m))
bch_of ¶
The narrow-sense BCH definition with generator g, if it is one: {"type": "bch", ...} or None
Source code in src/rpps/analysis/code/block/linear.py
product ¶
Rows of n1 bits stacked n2 at a time, whose columns are codewords too: (n2, row phase, deficiency) or None.
Columns from n2 + extra blocks, one each; with fewer blocks, up to per_block from each (spread across the columns)
Source code in src/rpps/analysis/code/block/linear.py
sparse_checks ¶
Low-weight parity checks of aligned words (W, n): (H (c, n) uint8, fraction of words each holds on)
Each trial puts the columns in a random order and takes the null space of up to k + 16 words: its basis vectors are each
one free position plus pivots, and a sparse check comes out as one of them whenever all but one of its positions are
pivots. Those of weight <= w_max that hold on far more than half of verify words are kept. rel: reliabilities
(|LLR|) of the bits: the words with the fewest expected errors (sum of 1/(1 + e^|LLR|)) are the ones used. k: the code's
dimension if known: k + 16 words span it, and the fewer words the likelier they are all clean.
Source code in src/rpps/analysis/code/block/linear.py
lightest ¶
The sparsest description of the checks H span: a basis taken lightest first, then every check no heavier than its heaviest (redundant low-weight checks help a decoder: Gallager's H has more rows than its rank)
Source code in src/rpps/analysis/code/block/linear.py
trivial_checks ¶
When checks of weight 1 and 2 (bits that hold one value, pairs that are equal or opposite, in hold of the words)
account for all nk independent checks: (fixed positions, equal pairs); else (None, None)
Source code in src/rpps/analysis/code/block/linear.py
recurrence ¶
(degree, taps, fraction holding) when the bits follow one short linear recurrence (shorter than n: what makes every row of n bits short of rank, at every alignment), else None. Berlekamp-Massey on a few clean-looking stretches of 3n bits; the shortest recurrence found must hold over the whole stream
Source code in src/rpps/analysis/code/block/linear.py
solve_block ¶
Find a binary block code in bits: its length, alignment, checks, and kind. Returns [(Hypothesis, Guess or None)]
n / offset: when known (a frame length, a hint); else found by rank (lengths up to max_len, by default what the bits
allow). llr: soft values of the bits (positive = 0), to pick the cleanest words for the sparse checks, and for the
checks when the bits are too noisy for the rank (soft_dual, about a second); soft_length: the length too
(soft_find_length: seconds a length tried, so only when asked)
Source code in src/rpps/analysis/code/block/linear.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
soft_score ¶
z of each check h (rows of H) on words of LLRs (W, n): the sum over words of prod_{j in h} tanh(llr_j/2) (each word's expected parity of h: +1 for a sure 0) over its spread. Near 0 for a vector that is no check, large for one
Source code in src/rpps/analysis/code/block/linear.py
soft_dual ¶
Parity checks of a linear block code of length n from soft values (LLRs, positive = 0): recover_dual for words
too noisy for random subsets to be clean. Each subset of s words is drawn from the 3s likeliest to hold no error
(prod 1/(1 + e^-|l|); once checks are found, words failing one go last, which cleans the next draw); null vectors are kept on their soft score (soft_score: the tanh-product syndrome over all
words, above z_min). Returns dict(H, k, ok, clean) as recover_dual (clean: the words' mean chance of no error)
Source code in src/rpps/analysis/code/block/linear.py
soft_find_length ¶
Codeword length from soft values: the shortest n (rows of n from offset) whose soft dual holds a check, or None.
Slower than find_length (a soft_dual a length): for words too noisy for its rank. Alignment is taken as given
(a cyclic code holds at any; a frame start or a known offset for others)
Source code in src/rpps/analysis/code/block/linear.py
recover_dual ¶
Recover parity checks of an unknown linear block code of length n from (noisy) hard bits
Words that are codewords satisfy every parity check h. For a random set of words, the null space of their matrix contains the checks that no error among them broke, and anything that is a check satisfies the other words too: so null vectors are verified against all words, and those that stand out from 50% are kept. Needs about n words and a word error rate that leaves some subsets of words clean.
Returns dict(H, k, words, needed, ok). H is a basis of the checks (dense, not sparse).
Source code in src/rpps/analysis/code/block/linear.py
polar ¶
A polar code's frozen positions, blind: which of the u bits are always 0, and which construction froze them
r = rp.analysis.code.block.polar.frozen(llr) # frames (W, N) of LLRs, N a power of 2, aligned: the column test
r = rp.analysis.code.block.polar.recognize(llr) # at low SNR: successive cancellation, a test per position
r = rp.analysis.code.block.polar.search(llr) # and the construction (polarization weight, Bhattacharyya) and K it is
r.frozen, r.k
The code itself (encoding, SC and list decoding) is rpps.code.types.polar. A polar codeword is x = u G with G = F^(x n), F = [[1, 0], [1, 1]]; G is its own inverse, so u = x G and u_i is the parity of the x bits in column i of G. The frozen positions of u are 0 in every frame; the information positions are 0 half the time.
frozen (the column test): each u_i's LLR is the tanh-product of its column's x LLRs (as a parity check's); averaged
over frames it is high at frozen positions and near zero at information ones (the hypothesis test of arXiv
2606.17705). A heavy column sees many x errors, and the early positions a real code freezes have the heaviest (column 0
is the parity of all N bits): a (64, 32) frozen set is found at Es/N0 6 dB from 400 frames, but a rate-1/2 code built
by polarization weight is not found at +2 dB.
recognize (blind successive cancellation): the SC decoder runs over every frame at once, and at each position, in
decoding order, every frame's SC LLR of u_i given the u before it (frozen ones 0, information ones as decided) is a
much stronger statistic than the bare column, because the positions before it are taken out. Per position the
generalised likelihood ratio of "u_i = 0 always" against "u_i uniform", sum over frames of log2(2 / (1 + e^-L)), is
W times the synthetic channel's capacity when frozen and at most 0 when not; a position is information only when it is
significantly negative (a channel too poor to tell is frozen, as every construction does), and the partial order every
construction keeps (i at least as reliable as each j whose bits are a subset of its own) carries an information
verdict upward. (In the spirit of blind SC/SCL recognition, arXiv 2605.13331, without the list.)
search names the construction: each reliability order (polarization weight, the beta-expansion 3GPP NR's sequence
follows; Bhattacharyya parameters at a few design SNRs) with the K whose least reliable N - K positions are nearest
the blind set; within a few positions, the construction's set is returned (which corrects the blind test's errors).
Measured, rate 1/2 built by polarization weight, 200 frames: (128, 64), (256, 128), (512, 256) found exactly down to
Es/N0 -2 dB by recognize; search exact at -3 dB and within a few positions at -4 dB; frozen fails at +2 dB.
Classes:
| Name | Description |
|---|---|
Frozen |
Result of |
Recognition |
Result of |
Functions:
| Name | Description |
|---|---|
frozen |
Frozen positions from frames (W, N) of LLRs (log P(0)/P(1)) of aligned polar codewords (see the module). |
evidence |
Per frame, log2 of how much likelier an SC LLR L is with u = 0 than with u uniform: log2(2 / (1 + e^-L)). Its sum |
recognize |
Frozen positions of aligned polar frames (W, N) of LLRs at low SNR: blind SC (see the module). Position by |
search |
Which construction (and K) the frozen set of frames (W, N) of LLRs is: |
Frozen ¶
Result of frozen: frozen (positions), k (information bits), score (each position's mean tanh(L/2) of u_i: 1 for
a frozen position on clean frames, 0 for information), threshold
Source code in src/rpps/analysis/code/block/polar.py
Recognition ¶
Result of recognize: frozen (positions), k, evidence (N,): each position's summed evidence (bits; > 0 frozen),
construction (the reliability order it fits, with search), score
Source code in src/rpps/analysis/code/block/polar.py
frozen ¶
Frozen positions from frames (W, N) of LLRs (log P(0)/P(1)) of aligned polar codewords (see the module). threshold: the score above which a position is frozen (default halfway between the information positions' (about 0) and the frozen ones', from the scores' two clusters)
Source code in src/rpps/analysis/code/block/polar.py
evidence ¶
Per frame, log2 of how much likelier an SC LLR L is with u = 0 than with u uniform: log2(2 / (1 + e^-L)). Its sum over frames is positive (W times the synthetic channel's capacity) at a frozen position, at most 0 at an information one: the generalised likelihood ratio of the two
Source code in src/rpps/analysis/code/block/polar.py
recognize ¶
Frozen positions of aligned polar frames (W, N) of LLRs at low SNR: blind SC (see the module). Position by
position in decoding order, every frame's SC LLR of u_i (given the u before it: frozen ones 0, information ones as
decided) gives its evidence; the position is information when the evidence is significantly negative (its sum
under -z of its spread), else frozen: a position too poor to tell either way is a channel any construction freezes.
monotone: every polar construction keeps the partial order where i is at least as reliable as each j whose set
bits are a subset of its own (j & i == j): so a position over an information one is information too
Source code in src/rpps/analysis/code/block/polar.py
search ¶
Which construction (and K) the frozen set of frames (W, N) of LLRs is: recognize finds the set blind, then each
reliability order (default polarization weight, and Bhattacharyya at -2 / 0 / 2 / 4 dB) is matched by its K whose
N - K least reliable positions differ from it in the fewest places. Within tolerance x N places, the construction's
set is returned (the few positions a noisy blind test got wrong come right), named; else the blind set, unnamed.
kw: recognize's. Returns Recognition (score: the places the construction differs from the blind set)
Source code in src/rpps/analysis/code/block/polar.py
rs ¶
Blind Reed-Solomon identification: length, field, generator and alignment of an unknown RS code over GF(256)
An RS codeword c(x) = sum c_i x^(n-1-i) (first byte the highest power) is a multiple of its generator g(x) = prod (x - alpha^(prim*(fcr+i))), i < n-k, so c(beta) = 0 at those roots, whatever the shortening (a shortened word is a full one with leading zeros). The Galois-field Fourier transform of an aligned word, its values at all 255 nonzero beta = alpha^j, is zero at the roots in every word; elsewhere, and for any word that is not aligned, a value is zero 1/256 of the time. So the roots show up as the j where nearly every word is zero, and they give n-k, fcr and prim.
Every byte phase is evaluated at once, with a sliding window: E_(s+1)(beta) = betaE_s(beta) + b[s+n] + b[s]beta^n. This is done for all 16 primitive field polynomials, 8 bit offsets, both bit orders within a byte (MSB or LSB first) and both polarities (inverted bits add the constant 0xFF*sum beta^i to every value) together.
What is needed: the length n, from lengths (hints, the frame period of the bits, common lengths) or tried
exhaustively; at least words + 2 codewords of bits with few errors. Symbol interleaving (depth I: codeword bytes every
I-th byte) is undone by depths.
Functions:
| Name | Description |
|---|---|
fit_generator |
(fcr, prim) with roots = {prim*(fcr+i) mod 255, i < len(roots)}, prim 1 if it can be, or None |
lengths_of |
Lengths to try: the hints, then the byte frame periods of the bits, then COMMON |
search |
Find an RS code over GF(256) in hard bits. Returns (hypotheses best first, trials, Guess or None) |
fit_generator ¶
(fcr, prim) with roots = {prim*(fcr+i) mod 255, i < len(roots)}, prim 1 if it can be, or None
Source code in src/rpps/analysis/code/block/rs.py
lengths_of ¶
Lengths to try: the hints, then the byte frame periods of the bits, then COMMON
Source code in src/rpps/analysis/code/block/rs.py
search ¶
Find an RS code over GF(256) in hard bits. Returns (hypotheses best first, trials, Guess or None)
lengths: codeword lengths in bytes to try (default: lengths_of); exhaustive: every length 16..255 (minutes)
words: codewords per phase the roots are counted on (a root is zero in at least 3/4 of them)
Each hypothesis: params n, k, poly, fcr, prim, roots, phase (byte where a codeword starts), bit_offset, lsb_first,
depth, branch, polarity, words_ok (fraction of further words whose syndromes are all zero).
Source code in src/rpps/analysis/code/block/rs.py
rpps.analysis.code.conv ¶
Convolutional family: the mother code (generators), puncture patterns on it, turbo constituents, TCM
Modules:
| Name | Description |
|---|---|
mother |
Mother codes of convolutional codes, blind: the constraint length and generators of a rate 1/n feed-forward code |
puncture |
Blind puncture patterns: a known rate 1/2 convolutional code (a "mother code") sent through a puncture pattern that no |
rsc |
Recursive systematic convolutional codes (turbo constituents) and a turbo code's interleaver, found blind |
tcm |
Trellis-coded modulation found blind: the parity check a trellis code puts on the constellation's labels |
mother ¶
Mother codes of convolutional codes, blind: the constraint length and generators of a rate 1/n feed-forward code (for generators g_a, g_b, (c_a * g_b) xor (c_b * g_a) = 0 on codewords), a configured code's fit, and the definition a found one is saved as (a child of the configured mother code with these generators, else the generators). Its punctured rates: rpps.analysis.code.conv.puncture
Functions:
| Name | Description |
|---|---|
scan_conv |
Rate 1/n convolutional code scan on one bit stream. Returns (hypotheses, number of trials) |
soft_mismatch_batch |
The soft re-encoding mismatch of each row of LLRs (W, L): decoded from the LLRs, re-encoded, the share of |LLR| on |
scan_defined_conv |
Try every convolutional definition in config/fec/conv on every bit mapping and puncture alignment |
decode_conv |
Run the config definition behind a conv-config hypothesis on a whole bit stream |
guess_conv |
Definition from a conv hypothesis (generators found by the parity relation, plain or with a scrambler) |
scan_conv ¶
Rate 1/n convolutional code scan on one bit stream. Returns (hypotheses, number of trials)
Every generator pair's parity relation (c_a * g_b) ^ (c_b * g_a) against chance. llr: the bits' LLRs (log P0/P1,
as long as bits): each relation bit weighted by the product of tanh(|L|/2) over the bits it combines (_soft_z),
so noisy bits count for less (the hard count weighs them all alike: soft reaches lower SNR)
Source code in src/rpps/analysis/code/conv/mother.py
soft_mismatch_batch ¶
The soft re-encoding mismatch of each row of LLRs (W, L): decoded from the LLRs, re-encoded, the share of |LLR| on the bits the code disagrees with (a right code's disagreements fall on unreliable bits, a wrong one's anywhere), and the effective number of bits ((sum |L|)^2 / sum L^2) that share is over. Returns (shares (W,), n_eff (W,), bits)
Source code in src/rpps/analysis/code/conv/mother.py
scan_defined_conv ¶
scan_defined_conv(streams, names=None, steps=2500, skip=0.1, segments=(0.1, 0.45, 0.8), decisive=20.0, llrs=None, screen=5, cut=0.85)
Try every convolutional definition in config/fec/conv on every bit mapping and puncture alignment
A correct hypothesis lets the decoder reproduce the received bits (the channel error rate, well below
what a wrong one gets). Each of segments (fractions into the stream) is tried on its own: a symbol the timing slipped
moves the puncture phase, so a segment across it fits two phases half well, and the others still fit one. A
hypothesis says which segment (its offset holds there). Once one fits overwhelmingly (z > decisive, a tenth of a
wrong code's mismatch), only definitions of the same rate are tried further (an equivalent code, the generators in
the other order, also fits and the pick needs to see it; a code of another rate cannot). llrs: {tag: LLRs} of the
streams that have them: a hypothesis the hard re-encoding leaves short is also scored softly (soft_mismatch_batch,
against what random signs on the same reliabilities give), which holds a few dB further down. Every hypothesis is
screened on a screen-th of its bits first; one not under cut x its baseline there (hard or soft) is not decoded
in full. Returns (hypotheses, trials).
Source code in src/rpps/analysis/code/conv/mother.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
decode_conv ¶
Run the config definition behind a conv-config hypothesis on a whole bit stream
Source code in src/rpps/analysis/code/conv/mother.py
guess_conv ¶
Definition from a conv hypothesis (generators found by the parity relation, plain or with a scrambler)
Source code in src/rpps/analysis/code/conv/mother.py
puncture ¶
Blind puncture patterns: a known rate 1/2 convolutional code (a "mother code") sent through a puncture pattern that no definition has
A pattern of period P keeps some of the 2P coded bits of P input bits. Rate P/(P+1) (2/3, 3/4, ... 7/8) keeps P+1: one input bit's two outputs and one output of each of the others, so there are P * 2^(P-1) patterns, and a pattern turned by a column is the same one started a column later, which the bit offset covers: 2^(P-1) to try per period, each at every offset. The right one lets the Viterbi decoder reproduce what was received (only channel errors differ); others don't.
Mother codes are those in config/fec/conv (both generator orders: which of the two outputs goes first is not known).
Functions:
| Name | Description |
|---|---|
patterns |
Rate P/(P+1) puncture patterns (2, P), one per turn (built once per P; read only) |
mothers |
Rate 1/2 mother codes in config: {(K, generators): name}, both output orders |
mismatches |
mismatch() of each (pattern, hard bits) in rows under the mother code (K, gen) with that pattern, decoded together: |
search |
Find a rate 1/2 mother code with a puncture pattern in hard bit streams ({tag: bits}). Returns (hypotheses, trials) |
best |
The hypothesis that stands out and fits at one offset only, with its Guess (a conv definition), or (None, None) |
patterns
cached
¶
Rate P/(P+1) puncture patterns (2, P), one per turn (built once per P; read only)
Source code in src/rpps/analysis/code/conv/puncture.py
mothers ¶
Rate 1/2 mother codes in config: {(K, generators): name}, both output orders
Source code in src/rpps/analysis/code/conv/puncture.py
mismatches ¶
mismatch() of each (pattern, hard bits) in rows under the mother code (K, gen) with that pattern, decoded together: every pattern of a mother decodes on the mother's trellis with erasures where it punctures (what a punctured decoder does), so the rows go through in one batch per length. Returns (differing bits, bits compared) per row
Source code in src/rpps/analysis/code/conv/puncture.py
search ¶
Find a rate 1/2 mother code with a puncture pattern in hard bit streams ({tag: bits}). Returns (hypotheses, trials)
Each (mother, pattern) is screened at every offset on steps input bits of each stream; what gets clearly fewer
mismatches than on random bits is tried again on confirm times as many (at high rates a wrong pattern reproduces
random bits fairly well too, so the short screen alone says little), and is a hypothesis if it still stands out.
A mother's patterns, streams and offsets decode together (mismatches: a batch per length, not a call each), first
the screens, then the confirmations of what passed.
Source code in src/rpps/analysis/code/conv/puncture.py
best ¶
The hypothesis that stands out and fits at one offset only, with its Guess (a conv definition), or (None, None)
Source code in src/rpps/analysis/code/conv/puncture.py
rsc ¶
Recursive systematic convolutional codes (turbo constituents) and a turbo code's interleaver, found blind
c = rp.analysis.code.conv.rsc.constituent(s, p) # systematic and parity streams: (g_f, g_b), e.g. 3GPP 15 / 13 octal
perm = rp.analysis.code.conv.rsc.turbo_interleaver(S, P2, c.g_f, c.g_b) # frames: the second encoder's input order
An RSC encoder makes its parity p from the information u = s as p(D) = u(D) g_f(D) / g_b(D): so p g_b + s g_f = 0, a parity check over the two streams, one label of 2 bits a step. The same Walsh-Hadamard count as rpps.analysis.code.conv.tcm scores every pair of polynomials up to the memory at once; the strongest is (g_f, g_b) (a feedforward code: g_b = 1).
A turbo code's second encoder takes the information in another order: its parity p2 has no check with s, which says that much. With the constituent known, u' = p2 g_b / g_f (an IIR division from the all-zero start of each frame) is the interleaved information, and over many frames every position of u' matches one position of s bit for bit: the permutation, one column search per position (Burel). An error in p2 spreads through the division, so that needs clean frames.
From noisy frames (soft values), turbo_interleaver_soft uses the constituent's check instead of its inverse:
p2 g_b + u' g_f = 0 holds at every step t over p2[t - d] and u'[t - d] = s[perm[t - d]], d up to the memory, so
with perm[t - 1] ... perm[t - m] found, each candidate j for perm[t] is scored over all frames at once by the check's
soft value: sum over frames of tanh(L_s[j]/2) times the product of tanh(L/2) of the check's other bits (one matrix-
vector product a position; positions taken are excluded). A wrong pick spoils the next m checks, so a repair pass then
scores every position by all m + 1 checks it is in, with every other position as found, and reassigns them greedily
from the most confident (a sequential search with error correction in the spirit of Tixier & Sendrier, without BCJR).
The forward search keeps a small beam, so one wrong pick doesn't take every later one with it.
The check's weight w = |g_f| + |g_b| bits sets the noise it takes: its soft value falls as (1 - 2 BER)^w, so the frames
needed grow as (1 - 2 BER)^(-2w) log K (3GPP's w = 6: about 100 frames of 1000 bits at 4% bit errors).
Classes:
| Name | Description |
|---|---|
Constituent |
g_f (feedforward), g_b (feedback): ints, bit d the coefficient of D^d; memory; holds; z |
Functions:
| Name | Description |
|---|---|
octal |
The octal a standard writes (D^0 the most significant bit, 3GPP's 13 = 1 + D^2 + D^3) |
constituent |
(g_f, g_b) of the code making parity p from s (aligned streams of equal length), or None |
encode |
Parity of an RSC encoder from the all-zero state: p = u g_f / g_b (g_b needs a D^0 term) |
invert |
The information an RSC encoder (from the all-zero state) made p from: u = p g_b / g_f (g_f needs a D^0 term) |
turbo_interleaver |
The permutation of a turbo code's second encoder: frames S (F, K) of systematic bits and P2 (F, K) of the second |
turbo_interleaver_soft |
The second encoder's permutation from noisy frames: Ls (F, K) LLRs (log P(0)/P(1)) of the systematic bits, Lp2 |
Constituent ¶
octal ¶
The octal a standard writes (D^0 the most significant bit, 3GPP's 13 = 1 + D^2 + D^3)
constituent ¶
(g_f, g_b) of the code making parity p from s (aligned streams of equal length), or None
Source code in src/rpps/analysis/code/conv/rsc.py
encode ¶
Parity of an RSC encoder from the all-zero state: p = u g_f / g_b (g_b needs a D^0 term)
Source code in src/rpps/analysis/code/conv/rsc.py
invert ¶
The information an RSC encoder (from the all-zero state) made p from: u = p g_b / g_f (g_f needs a D^0 term)
Source code in src/rpps/analysis/code/conv/rsc.py
turbo_interleaver ¶
The permutation of a turbo code's second encoder: frames S (F, K) of systematic bits and P2 (F, K) of the second parity (each frame from the all-zero state). Returns perm (K,): the second encoder's input i is s[perm[i]], and the agreement of each match (1: every frame)
Source code in src/rpps/analysis/code/conv/rsc.py
turbo_interleaver_soft ¶
The second encoder's permutation from noisy frames: Ls (F, K) LLRs (log P(0)/P(1)) of the systematic bits, Lp2
(F, K) of the second parity (hard bits work as +-large values). g_f needs a D^0 term. beam: partial permutations
kept, each extended by its expand best candidates a step; repair: passes of the repair. Returns (perm (K,): input i
of the second encoder is s[perm[i]], confidence (K,): each position's best check sum over its second best's;
near 1 is a guess)
Source code in src/rpps/analysis/code/conv/rsc.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
tcm ¶
Trellis-coded modulation found blind: the parity check a trellis code puts on the constellation's labels
found = rp.analysis.code.conv.tcm.search(symbols, 8) # locked symbols (any phase), an 8-point PSK
print(found[0]) # e.g. "h = (11, 02, 04) octal, natural labels, rotation 3:
# Ungerboeck 8 states, z 41.0"
A trellis code over an M-point constellation with m = log2 M label bits (z^0 the least significant) satisfies a parity check (Ungerboeck 1982): sum_i h^i(D) z^i(D) = 0 over GF(2), every symbol. Ungerboeck's systematic feedback codes are written by those h^i (octal); a pragmatic code (a rate-1/2 convolutional code on the low bits, the rest uncoded) has one too (its two generators, crossed); so has any other linear trellis code. Over a window of W = nu + 1 symbols a check is a W m-bit vector, and with hard decisions it holds more often than not: (1 - 2p)^weight of the time, p the label bit error rate. Counting the windows of the stream by value and taking the Walsh-Hadamard transform of the counts gives, for every one of the 2^(W m) vectors at once, how many windows it holds on minus how many it fails (the WHT-BM method of rate k/n convolutional code recovery). A check stands out against the sqrt(N) of chance.
The labels depend on what is not known: the carrier phase (M rotations, and conjugation for an inverted spectrum) and the labelling (natural, i.e. set partitioning, for Ungerboeck codes; Gray for pragmatic ones; or the constellation's own). Every combination is tried; the label permutation does the rotation, so decisions are made once.
Classes:
| Name | Description |
|---|---|
Check |
A parity check found, and how well it holds |
Functions:
| Name | Description |
|---|---|
decisions |
Nearest of M PSK points at angles 2 pi k / M + offset (the offset taken from the M-th power): k, 0..M-1 |
labellings |
{name: label of the point at angle index k} |
label_windows |
Counts of every W-symbol window of m-bit labels z, as an index whose bit (W-1-d) m + i is z^i at delay d |
label_errors |
Per label bit, the probability a hard decision gets it wrong at the noise of these symbols: {labelling: array(m)} |
search |
Parity checks of a trellis code on M-PSK symbols y (locked to within a rotation). max_nu: largest memory tried |
definition |
The trellis code of check h as an |
encode |
Labels of a systematic feedback trellis encoder for the check h (see |
Check ¶
A parity check found, and how well it holds
h (one polynomial per label bit, z^0 first, as ints whose bit d is the delay-d tap), nu (memory), labels ('natural', 'gray' or 'own'), rotation (points the decisions were turned by), conj, z (its bias over chance), holds (fraction of windows it holds on), match (the known code it is, or None), expected (how often a code's check of these taps would hold, given the label bit errors the symbols' noise makes), code (holds at least CODE of the way from chance to expected: a code; else the labels are only correlated, by ISI, oversampling or the wrong modulation)
Source code in src/rpps/analysis/code/conv/tcm.py
decisions ¶
Nearest of M PSK points at angles 2 pi k / M + offset (the offset taken from the M-th power): k, 0..M-1
Source code in src/rpps/analysis/code/conv/tcm.py
labellings ¶
{name: label of the point at angle index k}
label_windows ¶
Counts of every W-symbol window of m-bit labels z, as an index whose bit (W-1-d) m + i is z^i at delay d
Source code in src/rpps/analysis/code/conv/tcm.py
label_errors ¶
Per label bit, the probability a hard decision gets it wrong at the noise of these symbols: {labelling: array(m)}
Source code in src/rpps/analysis/code/conv/tcm.py
search ¶
search(y, M, max_nu=5, own=None, conj=True, labelling=None, pfa=1e-06, top=4, correlations=False, soft=False, shortlist=32)
Parity checks of a trellis code on M-PSK symbols y (locked to within a rotation). max_nu: largest memory tried
(windows of max_nu + 1 symbols: (max_nu + 1) log2 M bits, 2^that candidates). own: the constellation's labels by
angle index, tried as well. Returns Checks, most significant first (empty: no code of that memory on these labels).
A check that holds well short of what a code's would at this noise is a correlation of the labels (ISI, a wrong rate or
modulation), not a code: left out unless correlations, and marked (Check.code False).
soft: each variant's shortlist strongest hard candidates, significant or not, are scored by the product of their
taps' label-bit tanh(LLR/2) (max-log at the measured noise): a few dB more than hard decisions
Source code in src/rpps/analysis/code/conv/tcm.py
definition ¶
The trellis code of check h as an fsm definition (rpps.code.types.fsm): the systematic feedback encoder whose
upper m-1 label bits are the input (z^1 the first input bit) and z^0 is solved from sum_i h^i z^i = 0 (h[0] with taps
at delay 0 and nu). The state is the delays the check reaches (z^0's last nu, each z^i's as far as its h^i does);
the output word is the label (z^0 its last bit). points: the constellation in label order, to decode symbols
Source code in src/rpps/analysis/code/conv/tcm.py
encode ¶
Labels of a systematic feedback trellis encoder for the check h (see definition): the upper m-1 label bits are
bits (rows of m-1, z^1 first), z^0 is solved from sum_i h^i z^i = 0
Source code in src/rpps/analysis/code/conv/tcm.py
rpps.analysis.framing ¶
How the stream is cut: frames, payloads, telemetry, the CRC frames carry, what each bit of a header is, frames behind a sync marker and the scrambled block code inside them (marked); and whether decoded bits are as random as a cipher's output
Modules:
| Name | Description |
|---|---|
bits |
Frame structure on bits, blind: sync markers, frame length by autocorrelation, HDLC flags and the markers of a |
crc |
Which CRC checks a set of frames, and where it sits: the generator, init and xorout, the bits it covers |
fields |
What each bit of a set of frames (or bursts) is: constant, a counter, an id, a length, a few values, or random |
frames |
Blind symbol framing: the period a symbol stream repeats with, the unique word that marks it, and the frames cut on it |
marked |
Frames behind a sync marker, the scrambler restarted at each, the block code inside (rpps.analysis.framing.marked) |
payload |
What decoded bits carry: known framings found at any bit offset, and a verdict on what is left |
randomness |
Is a bit stream as random as a cipher's output? NIST SP 800-22 tests, and byte-level entropy |
telemetry |
Residual-carrier PM telemetry (PCM/PSK/PM): the carrier, each subcarrier's data, its line code and its frames |
bits ¶
Frame structure on bits, blind: sync markers, frame length by autocorrelation, HDLC flags and the markers of a framed code
Functions:
| Name | Description |
|---|---|
find_sync |
Bit offset and byte phase at which |
frame_length |
Candidate frame/block lengths from autocorrelation peaks (sync markers, repeated headers) |
scan_hdlc |
HDLC framing (config/frame): many flags, and frames whose FCS checks out |
frame_markers |
The values that start every |
find_sync ¶
Bit offset and byte phase at which markers repeat every period bytes. Returns (fraction, bit offset, phase)
Source code in src/rpps/analysis/framing/bits.py
frame_length ¶
Candidate frame/block lengths from autocorrelation peaks (sync markers, repeated headers)
Only sees fixed patterns that repeat every n bits; a code with no marker has none. Needs >= ~8 frames. Returns [(n, z)] strongest first, after removing multiples of a stronger shorter peak.
Source code in src/rpps/analysis/framing/bits.py
scan_hdlc ¶
HDLC framing (config/frame): many flags, and frames whose FCS checks out
Looks at flag counts first (a 0x7E pattern shows up at random once per 256 bits), then deframes the streams that have far more than that. Returns (hypotheses, trials).
Source code in src/rpps/analysis/framing/bits.py
frame_markers ¶
The values that start every period units at column (units after bit offset): a pattern for sync.Align
The shortest repeating pattern each of whose positions holds one value at least threshold of the time (DVB-S:
0xB8 then 0x47 seven times), over the later half of the periods. Returns (pattern, worst fraction), or (None, 0.0).
Source code in src/rpps/analysis/framing/bits.py
crc ¶
Which CRC checks a set of frames, and where it sits: the generator, init and xorout, the bits it covers
fit = rp.analysis.framing.crc.search(frames) # frames: bit arrays as sent (bool), any lengths
print(fit) # "CRC-16 poly 0x1021 init 0xffff xorout 0x0 (crc16_ccitt_false) over bits 0..95, field at 96..111, ..."
fit.check(frame) # True when a frame passes
fit.guess.save("mine") # config/crc/guess/mine.json when no shipped definition matched
The method (RevEng's, on bit streams). On bits fed in the order sent, a CRC's register is linear in the message:
r(m) = I x^n + m(x) x^w mod P, and the field sent is r XOR a constant, most significant bit first (a reflected CRC sent
least significant bit first reads the same way, with xorout reflected; refin only says how bytes become that stream).
So for two frames of one length, the XOR of their bits up to the field's end is a polynomial P divides, whatever init
and xorout are:
- Generator and field end: the GCD of a few such differences, the frame cut at each candidate end from the last bit
back (powers of x stripped). A degree in
widthsis a candidate; the end moves back over constant columns (fill after the field). When bits before the coverage differ between frames (an uncovered header: an address, a counter), the differences are first combined to cancel them (row reduction on the leading columns), which needs more frames than that header has varying bits. - Coverage start: K = field XOR r0 (r0 the register from zero over the covered bits) is the same for every frame of a length (K = I x^n mod P XOR xorout) at the right start only. Every start is scored at once (suffix XORs of x^j mod P); the start passing the most frames wins, a start where init and xorout come out plain (0 or all ones, or a shipped definition) breaking ties across constant leading bits, which any init absorbs.
- Init and xorout: two message lengths separate them (K_n1 XOR K_n2 = I (x^n1 + x^n2) mod P), all but the inits
P's common factors with x^n1 + x^n2 hide (any generator with x + 1); with one length only their combination is
known. Then (
ambiguous) a shipped definition (config/crc) or plain values (0, all ones) pick one. - Evidence: frames not used to find the generator that pass, against 2^-w each by chance.
Limits: frames must be error free (decoded, or a CRC would not be there to find); several frames are tried in
turn (trials), so some bad frames are tolerated. A per-frame value XORed onto the field (LTE's RNTI mask) looks like
a varying xorout and is not found. Needs four frames of one length and a few more to confirm.
Classes:
| Name | Description |
|---|---|
CRCFit |
What |
Functions:
| Name | Description |
|---|---|
search |
The CRC the frames (bit arrays as sent; bytes are unpacked MSB first) carry, as a CRCFit, or None. Frames of the |
CRCFit ¶
What search found: a CRC's parameters and where it sits
width, poly (without the x^w term), init, xorout (in the definition's convention: reflected when
refout), refin, refout, start (first covered bit), end (bit after the field, frame length minus tail), tail,
names (the config/crc definitions that match: bit streams cannot tell those differing in refin / refout only apart),
name (the first of them, else None), ambiguous (init and xorout not separated: one frame
length, or a generator sharing a factor with x^n1 + x^n2, as any with x + 1 does), hits / frames (frames that pass), used (frames that found the generator), log10_chance, guess
Methods:
| Name | Description |
|---|---|
end |
The bit after the CRC field in a frame of |
check |
True when the frame (bits as sent) carries this CRC at this place |
Attributes:
| Name | Type | Description |
|---|---|---|
guess |
A Guess to save as config/crc/guess/ |
Source code in src/rpps/analysis/framing/crc.py
end ¶
check ¶
True when the frame (bits as sent) carries this CRC at this place
Source code in src/rpps/analysis/framing/crc.py
search ¶
The CRC the frames (bit arrays as sent; bytes are unpacked MSB first) carry, as a CRCFit, or None. Frames of the most common length find the generator; every frame is checked against it. widths: CRC sizes to accept
Source code in src/rpps/analysis/framing/crc.py
fields ¶
What each bit of a set of frames (or bursts) is: constant, a counter, an id, a length, a few values, or random
m = rp.analysis.framing.fields.map(frames, groups=terminal) # frames: bit rows as sent, aligned at their start
print(m) # one line a field: "bits 0..15 constant 0x1acf", "bits 32..43 counter +1 a frame (msb)", ...
m.guess.save("mine") # config/header/link/guess/mine.json: the fields, named by kind and place
Frames are read up to the shortest (or length). Each field is a run of columns, found in this order, each test against
what chance gives over that many frames:
- constant: a column one value in
holdof the frames (a bit error or two allowed); runs of them, with their value - id: with
groups, a run constant within every group and differing between groups (columns constant everywhere inside it included; found before counters: within a group an id and the counter after it step together). A counter's top bits that never change within a group over the record read as id too: only a carry through them tells them apart - counter: a value stepping by the same amount (mod 2^width) from frame to frame, in either bit order. Its lowest
bit that changes flips every frame (step odd times 2^k); the field is grown from it both ways while the step holds
in
holdof the frames and each new bit changes at all (the counter's top bits never reached in the record read as constant). Withgroups(a terminal per frame, e.g. from rpps.analysis.burst), steps within each group: frames in record order, each group its own count - length: with
lengths(each frame's own, in bits or symbols), a run whose value is a*length + b for one a, b - enum: a run taking at most
max_valuesvalues over the frames (a type, a flag set), grown while it stays few: at most half the values its width holds, and well under the distinct values random bits show over as many frames - random: the rest, each run's bias (mean of its bits) given; "varying" for a lone column between fields
Classes:
| Name | Description |
|---|---|
Field |
start (bit), width, kind (constant, counter, id, length, enum, random, varying), detail (dict: value, step, |
FieldMap |
|
Functions:
| Name | Description |
|---|---|
map |
FieldMap of the frames (bit rows, aligned at their first bit). groups: a label a frame (a terminal), for counters |
Field ¶
start (bit), width, kind (constant, counter, id, length, enum, random, varying), detail (dict: value, step, order, values {value: count}, scale, offset, bias)
Source code in src/rpps/analysis/framing/fields.py
FieldMap ¶
map: fields (covering bits 0 .. length - 1 in order), length, frames
Attributes:
| Name | Type | Description |
|---|---|---|
guess |
The fields as a link header definition (config/header/link/guess/ |
Source code in src/rpps/analysis/framing/fields.py
guess
property
¶
The fields as a link header definition (config/header/link/guess/
map ¶
FieldMap of the frames (bit rows, aligned at their first bit). groups: a label a frame (a terminal), for counters within each and ids; lengths: each frame's length, for length fields; length: bits to map (default: the shortest frame's)
Source code in src/rpps/analysis/framing/fields.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
frames ¶
Blind symbol framing: the period a symbol stream repeats with, the unique word that marks it, and the frames cut on it
fr = rp.analysis.framing.frames.find(symbols, "qpsk") # Frame(period, uw_start, uw_length, coherence, ...) or None
frames = rp.analysis.framing.frames.cut(symbols, fr) # frames x period, each turned so its unique word matches the first
bits = rp.analysis.framing.frames.payload_bits(frames, fr, "qpsk") # frames x payload bits, for rpps.analysis.code.block.linear / fec.solve
A modem that frames its symbols (a unique word ahead of each block of coded data: TPC and LDPC SCPC modems, TDM framing,
a TDMA burst's preamble) sends the same few symbols every P symbols. The product y[n] conj(y[n+P]) is then coherent at
those positions and random elsewhere: averaged over many frames, it stands out where the unique word is, and P is the
lag whose average stands out most (find). The carrier phase may differ frame to frame by a multiple of 360/M degrees
(the M-fold ambiguity of a feed-forward carrier, or a slip), which the unique word itself resolves (cut).
Coded data under the unique word is random-looking; data that repeats (idle frames, fill) makes whole frames equal, and
repeats finds the period of that (a superframe, or how often a frame is sent again).
Classes:
| Name | Description |
|---|---|
Frame |
|
Hit |
|
Burst |
|
Functions:
| Name | Description |
|---|---|
comb_lags |
[(lag, z)] the lags in [min_lag, max_lag] a frame structure may repeat at, most significant first |
periods |
[(lag, z)] the lags locked symbols may repeat at with a frame, most significant first ( |
coherence |
Per position in the period: |mean over frames of y[n] conj(y[n+period])| over their rms, 1 where every frame has the |
find |
The frame structure of locked symbols y: a Frame, or None (no lag with a unique word standing out) |
grid_of |
The turns a constellation is symmetric under. The largest M of 2, 4, 8, 16 that turns its points onto |
cut |
Frames x period symbols starting at the unique word, each turned onto the others by its unique word |
payload_bits |
Frames x bits of the symbols after each unique word, hard-decided on |
repeats |
(period, fraction of frames equal to the one |
word_waveform |
The symbols |
find_word |
Where a known symbol word (a preamble, a burst's unique word) is in baseband samples x at Fs: [Hit] best first |
split |
Where touching bursts meet in x[a:b]: [(start, stop)] |
occupied |
The bandwidth holding |
gate |
[(start, stop)] where the power is on: above the geometric mean of its low and high levels ( |
centroid |
The power-weighted mean frequency (Hz) of the spectrum's bins above twice its 10th-percentile floor: a coarse |
tone_pair |
The middle (Hz) of the strongest pair of spectral lines |
bursts |
The bursts of x ( |
preamble |
What the bursts' first symbols share: (length, differential symbols d[n] = s[n] conj(s[n-1]) of it, where it starts |
coarse_cfo |
Carrier offset [Hz] from the line of x^M (the modulation's M-fold symmetry taken off) |
pilot_frames |
Frames of symbols synchronized on their unique word as pilots: (frames x period symbols from each word on, the words' |
Frame ¶
find: period (symbols), uw_start (position in the period), uw_length (symbols), coherence (of the unique word,
1 = the same symbols every frame), floor (of the other positions), uw (the unique word's symbols, from the first
frame), frames (how many the estimate is over)
Source code in src/rpps/analysis/framing/frames.py
Hit ¶
Burst ¶
bursts: start, stop (samples), det (rpps.sync.Detection of this burst alone, None if too short), symbols
(matched-filtered at det's rate and timing, carrier offset and phase taken off)
Source code in src/rpps/analysis/framing/frames.py
comb_lags ¶
[(lag, z)] the lags in [min_lag, max_lag] a frame structure may repeat at, most significant first
za: |autocorrelation| at every lag 0..n-1 in noise units (|sum of products| / its standard deviation under noise),
whose |.| has mean and var there (Rayleigh for complex, half-normal for real). A word of U symbols every P adds
only U/P to the correlation at lag P, against noise of 1/sqrt(n): alone that takes hundreds of frames to show. But
it adds the same at every multiple kP, where the noise is new: z sums za less its mean over the multiples of a lag up
to half the stream, each weighted by the signal it can hold (sqrt(n - kL)). That is what a fold of the stream at
that lag measures, so a short word is a candidate about sqrt(frames) times sooner; magnitudes are summed, so a
carrier left turning slowly (a residual offset, phase noise) or a polarity that changes costs only the coherence
across the multiples. The top lags by that sum, and the PLAIN_TOP lags by their own correlation alone (a
structure seen once a frame at one lag only, which the sum spreads out).
Source code in src/rpps/analysis/framing/frames.py
periods ¶
[(lag, z)] the lags locked symbols may repeat at with a frame, most significant first (comb_lags over their
autocorrelation, one FFT)
Source code in src/rpps/analysis/framing/frames.py
coherence ¶
Per position in the period: |mean over frames of y[n] conj(y[n+period])| over their rms, 1 where every frame has the same symbol. A product over 3 times the rms is clipped there, so one loud sample can't stand for a word; by chance (m frames) a position reaches c with probability about exp(-m c^2)
Source code in src/rpps/analysis/framing/frames.py
find ¶
The frame structure of locked symbols y: a Frame, or None (no lag with a unique word standing out)
The candidate periods are the lags whose multiples the symbols correlate at (periods), with their divisors (a
multiple of the frame is a superframe, kept for repeats); at a period, the unique word is the longest
run of positions whose coherence passes threshold (with many frames less: sqrt(4/m), but at least min_coherence:
a unique word is in every frame, which a weak signal's 0.2 or more still shows), taken only when chance could
not have made it (_chance, times every position and candidate period looked at, under false_alarm): one
coherent symbol is not a word. Data that itself repeats every few frames doesn't average
out, which hides the unique word (most positions coherent): then frame by hand and use repeats.
Source code in src/rpps/analysis/framing/frames.py
grid_of ¶
The turns a constellation is symmetric under. The largest M of 2, 4, 8, 16 that turns its points onto
themselves by 360/M degrees (BPSK 2, QPSK and square QAM 4, 8PSK 8), 1 for none. cut's grid
Source code in src/rpps/analysis/framing/frames.py
cut ¶
Frames x period symbols starting at the unique word, each turned onto the others by its unique word
The reference is the word averaged over all frames (one frame's own word is as noisy as any symbol), found in two
passes: frames turned onto the first frame's word by multiples of 90 degrees, averaged, then every frame onto that
average. M=None: by the angle measured (also takes off a carrier phase drifting frame to frame); M: by the nearest
multiple of 360/M degrees only (the ambiguity alone). Then the whole set is turned so the payload sits on a
grid-fold symmetric constellation (QPSK points at 45 + 90k degrees, as rpps.symbol's), by its grid-th power: the
constellation's own symmetry (grid_of; 4 on BPSK turns it 45 degrees off its points).
Source code in src/rpps/analysis/framing/frames.py
payload_bits ¶
Frames x bits of the symbols after each unique word, hard-decided on constellation (a name or a Constellation)
Source code in src/rpps/analysis/framing/frames.py
repeats ¶
(period, fraction of frames equal to the one period before): the smallest such period, or (None, 0.0). Frames
that come again (idle, fill, a fixed superframe) are content, not code
Source code in src/rpps/analysis/framing/frames.py
word_waveform ¶
The symbols word shaped by an RRC pulse at a fractional sps samples per symbol
Source code in src/rpps/analysis/framing/frames.py
find_word ¶
Where a known symbol word (a preamble, a burst's unique word) is in baseband samples x at Fs: [Hit] best first
bauds: the symbol rates to try. The word's shaped waveform is cut into segments pieces, each correlated on its own
and their magnitudes added, so a carrier offset that turns the phase across the word (up to about baud/len(word)*
segments/4) and an unknown phase cost nothing. score: that sum over what the samples' energy allows (Cauchy-Schwarz),
near 1 where the word is, about 1/sqrt(samples per segment) elsewhere.
Source code in src/rpps/analysis/framing/frames.py
split ¶
Where touching bursts meet in x[a:b]: [(start, stop)]
no gap the gate sees, or one shorter than its hang. Found by
- guard times: dips of the power (smoothed over a quarter of a symbol) 10 dB under the span's level,
min_gaplong at least and much longer than the bursts' own envelope dips (_guards) - power steps between transmitters' levels: binary segmentation of the power (dB) in windows of
win(32 samples at least), the gain over its noise abovethr(default 30 + 6 ln(windows): above chance over every position)
bw: the occupied bandwidth (Hz), when known: windows of 8 symbols and guards of a symbol at least (a slow
signal's envelope dips within a symbol). guards: look for guard times (not when the bursts stand under 10 dB over
the floor, where noise dips as deep). Parts min_len long at least. Not cut: bursts at one level with no guard between them, told apart only by their
carriers (the line of x^M in a few symbols is mostly the data's own noise; tried and dropped)
Source code in src/rpps/analysis/framing/frames.py
occupied ¶
The bandwidth holding share of the power above the noise floor (Hz): about the symbol rate of a shaped signal
Source code in src/rpps/analysis/framing/frames.py
gate ¶
[(start, stop)] where the power is on: above the geometric mean of its low and high levels (contrast apart at
least), bursts closer than hang merged, those shorter than min_len dropped; each span then cut where bursts
touch (split: a power step or a guard time), unless touching is False. Times scale with a symbol, 1/bw (the
occupied bandwidth, occupied):
- the levels from the power averaged over 64 symbols (noise alone then spans under 2 between its 5th and 99th
percentiles, so contrast tells bursts from noise; averaged over a sample or two, noise alone would pass it)
- on and off from the power averaged over enough symbols that noise stays 4 standard deviations from the threshold
((4/(sqrt(hi/lo) - 1))^2 symbols, 2 to 64, and smooth at least: a weak signal is averaged longer)
- hang at least 6 symbols and twice that average (a slow or weak signal's own dips do not open the gate)
Source code in src/rpps/analysis/framing/frames.py
centroid ¶
The power-weighted mean frequency (Hz) of the spectrum's bins above twice its 10th-percentile floor: a coarse carrier for a signal cut off-centre
Source code in src/rpps/analysis/framing/frames.py
tone_pair ¶
The middle (Hz) of the strongest pair of spectral lines sep apart (to tol of it) in the samples x, or None:
a periodic preamble (1100...: tones at the carrier +-baud/4) puts its carrier between two lines, which squaring
cannot tell from the lines themselves. Lines are taken over the floor (median of the spectrum), both min_snr over it
Source code in src/rpps/analysis/framing/frames.py
bursts ¶
The bursts of x (gate), each acquired on its own: rate (or baud for all), modulation, offset, timing (as a
TDMA receiver must: every burst comes from another transmitter, with its own clock and carrier). The rate is the
|x|^2 line within 0.7 to 1.4 times the burst's occupied bandwidth (occupied). What is known
narrows each burst's search: baud (no rate search), names (the modulations to try), betas (the roll-offs).
[Burst]
Source code in src/rpps/analysis/framing/frames.py
preamble ¶
What the bursts' first symbols share: (length, differential symbols d[n] = s[n] conj(s[n-1]) of it, where it starts
in each burst's symbols) or (0, None, None). Differential, so each burst's own carrier phase drops out; each burst is slid by up to search
symbols onto the first (the gate finds a start to within a few symbols), and the preamble is the leading run where
the bursts' d[n] agree (|mean| over bursts above agree)
Source code in src/rpps/analysis/framing/frames.py
coarse_cfo ¶
Carrier offset [Hz] from the line of x^M (the modulation's M-fold symmetry taken off)
Source code in src/rpps/analysis/framing/frames.py
pilot_frames ¶
pilot_frames(x, Fs, uw, baud, period, beta=0.35, span=8, threshold=0.45, M=4, dropout=0.6, track=64, smooth=8)
Frames of symbols synchronized on their unique word as pilots: (frames x period symbols from each word on, the words' sample times)
Each word is found in the samples (find_word) and timed to a fraction of a sample; the symbols of a frame lie evenly
between its word and the next one, which follows the transmitter's clock frame by frame. The carrier phase is measured
on each word and taken linearly across the frame to the next (a frequency per frame), so no loop has to settle and a
slip can't carry over. uw: the word's symbols (from cut: the first frame's, or their mean). The coarse carrier offset
comes off first, from the M-th power (coarse_cfo). threshold: the first word's match (find_word; a short word's
pulse tails overlap random neighbours, which caps it near 0.6); dropout: a word under this times the running level is
taken as missing, and the clock carried over it. track: symbols over which the phase left between the words (LNB
phase noise) is taken off by the M-th power (0: none). smooth: the words' times are fitted with a line over this many
frames either side (a short word times one frame noisily; 0: as measured).
Source code in src/rpps/analysis/framing/frames.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 | |
marked ¶
Frames behind a sync marker, the scrambler restarted at each, the block code inside (rpps.analysis.framing.marked)
layer(bits) on any bit stream: a shipped profile's marker (markers) repeating at one period, within MAX_ERRORS
bits, either polarity; then none or each additive scrambler restarted per frame; then each byte RS code dividing the
frame, behind each block interleaver with a depth, scored by the words that decode within t against a random word's
chance (chance). Returns Frames, whose steps are the profile steps that read it (CCSDS TM: ASM, randomizer, RS
interleaved to depth I).
Classes:
| Name | Description |
|---|---|
Frames |
A frame layer |
Functions:
| Name | Description |
|---|---|
markers |
{name: bits} of the profiles' sync markers. MIN_MARKER bits or longer |
chance |
A random word's chance to decode. Within t of an RS codeword: about C(n, t) (q - 1)^t / q^(2t), q = 2^m |
layer |
The frame layer in |
Frames ¶
markers ¶
chance ¶
A random word's chance to decode. Within t of an RS codeword: about C(n, t) (q - 1)^t / q^(2t), q = 2^m
Source code in src/rpps/analysis/framing/marked.py
layer ¶
The frame layer in bits: a Frames, or None. None when no marker repeats. Without a code that
decodes inside, the Frames has the marker, period and scrambler as far as they go (code None). z: the z a code
hypothesis must pass (default: rpps.math.prob.z_critical over the hypotheses tried)
Source code in src/rpps/analysis/framing/marked.py
payload ¶
What decoded bits carry: known framings found at any bit offset, and a verdict on what is left
found = rp.analysis.framing.payload.signatures(bits) # [Found("E1 G.704", period 512, offset 37, ...), ...]
v = rp.analysis.framing.payload.verdict(bits) # "structured" / "scrambled" / "random-looking", and why
Each signature is a test whose chance rate is known, run at every bit offset, so a hit is judged against how often random bits would give it: E1 (ITU G.704) the frame alignment word x0011011 in time slot 0 of every other 256-bit frame (period 512) T1 (ITU G.704) one framing bit every 193, repeating the superframe pattern (100011011100 for D4/SF, a 001011 pattern every 4th bit for ESF): a column of the 193-bit grid far from random ATM cells (I.432) 53-byte cells whose fifth byte is the CRC-8 (x^8 + x^2 + x + 1) of the first four, xor 0x55 GFP (G.7041) a core header whose 16-bit cHEC is the CRC-16 (x^16 + x^12 + x^5 + 1) of its length field, the four bytes xored with 0xB6AB31E0, and the next header that length + 4 bytes on HDLC / PPP / LAPD every run of six ones a flag 01111110 (bit stuffing), not half of them IPv4 20-byte headers starting 0x45 whose ones-complement checksum holds CCSDS the attached sync marker 0x1ACFFC1D at a period MPEG-TS 0x47 every 188 bytes (204 with Reed-Solomon parity) fixed word any bits constant at a period (frame structure in general, a unique word after demodulation, bit errors and all), the period from the autocorrelation summed over its multiples
verdict combines them with the plain statistics: bias, byte distribution, autocorrelation, linear complexity over
windows (an additive LFSR scrambler shows as complexity much below half a window), and how well zlib compresses.
Classes:
| Name | Description |
|---|---|
Found |
A signature found: name, period (bits, or None), offset (first bit), hits, expected (by chance), z, detail; a |
Verdict |
Result of |
Functions:
| Name | Description |
|---|---|
e1 |
G.704 frame alignment: x0011011 every 512 bits (the first bit, Si, is free), in most frames (a framed stream's own |
t1 |
A column of the 193-bit grid far from random: its bits repeat with the superframe (12 for SF, 4-bit steps in ESF) |
atm |
53-byte cells: HEC = CRC-8(x^8+x^2+x+1) of the first four header bytes, xor 0x55 (I.432), at some bit offset |
gfp |
GFP core headers: PLI (16) + cHEC = CRC-16 of PLI, the four bytes xored with 0xB6AB31E0; frames chained by PLI |
hdlc |
HDLC / PPP / LAPD: bit stuffing leaves no run of six ones but a flag's (01111110), where in random bits half of the |
ipv4 |
20-byte IPv4 headers: 0x45, total length >= 20, ones-complement checksum of the ten words 0xFFFF |
ccsds |
The attached sync marker 0x1ACFFC1D at a period (any of |
mpeg_ts |
0x47 every 188 or 204 bytes |
fixed_word |
Bits constant at a period, as a unique word after demodulation: Found with the period, the word (its longest run |
signatures |
Every signature that holds on the bits (see the module), strongest first (on the first |
verdict |
structured (a signature, bias, uneven bytes, or zlib compresses it), scrambled (an LFSR: windows' linear |
Found ¶
A signature found: name, period (bits, or None), offset (first bit), hits, expected (by chance), z, detail; a
word found (fixed_word): word (hex, first bit sent most significant), bits, mismatches (median, 99%) per frame
Source code in src/rpps/analysis/framing/payload.py
Verdict ¶
Result of verdict: kind ("structured", "scrambled", "random-looking"), why, signatures, bias (|mean - 1/2|*2),
byte_chi (z of the byte distribution, the worst of 8 offsets), lc (linear complexity over windows / their length),
compress (zlib size / size)
Source code in src/rpps/analysis/framing/payload.py
e1 ¶
G.704 frame alignment: x0011011 every 512 bits (the first bit, Si, is free), in most frames (a framed stream's own fixed fields can hold the word at a period by chance, in some of them)
Source code in src/rpps/analysis/framing/payload.py
t1 ¶
A column of the 193-bit grid far from random: its bits repeat with the superframe (12 for SF, 4-bit steps in ESF)
Source code in src/rpps/analysis/framing/payload.py
atm ¶
53-byte cells: HEC = CRC-8(x^8+x^2+x+1) of the first four header bytes, xor 0x55 (I.432), at some bit offset
Source code in src/rpps/analysis/framing/payload.py
gfp ¶
GFP core headers: PLI (16) + cHEC = CRC-16 of PLI, the four bytes xored with 0xB6AB31E0; frames chained by PLI
Source code in src/rpps/analysis/framing/payload.py
hdlc ¶
HDLC / PPP / LAPD: bit stuffing leaves no run of six ones but a flag's (01111110), where in random bits half of the windows 0111111 go on with a 1
Source code in src/rpps/analysis/framing/payload.py
ipv4 ¶
20-byte IPv4 headers: 0x45, total length >= 20, ones-complement checksum of the ten words 0xFFFF
Source code in src/rpps/analysis/framing/payload.py
ccsds ¶
The attached sync marker 0x1ACFFC1D at a period (any of periods, default every multiple of 8 up to 16384 found
from its own hits)
Source code in src/rpps/analysis/framing/payload.py
mpeg_ts ¶
0x47 every 188 or 204 bytes
Source code in src/rpps/analysis/framing/payload.py
fixed_word ¶
fixed_word(bits, max_period=16384, z_min=8.0, min_bits=8, agree=0.75, alpha=0.001, false_alarm=1e-06)
Bits constant at a period, as a unique word after demodulation: Found with the period, the word (its longest run
of constant positions: word, a hex string sent first bit first, bits long, at offset), hits (every constant
position), and in mismatches the bits each frame's copy differs by (median, 99th percentile)
The candidate periods sum the bits' autocorrelation over the multiples of each lag (frames.comb_lags), so a short
word shows within a few dozen frames. A position is constant when at least agree of the frames hold the same bit
there, which channel bit errors mostly leave it (an exact agreement they would not); one such position is common by
chance over few frames, a stretch of them is not. The word is the stretch where they gather most (one position bit
errors left short breaks it not), taken when its chance over every position and candidate looked at is under
alpha. The whole stream inverted keeps its words (the
word given is as received). errors in detail is what a delimit step could allow: a margin over the 99th
percentile, no more than rpps.sync.word_errors at false_alarm over a period of positions.
Source code in src/rpps/analysis/framing/payload.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | |
signatures ¶
Every signature that holds on the bits (see the module), strongest first (on the first max_bits)
Source code in src/rpps/analysis/framing/payload.py
verdict ¶
structured (a signature, bias, uneven bytes, or zlib compresses it), scrambled (an LFSR: windows' linear
complexity well under half their length), or random-looking (encrypted, compressed, or under something not linear).
frame: bits a frame (or frames (F, n) given): whole frames that repeat (idle fill) are set aside first, as they would
make random data compress. On the first max_bits
Source code in src/rpps/analysis/framing/payload.py
randomness ¶
Is a bit stream as random as a cipher's output? NIST SP 800-22 tests, and byte-level entropy
r = rp.analysis.framing.randomness.test(bits)
r.p # {test: P-value}: frequency, block_frequency, runs, serial_1, serial_2, approximate_entropy,
# cusum_forward, cusum_backward, byte_chi2
r.passed, r.failed # each against alpha / (number of P-values): a random stream fails one test in 100 runs
r.entropy # Shannon entropy of the bytes [bits a byte], 8 at most
r.verdict # "random" (indistinguishable from a cipher's output), "high entropy" (fails some test,
# its bytes near uniform), or "low entropy"
The tests are NIST SP 800-22 rev. 1a (section 2), as the standard defines them, each checked against its worked examples: frequency (2.1), frequency within a block (2.2), runs (2.3), serial (2.11), approximate entropy (2.12) and cumulative sums (2.13), plus a chi-square test of the 256 byte values. Entropy alone cannot tell encrypted from compressed data, both are near 8 bits a byte; the tests that work best at it are block frequency, cumulative sums, serial and approximate entropy, and the byte chi-square (De Gaspari et al., "Reliable detection of compressed and encrypted data", 2022; HEDGE, 2019; Davies et al., "Comparison of entropy calculation methods for ransomware encrypted file identification", 2022). So a stream that passes every test is called "random": encrypted, keyed (a stream cipher), or a true random source; one with high byte entropy that fails some test is "high entropy": compressed, or a weak scrambler or cipher. A short stream cannot tell either well: the tests' input-size recommendations are kept (each test needs at least 100 bits, the block, serial and entropy lengths grow with n).
Classes:
| Name | Description |
|---|---|
Result |
|
Functions:
| Name | Description |
|---|---|
frequency |
2.1: the proportion of ones |
block_frequency |
2.2: the proportion of ones in M-bit blocks (M >= 20, M > n/100, fewer than 100 blocks) |
runs |
2.3: the number of runs of identical bits (0 when the frequency prerequisite fails) |
serial |
2.11: every overlapping m-bit pattern equally often (m < log2 n - 2). Returns (P-value 1, P-value 2) |
approximate_entropy |
2.12: the frequencies of overlapping m- and (m+1)-bit patterns (m < log2 n - 5) |
cusum |
2.13: the largest excursion of the random walk of +-1 (mode 0 forward, mode 1 backward) |
byte_chi2 |
Chi-square of the 256 byte values against uniform (255 degrees of freedom) |
byte_entropy |
Shannon entropy of the bytes [bits a byte] |
test |
Every test on (the first |
Result ¶
test: p {test: P-value}, alpha (per test, after the multiple-test correction), passed, failed [test names],
entropy (bits a byte), n (bits tested), verdict
Source code in src/rpps/analysis/framing/randomness.py
frequency ¶
block_frequency ¶
2.2: the proportion of ones in M-bit blocks (M >= 20, M > n/100, fewer than 100 blocks)
Source code in src/rpps/analysis/framing/randomness.py
runs ¶
2.3: the number of runs of identical bits (0 when the frequency prerequisite fails)
Source code in src/rpps/analysis/framing/randomness.py
serial ¶
2.11: every overlapping m-bit pattern equally often (m < log2 n - 2). Returns (P-value 1, P-value 2)
Source code in src/rpps/analysis/framing/randomness.py
approximate_entropy ¶
2.12: the frequencies of overlapping m- and (m+1)-bit patterns (m < log2 n - 5)
Source code in src/rpps/analysis/framing/randomness.py
cusum ¶
2.13: the largest excursion of the random walk of +-1 (mode 0 forward, mode 1 backward)
Source code in src/rpps/analysis/framing/randomness.py
byte_chi2 ¶
Chi-square of the 256 byte values against uniform (255 degrees of freedom)
Source code in src/rpps/analysis/framing/randomness.py
byte_entropy ¶
Shannon entropy of the bytes [bits a byte]
test ¶
Every test on (the first max_bits of) the bits. A test fails below alpha / (number of P-values), so a random
stream fails any one in about 1 run of 1/alpha. Fewer than 1000 bits: None (too short to say)
Source code in src/rpps/analysis/framing/randomness.py
telemetry ¶
Residual-carrier PM telemetry (PCM/PSK/PM): the carrier, each subcarrier's data, its line code and its frames
t = rp.analysis.framing.telemetry.analyze(x, Fs) # None when x has no residual carrier
print(t) # the carrier, then a line per subcarrier
t.subcarriers[0].bits # data bits (line code removed), t.subcarriers[0].frame
Spacecraft telemetry and command links phase-modulate a carrier by less than 90 degrees, so part of the power stays in a carrier line (rpps.analysis.modulation.pm finds it, the index, and the phase phi(t) around it). The data rides in phi, on the carrier itself or on subcarriers: a subcarrier is BPSK-modulated (a square or sine wave whose sign is the data), at a rate set apart from the others. Per subcarrier: 1. its rate: the cyclic line at baseband (rpps.analysis.spectrum.cyclic), twice the spacing of its line pair (idle 1010 shows as lines at +-rate/2), and twice those (Manchester chips): the one whose integrate-and-dump symbols split cleanest, of those whose symbols don't come in equal pairs (twice the real rate) 2. BPSK symbols: the subcarrier's phase from its square (a squared-carrier reference smoothed over 20 ms), integrated over each symbol from the boundary that splits them best 3. the line code: Manchester (biphase-L: every pair of chips opposite) halves the rate; differential (NRZ-M/S) shows as frames that only line up after XOR with the previous bit 4. idle (alternating or constant bits), else frames: the period of the bits' autocorrelation, the fixed bits within it, and counters (a field that steps by one every frame)
Classes:
| Name | Description |
|---|---|
TelemetryFrame |
period (bits), fixed (bits constant over the frames), frames (how many folded), counters [(bit, width, step)] |
Subcarrier |
One subcarrier (or the data on the carrier itself: freq 0): freq, baud (symbol rate), quality (|mean|/std of the |
Telemetry |
pm: the rpps.analysis.modulation.pm result; subcarriers: [Subcarrier] |
Functions:
| Name | Description |
|---|---|
bpsk |
(soft symbols, quality, Es/N0 dB) of BPSK at complex baseband z: phase from z^2, integrate and dump at the boundary |
doubled |
Whether chips come in equal pairs (at one alignment): symbols at twice the real rate |
manchester |
(fraction of chip pairs opposite, alignment, data bits (the first chip of each pair)) at the better alignment |
idle |
What idle pattern bits are (alternating, constant), or None |
period |
(lag, |r|, fixed fraction) of the frame period: of the autocorrelation peaks past min_lag standing out of the noise |
counters |
[(bit, width, step)] of fields in the folded frames F that step by +-1 a frame (in |
frame |
TelemetryFrame of the bits, or None when no period shows |
line_code |
(manchester, differential, data bits) of hard chips: Manchester when nearly every pair is opposite; differential |
subcarrier |
Subcarrier at fsc (Hz) of the phase phi: its rate, symbols, line code, and frames (see the module) |
symmetry |
(symmetry, sidebands): how well the spectrum mirrors about the carrier, 0..1 (sum(min)/sum(max) of the power |
analyze |
Telemetry of x (complex baseband, Fs), or None when rpps.analysis.modulation.pm finds no residual carrier |
TelemetryFrame ¶
Subcarrier ¶
One subcarrier (or the data on the carrier itself: freq 0): freq, baud (symbol rate), quality (|mean|/std of the soft symbols' size), esn0 (dB), manchester, differential, rate (data bits/s), idle (None, or what pattern), bits (data), frame (TelemetryFrame or None), why (when no symbols split)
Methods:
| Name | Description |
|---|---|
head |
Where, the modulation and line code, without the bits' content |
Source code in src/rpps/analysis/framing/telemetry.py
head ¶
Where, the modulation and line code, without the bits' content
Source code in src/rpps/analysis/framing/telemetry.py
Telemetry ¶
bpsk ¶
(soft symbols, quality, Es/N0 dB) of BPSK at complex baseband z: phase from z^2, integrate and dump at the boundary whose symbols split cleanest
Source code in src/rpps/analysis/framing/telemetry.py
doubled ¶
Whether chips come in equal pairs (at one alignment): symbols at twice the real rate
Source code in src/rpps/analysis/framing/telemetry.py
manchester ¶
(fraction of chip pairs opposite, alignment, data bits (the first chip of each pair)) at the better alignment
Source code in src/rpps/analysis/framing/telemetry.py
idle ¶
What idle pattern bits are (alternating, constant), or None
Source code in src/rpps/analysis/framing/telemetry.py
period ¶
(lag, |r|, fixed fraction) of the frame period: of the autocorrelation peaks past min_lag standing out of the noise (and above FRAME_R) and their divisors, the smallest whose fold leaves nearly the most bits fixed beyond chance (byte or word structure correlates at short lags but fixes nothing; a frame's sync and header do). (None, 0, 0) when none fixes MIN_FIXED of its bits
Source code in src/rpps/analysis/framing/telemetry.py
counters ¶
[(bit, width, step)] of fields in the folded frames F that step by +-1 a frame (in hold of the frames: a bit
error breaks a step or two), the widest first
Source code in src/rpps/analysis/framing/telemetry.py
frame ¶
TelemetryFrame of the bits, or None when no period shows
Source code in src/rpps/analysis/framing/telemetry.py
line_code ¶
(manchester, differential, data bits) of hard chips: Manchester when nearly every pair is opposite; differential when the XOR of neighbours frames with more bits fixed than the bits themselves
Source code in src/rpps/analysis/framing/telemetry.py
subcarrier ¶
Subcarrier at fsc (Hz) of the phase phi: its rate, symbols, line code, and frames (see the module)
Source code in src/rpps/analysis/framing/telemetry.py
symmetry ¶
(symmetry, sidebands): how well the spectrum mirrors about the carrier, 0..1 (sum(min)/sum(max) of the power standing clear of the noise, ABOVE times its level per bin, at carrier +-f), and that power's ratio to the carrier's. Phase modulation by a real phase whose sign flips as often as not (data) has a real autocorrelation, so a spectrum symmetric about its carrier, with sidebands that hold power; a tone beside another signal mirrors badly, a tone in noise has no sidebands. A Hann window keeps a strong carrier's own leakage out of them. band (Hz, centred) and snr_db (the signal's SNR in it): x was filtered to that band, so the noise is band-limited, not the median bin (which sits in the filter's stopband: in-band noise alone would stand clear of it, and mirror). Its level is then the band's mean over 1 + SNR
Source code in src/rpps/analysis/framing/telemetry.py
analyze ¶
Telemetry of x (complex baseband, Fs), or None when rpps.analysis.modulation.pm finds no residual carrier
Source code in src/rpps/analysis/framing/telemetry.py
rpps.analysis.identify ¶
Blind FEC identification
Takes hard bits (what a demodulator produced, with an unknown bit mapping, rotation and alignment) and asks which code they are most likely carrying. Every test is a parity relation that holds on codewords but is a coin flip on anything else, so a hypothesis is scored by how far its relation sits from 50% (a deviance z-score), then corrected for how many hypotheses were tried.
conv: rate 1/n feed-forward convolutional codes. For generators g_a, g_b: (c_a * g_b) xor (c_b * g_a) = 0
block: any linear block code / LDPC given its parity-check matrix H, at every word alignment
scramblers: an additive scrambler of period T just adds a fixed pattern to the relation, so folding the relation
by T (with periods) finds it. Self-synchronising scramblers are undone with descramblers first.
The tests are about structure, not about being right: a noisy channel weakens them, and the verdict is None when nothing stands out.
rpps.analysis.modulation ¶
What carries the symbols (see rpps.analysis)
How low an Es/N0 cumulants.classify (and rpps.sync.detect) names each constellation at: tools/modclass_bench.py, its
findings in its docstring, kept by tests/unit/analysis/modulation/test_modclass_threshold.py
Modules:
| Name | Description |
|---|---|
cancel |
How much of a signal we are locked to: regenerate it from its symbols, subtract it, and measure what is left |
cpm |
GMSK and SOQPSK: binary continuous-phase modulation demodulated by a sequence detector, blind to timing and carrier |
cumulants |
Higher-order cumulants of symbols: which constellation, blind to Gaussian noise and to the carrier phase |
fsk |
Frequency-shift keying and continuous-phase modulation from the instantaneous frequency: tones, rate, index, pulse |
impairments |
What else than noise is in locked symbols: amplifier compression (AM/AM, AM/PM), IQ imbalance, phase noise, neighbours |
pm |
Phase modulation with a residual carrier (PCM/PM, telemetry and ranging): carrier, index, the data on the carrier, tones |
quality |
Whether hard decisions from locked symbols can be trusted for blind tests ( |
cancel ¶
How much of a signal we are locked to: regenerate it from its symbols, subtract it, and measure what is left
c = rp.analysis.modulation.cancel.cancel(x, Fs, symbols, sps, tau) # x: samples; symbols: decided (or re-encoded) symbols,
# symbol k at sample tau + k sps
print(c) # e.g. "excess 0.2 dB over the floor: SNR 18.3 dB after cancelling, 18.5 dB the floor allows"
c.residual # x without the signal: run rp.analysis.survey / cyclic.features on it for what was underneath
The paired-carrier (PCMA) receiver's step, used as a measurement. A linear modulation is x[n] = sum_k s_k h(n - tau -
k sps) + noise. With the symbols known (decisions, or better the decoded bits encoded again), the pulse h, gain, phase,
timing, a fractional rate and any linear distortion are one least-squares fit: h is a combination of band-limited
kernels half a symbol apart (span symbols each side), fitted again every block symbols so slow phase, gain and timing
drift are followed. What the fit cannot take off is noise plus whatever our model of the signal misses: phase noise
faster than a block, non-linearity, symbol decisions that are wrong, interference, a slip.
The measure is the residual's density in the signal's band against the noise floor outside it (the capture must be
wider than the signal): excess_db 0 means everything left is thermal noise, and the SNR after cancelling equals the
SNR the floor allows; every dB of excess is signal we are not locked to. profile is the excess block by block (where
lock is lost or a burst of interference arrives). The residual is also how a second, weaker signal under the first is
found: the strong one taken off, survey the rest.
Classes:
| Name | Description |
|---|---|
Cancelled |
Result of |
Functions:
| Name | Description |
|---|---|
kernel |
Band-limited kernel (|f| < 1/sps cycles a sample, the band of a pulse with roll-off up to 1) of half-symbol |
regressors |
The basis signals: column j (of 4 span + 1) is sum_k s_k kernel(n - tau - k sps - j' sps/2), j' = j - 2 span. |
decide |
Nearest constellation point of each symbol |
cancel |
Regenerate the signal from its symbols and take it off x (see the module). symbols: complex symbol values, symbol k |
align |
Where the symbols are in x: tau (samples) of symbol 0, from the cross-correlation of x with the symbols shaped by |
Cancelled ¶
Result of cancel. residual: x less the regenerated signal; model: the regenerated signal; excess_db: residual
density in band over the floor outside (None without an outside); snr_cancel_db: signal over residual in band;
snr_floor_db: signal over the floor in band (what perfect lock leaves); profile: excess per block (dB);
bandwidth: the band (Hz) measured; cfo: the frequency (Hz) taken off before fitting; explained: fraction of x's
in-band power the model takes off
Attributes:
| Name | Type | Description |
|---|---|---|
loss_db |
SNR lost to what we are not locked to |
Source code in src/rpps/analysis/modulation/cancel.py
kernel ¶
Band-limited kernel (|f| < 1/sps cycles a sample, the band of a pulse with roll-off up to 1) of half-symbol spacing, Hann-tapered to +-span symbols: t in samples
Source code in src/rpps/analysis/modulation/cancel.py
regressors ¶
The basis signals: column j (of 4 span + 1) is sum_k s_k kernel(n - tau - k sps - j' sps/2), j' = j - 2 span. Returns an n x (4 span + 1) complex array
Source code in src/rpps/analysis/modulation/cancel.py
decide ¶
Nearest constellation point of each symbol
cancel ¶
Regenerate the signal from its symbols and take it off x (see the module). symbols: complex symbol values, symbol k at sample tau + k sps (sps may be fractional; a slow clock drift is followed by the block fits). block: symbols per fit. widely: fit the conjugate too (IQ imbalance). cfo: Hz to take off first (None: estimated from the fits)
Source code in src/rpps/analysis/modulation/cancel.py
align ¶
Where the symbols are in x: tau (samples) of symbol 0, from the cross-correlation of x with the symbols shaped by the basis's centre kernel. Only the symbol offset needs to be right: the fitted pulse takes up any timing error within a few symbols. search: the samples tau may be in (default the first quarter of x)
Source code in src/rpps/analysis/modulation/cancel.py
cpm ¶
GMSK and SOQPSK: binary continuous-phase modulation demodulated by a sequence detector, blind to timing and carrier
r = rp.analysis.modulation.cpm.demodulate(x, Fs, "gmsk_0.3") # or "soqpsk_tg", "soqpsk_mil", "msk", "gmsk_0.5" ...
r.bits, r.baud, r.cfo, r.match # bits, symbol rate, carrier offset (Hz), fit 0..1
best = rp.analysis.modulation.cpm.identify(x, Fs) # [(match, scheme)], best first: which pulse it is
y = rp.analysis.modulation.cpm.modulate(bits, "soqpsk_tg", sps=8) # the reference transmitter (tests, regeneration)
A CPM signal is exp(j theta(t)), theta(t) = 2 pi h sum_k alpha_k q(t - kT), with q the integral of the frequency pulse g (q(LT) = 1/2). Here h = 1/2 throughout (MSK, GMSK, SOQPSK), and the symbols alpha_k come from the bits: msk / gmsk alpha_k = 2 b_k - 1; g rectangular over 1 symbol (MSK) or Gaussian (BT 0.25 / 0.3 / 0.5, L 4 / 4 / 3) gmsk_diff GSM's differential precoding first: alpha_k = 1 - 2 (b_k xor b_{k-1}) (3GPP TS 45.004) soqpsk_mil ternary alpha_k = (-1)^(k+1) a_{k-1} (a_k - a_{k-2}) / 2, a = 2b - 1 (MIL-STD-188-181), g rectangular soqpsk_tg the same precoder; g the windowed spectral raised cosine of IRIG 106 (rho 0.7, B 1.25, T1 1.5, T2 0.5: 8 symbols long) SOQPSK's precoder gives the same symbols for the bits, their complement, and (with the other parity) the bits with every other one inverted: the signal can't tell these four apart, so SOQPSK bits come out up to that (a frame word settles it).
The detector is a Viterbi search with per-survivor processing (Raheli, Polydoros & Tzou 1995): a trellis state is the
last S bits; each survivor carries the older symbols of the pulse's tail, its settled phase, and its own second-order
carrier loop (the error is the angle of its branch correlation), so a carrier offset left by the coarse estimate, a
pulse longer than S symbols (SOQPSK-TG's 8) and the phase all need no states of their own. Branch metric: Re sum
r(t) conj(s(t)) over the symbol at ns samples a symbol. match is the best path's metric over sqrt(energy of r x
energy of s): 1 for a clean signal of exactly this scheme; a wrong pulse, rate or timing scores lower, which is how
identify tells the schemes apart.
Front end (what demodulate does before the detector):
lines for h = 1/2, x^2 has lines at 2 fc +- baud/2 (MSK's two tones squared; weaker under a Gaussian or TG pulse):
the strongest pair gives the symbol rate (their spacing) and the carrier (their middle, halved)
rate without the lines, rpps.analysis.modulation.fsk.analyze's (or baud given: then the pair is looked for baud apart)
carrier without the lines, the median instantaneous frequency
timing the detector run at every 1/ns of a symbol on a stretch; the best metric wins. On a
long record, stretches across it are timed too and a line through them corrects the symbol clock (ppm)
Limits: h = 1/2 binary CPM only; the coarse carrier must leave under about baud/50 for the loop (loop) to pull in;
the bits of a spectrally inverted signal come out inverted.
Classes:
| Name | Description |
|---|---|
CPM |
Result of |
Functions:
| Name | Description |
|---|---|
frequency_pulse |
The frequency pulse g of a scheme at sps samples a symbol, L*sps samples, sum(g)/sps = 1/2 (q(LT) = 1/2) |
phase_table |
Q (L, ns): 2 pi h q((j + n/ns) T) at sample n of a symbol for the symbol j symbols back (q from g at ns samples: |
alpha_table |
atab (2, 8) int8: alpha_k for (k's parity, b_k + 2 b_{k-1} + 4 b_{k-2}) |
alphas |
The CPM symbols of bits (the bits before the first are 0) |
modulate |
Complex baseband of bits at sps samples a symbol (unit amplitude, phase 0 at the start) |
mlse |
Bits of r: samples at ns a symbol, sample 0 at a symbol's start, carrier near 0. S: trellis state bits (default |
square_lines |
The x^2 line pair of an h = 1/2 CPM signal (see the module): (baud, cfo, ratio), ratio the weaker line over the |
front |
(baud, cfo, lines) of an h = 1/2 CPM signal: the x^2 pair, else fsk.analyze's rate and the median frequency |
demodulate |
Bits of a GMSK / SOQPSK signal x (complex baseband at Fs, a channel around it; see the module). baud: the symbol |
identify |
Which scheme fits x best: [(match, scheme)] best first, each timed on its own over n symbols |
CPM ¶
Result of demodulate: bits, scheme, baud (Hz, clock-corrected), cfo (Hz), tau (s: the first symbol's start),
match (0..1), lines (the weaker x^2 line over the spectrum's median; 0 when rate and carrier came from the
instantaneous frequency instead)
Source code in src/rpps/analysis/modulation/cpm.py
frequency_pulse ¶
The frequency pulse g of a scheme at sps samples a symbol, L*sps samples, sum(g)/sps = 1/2 (q(LT) = 1/2)
Source code in src/rpps/analysis/modulation/cpm.py
phase_table ¶
Q (L, ns): 2 pi h q((j + n/ns) T) at sample n of a symbol for the symbol j symbols back (q from g at ns samples: q at the sample's end)
Source code in src/rpps/analysis/modulation/cpm.py
alpha_table ¶
atab (2, 8) int8: alpha_k for (k's parity, b_k + 2 b_{k-1} + 4 b_{k-2})
Source code in src/rpps/analysis/modulation/cpm.py
alphas ¶
The CPM symbols of bits (the bits before the first are 0)
Source code in src/rpps/analysis/modulation/cpm.py
modulate ¶
Complex baseband of bits at sps samples a symbol (unit amplitude, phase 0 at the start)
Source code in src/rpps/analysis/modulation/cpm.py
mlse ¶
Bits of r: samples at ns a symbol, sample 0 at a symbol's start, carrier near 0. S: trellis state bits (default 3; at least 2, the SOQPSK precoder's memory). loop: (k1, k2) of each survivor's carrier loop, per symbol. Returns (bits, match)
Source code in src/rpps/analysis/modulation/cpm.py
square_lines ¶
The x^2 line pair of an h = 1/2 CPM signal (see the module): (baud, cfo, ratio), ratio the weaker line over the spectrum's median (power); None when there is no pair over min_ratio. baud given: the pair is looked for that far apart
Source code in src/rpps/analysis/modulation/cpm.py
front ¶
(baud, cfo, lines) of an h = 1/2 CPM signal: the x^2 pair, else fsk.analyze's rate and the median frequency
Source code in src/rpps/analysis/modulation/cpm.py
demodulate ¶
demodulate(x, Fs, scheme='gmsk_0.3', baud=None, ns=8, S=None, loop=(0.08, 0.002), train=1500, clock=True)
Bits of a GMSK / SOQPSK signal x (complex baseband at Fs, a channel around it; see the module). baud: the symbol rate when known. train: symbols the timing search runs on. clock: correct the symbol clock from stretches across a long record. Returns CPM
Source code in src/rpps/analysis/modulation/cpm.py
identify ¶
Which scheme fits x best: [(match, scheme)] best first, each timed on its own over n symbols
Source code in src/rpps/analysis/modulation/cpm.py
cumulants ¶
Higher-order cumulants of symbols: which constellation, blind to Gaussian noise and to the carrier phase
r = rp.analysis.modulation.cumulants.classify(symbols) # symbol-spaced samples (timing recovered; carrier need not be)
print(r[0]) # e.g. "16QAM: distance 0.02, Es/N0 14.8 dB" (best first)
rp.analysis.modulation.cumulants.measure(symbols) # {"C40": .., "C42": .., "C63": .., "C80": ..} normalized
C_pq is the cumulant of order p with q of its factors conjugated: the moment M_pq = E[x^(p-q) conj(x)^q] less what the lower orders explain (the moment-cumulant formula over the set partitions of the p factors). Gaussian noise has none above order 2, so C40, C42, C63, C80 of signal plus noise are the signal's; only C21 (the power) has the noise in it. A carrier phase turns C_pq by (p - 2q) times it: C42 and C63 (as many conjugated as not) do not turn, the others are compared by magnitude. Normalized by the signal power to the p/2, each constellation has its own values (Swami & Sadler 2000): BPSK C42 -2, QPSK -1, 8PSK -1 with C40 0, 16QAM -0.68, 64QAM -0.62, OFDM and noise 0.
theory computes them for any point set, so every constellation rpps knows is a candidate. classify fits, for each, the
signal's share of the measured power (what the noise does not have) and compares; the share is an Es/N0.
Classes:
| Name | Description |
|---|---|
Match |
One candidate: name, distance (weighted, of the phase-free cumulants), share (the signal's part of the power that |
Functions:
| Name | Description |
|---|---|
cumulant |
C_pq from a moment table: sum over partitions of (-1)^(k-1) (k-1)! prod of the blocks' moments |
measure |
{name: C_pq / power^(p/2)}: power the signal's (default C21, which counts the noise too) |
theory |
The normalized cumulants of equiprobable points (unit power) |
candidates |
{name: points} of the constellations to compare with |
classify |
Candidates by how well the symbols' cumulants match theirs, best first. points: {name: points} (default |
Match ¶
One candidate: name, distance (weighted, of the phase-free cumulants), share (the signal's part of the power that fits best), esn0_db (from the share), values (measured, normalized by the signal power), expected (theory)
Source code in src/rpps/analysis/modulation/cumulants.py
cumulant ¶
C_pq from a moment table: sum over partitions of (-1)^(k-1) (k-1)! prod of the blocks' moments
Source code in src/rpps/analysis/modulation/cumulants.py
measure ¶
{name: C_pq / power^(p/2)}: power the signal's (default C21, which counts the noise too)
Source code in src/rpps/analysis/modulation/cumulants.py
theory ¶
The normalized cumulants of equiprobable points (unit power)
candidates ¶
classify ¶
Candidates by how well the symbols' cumulants match theirs, best first. points: {name: points} (default
candidates()). For each, the signal's share of the power is fitted (noise adds only to C21) unless esn0_db fixes it.
Families separate on their own (PSK orders, QAM, APSK, ASK, BPSK); orders within QAM or ASK do not without the SNR: a larger QAM at a higher SNR has the cumulants of a smaller one with more noise. Give esn0_db (rpps.sync.quality, or the residual of rpps.analysis.modulation.cancel) to tell them apart, or fit the constellation (rpps.sync.detect)
Source code in src/rpps/analysis/modulation/cumulants.py
fsk ¶
Frequency-shift keying and continuous-phase modulation from the instantaneous frequency: tones, rate, index, pulse
r = rp.analysis.modulation.fsk.analyze(x, Fs) # x at baseband (a channel), constant envelope
print(r) # e.g. "2-FSK: 9600.0 Bd, tones 4800.0 Hz apart (h 0.50: MSK), deviation
# +-2400.0 Hz, centre +312.0 Hz, Gaussian-like transitions (0.6 symbols)"
sym = rp.analysis.modulation.fsk.demodulate(x, Fs, r) # tone index per symbol, 0 = lowest
A constant-envelope signal carries its data in its frequency: the discriminator output f(t) = d/dt arg x / (2 pi) is a pulse-amplitude signal whose levels are the tones. So: rate the symbol rate is a line of f^2 / (df)^2 (rpps.analysis.spectrum.cyclic.lines: significant or not, with a P_fa) timing transitions (df)^2 pulse once a symbol at the symbol boundaries; the centres are half a symbol later tones f at the centres clusters at M equally spaced levels: M (2, 4, 8) is the largest whose clusters are well apart (spacing over 4 rms widths); spacing / rate is the modulation index h (0.5 MSK, 1 Sunde's FSK) pulse a frequency pulse longer than a symbol (Gaussian: GMSK, GFSK; raised cosine: partial-response CPM) pulls a symbol's frequency toward its neighbours'; rectangular pulses (CPFSK, MSK) do not
Classes:
| Name | Description |
|---|---|
FSK |
Result of |
Functions:
| Name | Description |
|---|---|
analyze |
FSK / CPM parameters of baseband samples x (see the module); lo/hi: symbol rates searched (Hz). A signal whose |
demodulate |
Tone index (0 = lowest) of every symbol, at the centres |
cpm_index |
The modulation index h of a full-response CPM (CPFSK, MSK, M-ary), from the phase lattice: between symbol |
FSK ¶
Result of analyze. M: tones (None: not FSK). baud (Hz), baud_line (cyclic.Line), spacing (Hz between adjacent
tones), h (spacing / baud), deviation (Hz, of the outer tones from the centre), centre (Hz: the carrier offset),
levels (Hz, the tones), separation (spacing over the clusters' rms width), isi (how far neighbours pull a symbol off its tone, in spacings:
~0 rectangular, 0.1 and more Gaussian / partial response),
tau (first symbol centre, samples), envelope (E|x|^4 / (E|x|^2)^2), why (when M is None)
Attributes:
| Name | Type | Description |
|---|---|---|
gaussian |
The frequency pulse is longer than a symbol (Gaussian, raised cosine): neighbours pull a symbol off its tone |
Source code in src/rpps/analysis/modulation/fsk.py
gaussian
property
¶
The frequency pulse is longer than a symbol (Gaussian, raised cosine): neighbours pull a symbol off its tone
analyze ¶
FSK / CPM parameters of baseband samples x (see the module); lo/hi: symbol rates searched (Hz). A signal whose
envelope (in its band) is not nearly constant is not analysed unless force
Source code in src/rpps/analysis/modulation/fsk.py
demodulate ¶
Tone index (0 = lowest) of every symbol, at the centres analyze found (r: its result; the same x, filtered the
same way: mask)
Source code in src/rpps/analysis/modulation/fsk.py
cpm_index ¶
The modulation index h of a full-response CPM (CPFSK, MSK, M-ary), from the phase lattice: between symbol
boundaries N apart the phase moves pi h (a sum of N odd levels), whose parity is N's, so exp(j dphi / h) is (-1)^N for
every pair at the right h, and averages away at a wrong one. A submultiple of h fits too: the largest h scoring near
the best is taken. tau: a symbol centre (samples, as analyze gives; default from the discriminator).
Returns (h, score 0..1). Partial-response CPM (L > 1, GMSK) leaves pulses straddling the boundaries: lower scores
Source code in src/rpps/analysis/modulation/fsk.py
impairments ¶
What else than noise is in locked symbols: amplifier compression (AM/AM, AM/PM), IQ imbalance, phase noise, neighbours
a = rp.analysis.modulation.impairments.amplifier(y, points) # per ring: gain (dB) and phase (deg) against the inner ring
q = rp.analysis.modulation.impairments.iq(y) # image rejection (dB), the imbalance, and y corrected
p = rp.analysis.modulation.impairments.phase_noise(y, points) # rms phase error against what the noise explains, and how slow
n = rp.analysis.modulation.impairments.neighbours(x, Fs) # other bands over the floor, and whether they touch this one
When Es/N0 and the SNR the floor allows disagree (rpps.analysis.modulation.cancel's excess, or a gap between SNR and Es/N0 over 1 dB) these say why: amplifier a saturating amplifier gives outer points less gain (AM/AM) and turns them (AM/PM): each ring's mean symbol against its point, relative to the innermost ring iq a receiver whose I and Q arms differ in gain or phase adds a little of the conjugate: y = mu s + nu s*. For a constellation symmetric under 90 degree turns (QPSK, QAM, APSK, 8PSK) E[s^2] = 0, so E[y^2] / E[|y|^2] = 2 mu nu / (|mu|^2 + |nu|^2): blind, no decisions needed; the image rejection is |mu/nu|^2 phase noise the phase of each symbol against its decision: white noise turns each symbol on its own (its part is half the variance of neighbours' differences), slow phase noise turns neighbours alike; the excess and its spectrum say whether it is slow (a loop too narrow, an oscillator's close-in noise) or fast neighbours every band over the floor (rpps.analysis.spectrum.cyclic.occupied's runs) besides the strongest, and whether the spectrum drops to the floor between them: one that does not overlaps the signal
Classes:
| Name | Description |
|---|---|
Amplifier |
Result of |
IQ |
Result of |
PhaseNoise |
Result of |
Neighbour |
A band over the floor besides the signal's: lo, hi (Hz), power (relative to the signal's), touching (the spectrum |
Functions:
| Name | Description |
|---|---|
amplifier |
AM/AM and AM/PM from locked symbols y and the constellation's points (rings: points within tol of a radius) |
iq |
IQ imbalance of symbols (or samples) of a constellation with E[s^2] = 0, blind (see the module) |
phase_noise |
The phase of each symbol against its decision, against what white noise at the measured Es/N0 gives |
neighbours |
Bands over the floor besides the strongest (the signal), from a Welch PSD: whether each reaches the floor between |
Amplifier ¶
Result of amplifier: rings (radius of each ring's points), gain_db and phase_deg (each ring's mean symbol against
its points, relative to the innermost ring), compression_db (the outermost ring's gain), am_pm (the outermost ring's
turn, degrees)
Source code in src/rpps/analysis/modulation/impairments.py
IQ ¶
Result of iq: ratio (nu/mu: the conjugate's part), irr_db (image rejection, |mu/nu|^2 in dB), gain_db (I arm over Q),
phase_deg (their angle off 90 degrees), dc (mean / rms), corrected (y with nu s* taken off and the DC)
Source code in src/rpps/analysis/modulation/impairments.py
PhaseNoise ¶
Result of phase_noise: rms_deg (of the phase error), white_deg (what the measured Es/N0 explains), excess_deg
(the rest, rms), slow (the share of the phase error's power below a tenth of the symbol rate: much over 0.1 is phase
noise slower than the symbols), spectrum (the phase error's, against frequency in symbol rates)
Source code in src/rpps/analysis/modulation/impairments.py
Neighbour ¶
A band over the floor besides the signal's: lo, hi (Hz), power (relative to the signal's), touching (the spectrum does not reach the floor between it and the signal)
Source code in src/rpps/analysis/modulation/impairments.py
amplifier ¶
AM/AM and AM/PM from locked symbols y and the constellation's points (rings: points within tol of a radius)
Source code in src/rpps/analysis/modulation/impairments.py
iq ¶
IQ imbalance of symbols (or samples) of a constellation with E[s^2] = 0, blind (see the module)
Source code in src/rpps/analysis/modulation/impairments.py
phase_noise ¶
The phase of each symbol against its decision, against what white noise at the measured Es/N0 gives
Source code in src/rpps/analysis/modulation/impairments.py
neighbours ¶
Bands over the floor besides the strongest (the signal), from a Welch PSD: whether each reaches the floor between
it and the signal (touching: a gap less than margin_db over the floor never opens)
Source code in src/rpps/analysis/modulation/impairments.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |
pm ¶
Phase modulation with a residual carrier (PCM/PM, telemetry and ranging): carrier, index, the data on the carrier, tones and subcarriers
p = rp.analysis.modulation.pm.analyze(x, Fs) # x at baseband (a channel)
print(p) # e.g. "PM, residual carrier at -1206.8 Hz with 45% of the power (index 0.84 rad); data on the
# carrier at 131072.0 Bd; subcarrier 72000.0 Hz (lines +-4800.0 Hz); tones 19000.0 Hz"
s = rp.analysis.modulation.pm.subcarrier(p.phase, Fs, 72000.0, 20e3) # the subcarrier at complex baseband: cyclic / detect it
y = rp.analysis.modulation.pm.nrz(p.phase, Fs, p.rate, p.tau) # soft symbols of the data on the carrier
A transmitter that phase modulates its carrier by less than 90 degrees leaves part of the power in the carrier
(cos^2 of the index, for data of +-index), so the receiver can lock to it with a narrow loop (CCSDS 401: PCM/PM/NRZ,
PCM/PM/biphase, PCM/PSK/PM on a subcarrier, ranging tones). Looking for a PSK it seems an unbalanced constellation with a
spectral line in x itself, near-constant envelope, rates no PSK fits. The phase around the carrier, phi(t), is a real
baseband signal holding everything else:
data on the carrier NRZ: phi^2 has a line at the rate (phi itself, none). biphase (Manchester): a line in phi at the rate
a subcarrier a band around f_sc in phi, and (BPSK on it, squared) a line of phi^2 at 2 f_sc: a rate search on
phi^2 or |x|^2 finds 2 f_sc and calls it the symbol rate. Sending idle (alternating) bits it is
two lines of phi at f_sc +- rate/2. subcarrier takes it to complex baseband for its own rate
tones single lines in phi (ranging, a subcarrier with nothing on it)
Classes:
| Name | Description |
|---|---|
PM |
Result of |
Functions:
| Name | Description |
|---|---|
carrier_phase |
(phi, z, ref): phi(t) the phase of x around a carrier at fc (Hz); z, x with fc taken off; ref, the carrier as the |
share_of |
The carrier's part of the power: the tracked carrier's power over all of it (a carrier that drifts or wanders over |
analyze |
Residual carrier, index, data rate on the carrier, tones and subcarriers of baseband samples x (see the module) |
subcarrier |
A subcarrier at fsc (Hz) of the phase phi at complex baseband, bw (Hz) wide: rpps.analysis.spectrum.cyclic / detect it |
nrz |
Soft symbols of NRZ data on the carrier: phi integrated over each bit (the matched filter of a rectangular pulse), |
biphase_symbols |
Soft symbols of biphase (Manchester) data on the carrier: the first half-bit's integral less the second's |
PM ¶
Result of analyze. carrier: offset (Hz) of the residual carrier, None if there is none; share: the carrier's part
of the power; index: the modulation index (rad) that leaves that share for +-index data, arccos(sqrt(share));
phase_rms (rad); rate: of the data on the carrier (Hz), None without a line; biphase: the rate's line is in phi itself;
tau: the first symbol boundary (samples) of the data on the carrier; tones: lines of phi that are no pair (Hz);
subcarriers: [(f_sc, half spacing of its line pair)]; phase: phi(t) (rad, a sample each input sample); lines: phi's
Source code in src/rpps/analysis/modulation/pm.py
carrier_phase ¶
(phi, z, ref): phi(t) the phase of x around a carrier at fc (Hz); z, x with fc taken off; ref, the carrier as the loop sees it, z smoothed over about 1/loop seconds (a narrow loop: it follows drift and phase noise slower than that, never the data)
Source code in src/rpps/analysis/modulation/pm.py
share_of ¶
The carrier's part of the power: the tracked carrier's power over all of it (a carrier that drifts or wanders over the capture keeps its share; |mean z|^2 would average it away)
Source code in src/rpps/analysis/modulation/pm.py
analyze ¶
Residual carrier, index, data rate on the carrier, tones and subcarriers of baseband samples x (see the module)
Source code in src/rpps/analysis/modulation/pm.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | |
subcarrier ¶
A subcarrier at fsc (Hz) of the phase phi at complex baseband, bw (Hz) wide: rpps.analysis.spectrum.cyclic / detect it
Source code in src/rpps/analysis/modulation/pm.py
nrz ¶
Soft symbols of NRZ data on the carrier: phi integrated over each bit (the matched filter of a rectangular pulse), from the boundary tau (samples)
Source code in src/rpps/analysis/modulation/pm.py
biphase_symbols ¶
Soft symbols of biphase (Manchester) data on the carrier: the first half-bit's integral less the second's
Source code in src/rpps/analysis/modulation/pm.py
quality ¶
Whether hard decisions from locked symbols can be trusted for blind tests (gate); the Es/N0 it uses is
rpps.sync.quality.measure
Classes:
| Name | Description |
|---|---|
Gate |
Result of |
Functions:
| Name | Description |
|---|---|
gate |
Check locked symbols before their hard decisions go into a blind test (see Gate). A frame turned by a phase |
Gate ¶
Result of gate: whether hard decisions from these symbols can be trusted for blind tests (rank, LFSR, code
search), and why not. rotation: the symbols' mean angle off their decisions (degrees); drift: the largest change of
that over the blocks (degrees); near: fraction of decisions within margin minimum distances of a boundary, and
near_expected: the same for Gaussian noise at the measured Es/N0 (more than twice that: something other than noise
moves the symbols toward the boundaries); ser: expected symbol error rate at the measured Es/N0; quality: measure's;
displaced: the largest distance of a cluster's mean from its point, in minimum distances (compression, AM/PM, IQ
imbalance or the wrong constellation: a few hundredths is noise). ok: rotation and drift under max_turn of the
half-angle between points, near under twice expected, displaced under a quarter
Source code in src/rpps/analysis/modulation/quality.py
gate ¶
Check locked symbols before their hard decisions go into a blind test (see Gate). A frame turned by a phase reference error, a carrier that slips through a block, a gain or constellation mismatch: each shows as a rotation, a drift, or decisions crowding the boundaries, which noise at the measured Es/N0 does not explain
Source code in src/rpps/analysis/modulation/quality.py
rpps.analysis.sequence ¶
What was XOR'd in or spread with (see rpps.analysis)
Modules:
| Name | Description |
|---|---|
recurrence |
Every linear recurrence up to a degree, scored at once: the taps of a scrambler (feedthrough or additive), a |
scrambler |
Blind scrambler search: self-synchronising (feedthrough) scramblers, and additive ones (and bare LFSR sequences: PRBS) |
spread |
Direct-sequence spread spectrum below the noise: the code period, the chip rate, the code, and the data under it |
recurrence ¶
Every linear recurrence up to a degree, scored at once: the taps of a scrambler (feedthrough or additive), a differential code, or a short code's checks, from hard bits
found = rp.analysis.sequence.recurrence.search(bits, max_degree=20)
print(found[0]) # e.g. "1 + x^3 + x^20 (taps 20, 3): holds 87.5% (z 412.0), weight 3: data bias 0.75 per bit if
# additive, 0.75 if feedthrough"
A polynomial f(D) = 1 + f_1 D + ... + f_L D^L is a check on bits s when f(D) s = 0 holds more often than chance. Both scramblers make one: feedthrough (self-synchronising, multiplicative): s = d / f(D), so f(D) s = d: the check holds as often as a data bit is its common value (idle fill, flags, headers: data bias b, the same for every multiple of f) additive (synchronous, an LFSR with f its feedback polynomial): s = d + k with f(D) k = 0, so f(D) s = f(D) d: the data bits at the taps, holding with bias b^w (w the taps, weight of f), weaker the more taps A differential code (1 + D) or a short code's parity check is one too. Counting the stream's (L+1)-bit windows by value and taking the Walsh-Hadamard transform of the counts gives every polynomial of degree up to L at once: how many windows it holds on less how many it fails (the same transform as rpps.analysis.code.conv.tcm; Ding et al. 2022/2023 test the primitive polynomials one by one with the same statistic). Checks that are multiples of a smaller one found are dropped, as are those without a constant term (shifts).
Below the stream's own structure (no bias in the data: compressed, encrypted, or coded) nothing holds: then the checks
of a code under a feedthrough scrambler are f(D) h(D), and gcd of several gives f (Han, Zhang et al., IEEE 2018).
Classes:
| Name | Description |
|---|---|
Recurrence |
A check found: taps (delays, descending, without 0), poly (int: bit j = the coefficient of D^j), degree, weight |
Keystream |
Result of |
Functions:
| Name | Description |
|---|---|
bit_windows |
Counts of the (L+1)-bit windows of bits, as an index whose bit j is the bit at delay j (bit 0 the newest) |
soft_z |
The soft statistic of a check over signed reliabilities t = tanh(LLR/2) (s's +-1 expected values): sum over |
search |
Checks f(D) s = 0 with a constant term, of degree up to max_degree (memory: 2^(max_degree+1) counts), significant at |
keystream |
An additive scrambler's keystream from the scrambled stream, its polynomial known ( |
lfsr |
A linear recurrence of any degree up to window/2 that the bits keep (an LFSR scrambler over constant or periodic |
Recurrence ¶
A check found: taps (delays, descending, without 0), poly (int: bit j = the coefficient of D^j), degree, weight (taps + 1), holds (fraction of windows it holds on), z (its bias over chance), bias (2 holds - 1, signed)
Methods:
| Name | Description |
|---|---|
data_bias |
The data's bias per bit this check implies: |bias| for a feedthrough scrambler, |bias|^(1/weight) additive |
Source code in src/rpps/analysis/sequence/recurrence.py
data_bias ¶
The data's bias per bit this check implies: |bias| for a feedthrough scrambler, |bias|^(1/weight) additive
Keystream ¶
Result of keystream: bits (the LFSR sequence, regenerated over the whole stream), agree (the share of the
decoded bits it matches), data (the stream with it taken off), checks (share of the checks holding after decoding)
Source code in src/rpps/analysis/sequence/recurrence.py
bit_windows ¶
Counts of the (L+1)-bit windows of bits, as an index whose bit j is the bit at delay j (bit 0 the newest)
Source code in src/rpps/analysis/sequence/recurrence.py
soft_z ¶
The soft statistic of a check over signed reliabilities t = tanh(LLR/2) (s's +-1 expected values): sum over positions of the product over its taps, over its own standard deviation (a check that holds makes it large)
Source code in src/rpps/analysis/sequence/recurrence.py
search ¶
Checks f(D) s = 0 with a constant term, of degree up to max_degree (memory: 2^(max_degree+1) counts), significant at pfa over all of them, multiples of a stronger smaller one dropped: Recurrences, smallest degree first among the strongest.
llr: soft values of the bits (log P(0)/P(1); bits may then be None): the hard transform shortlists the shortlist
strongest candidates, significant or not, and each is scored by the product of its own taps' tanh(LLR/2) (2-4 dB more
than hard decisions: a check over 3 taps no longer pays for errors in the 18 other bits of a window)
Source code in src/rpps/analysis/sequence/recurrence.py
keystream ¶
An additive scrambler's keystream from the scrambled stream, its polynomial known (search finds it) and the data
under it biased (idle fill, mostly-constant fields): the fast correlation attack (Meier & Staffelbach 1989). Every bit
is the keystream seen through a binary channel whose crossover is the data's minority share; the keystream obeys
f(D) and its squares f(D^2^i), sparse checks at every position; min-sum over them decodes it, and the whole sequence is
regenerated from the most reliable window of degree decoded bits. data_bias: 2 P(data = common value) - 1 (default
from how often f holds: (2 holds - 1)^(1 / weight)). The data's common value is taken as 0 (flip the result if not).
On 20000 bits it is exact down to data 60/40 for DVB's 1 + x^14 + x^15 and 70/30 for a five-term polynomial (more
taps, weaker checks)
Source code in src/rpps/analysis/sequence/recurrence.py
lfsr ¶
A linear recurrence of any degree up to window/2 that the bits keep (an LFSR scrambler over constant or periodic
data: a scrambler of degree d applied twice over an idle word is degree 2d + the word's period, beyond search's transform): Berlekamp-Massey
on windows windows, the connection polynomial most of them agree on, and how often it holds over the whole stream.
Returns (poly int, degree, holds) or None when no polynomial shorter than window/2 repeats
Source code in src/rpps/analysis/sequence/recurrence.py
scrambler ¶
Blind scrambler search: self-synchronising (feedthrough) scramblers, and additive ones (and bare LFSR sequences: PRBS)
A feedthrough scrambler sends y[n] = d[n] ^ y[n-a] ^ y[n-b] ^ ...: descrambling is d[n] = y[n] ^ y[n-a] ^ y[n-b] ^ ..., with no seed to find (the register fills from the received bits). Descrambling white bits with a wrong polynomial gives white bits; the right one gives the data back, which almost always has structure: idle ones or zeros, HDLC flags, fixed headers, frames. So every polynomial up to a degree is tried and the one whose output is furthest from white wins.
"White" here means looking random: about half ones, no byte pattern more common than another, no autocorrelation. Bits that come out all ones (an idle line) or full of one pattern are the opposite, and the strongest evidence there is.
A multiple of the right polynomial also leaves structure (it is the right one followed by another descrambler, which keeps a constant constant), so among the polynomials that stand out the one of lowest degree, then fewest taps, is taken. Output that stays white under every polynomial was not scrambled this way, or what is under it is itself random (compressed or encrypted data, or another layer such as an additive scrambler or a code).
An additive (synchronous) scrambler sends y[n] = d[n] ^ s[n], s an LFSR sequence. Wherever the data is constant for a
while (idle fill, padding, a fixed header) y is the LFSR sequence itself, or its complement, and a stretch of it has
linear complexity L (its register length) where random bits have half their length (additive_search, by
Berlekamp-Massey over sliding windows). A bare PRBS (a test pattern: ITU-T O.150/O.151) is the same everywhere.
Functions:
| Name | Description |
|---|---|
structure |
How far bits are from white, as z-scores: {"bias", "bytes", "autocorr", "score" (the largest)} |
polynomials |
Tap sets to try: every 1..max_taps taps up to max_degree (1 + x^a is differential decoding / NRZI at a=1) |
search |
Find the feedthrough scrambler on hard bits. Returns (hypotheses best first, trials, Guess or None) |
explain |
Factor an LFSR recurrence into known scramblers and what is left: (scramblers [(taps, name, times)], the period |
lfsr_name |
A known name for these taps (or their reciprocal), else the polynomial written out |
recurrence_holds |
Per bit n >= max(taps): whether s[n] = XOR s[n-t] holds (1) there |
additive_search |
Find an LFSR sequence in hard bits: a bare PRBS, or an additive scrambler showing through constant data. Returns |
descramblers |
Self-synchronising descramblers {name: taps}: out[t] = in[t] ^ in[t-k] for each tap |
cached_scrambler |
A scrambler definition's JSON (its "poly": the taps), read once |
structure ¶
How far bits are from white, as z-scores: {"bias", "bytes", "autocorr", "score" (the largest)}
bias: ones vs zeros. bytes: chi-square of the byte values (the most uneven of the 8 bit alignments). autocorr: the
strongest autocorrelation up to lags (frames, repeated headers; 0 when lags is 0)
Source code in src/rpps/analysis/sequence/scrambler.py
polynomials ¶
Tap sets to try: every 1..max_taps taps up to max_degree (1 + x^a is differential decoding / NRZI at a=1)
Source code in src/rpps/analysis/sequence/scrambler.py
search ¶
Find the feedthrough scrambler on hard bits. Returns (hypotheses best first, trials, Guess or None)
Every polynomial (and none) is scored on bias and byte statistics; the top best get the autocorrelation too. A
polynomial stands out when its score is far above what the others typically get (robust z over all of them) and the
structure is itself significant, both against the threshold for that many trials times the lags each score is the
largest of. The Guess is the feedthrough definition of the
lowest-degree one that stands out (see the module docstring), never decoded unless saved and loaded.
Source code in src/rpps/analysis/sequence/scrambler.py
explain ¶
Factor an LFSR recurrence into known scramblers and what is left: (scramblers [(taps, name, times)], the period the data under them repeats with (the least P whose x^P + 1 the rest divides; None if none up to max_period), rest)
A feedthrough scrambler over data that repeats every P bits gives a sequence whose minimal polynomial is the scrambler's times a divisor of x^P + 1 (the data's own recurrence); two scramblers in cascade multiply.
Source code in src/rpps/analysis/sequence/scrambler.py
lfsr_name ¶
A known name for these taps (or their reciprocal), else the polynomial written out
Source code in src/rpps/analysis/sequence/scrambler.py
recurrence_holds ¶
Per bit n >= max(taps): whether s[n] = XOR s[n-t] holds (1) there
Source code in src/rpps/analysis/sequence/scrambler.py
additive_search ¶
Find an LFSR sequence in hard bits: a bare PRBS, or an additive scrambler showing through constant data. Returns (hypotheses best first, windows tried, Guess or None)
Every step bits a window of window bits is put through Berlekamp-Massey; one whose linear complexity is at most
max_len (random bits: window/2, within a few) is a stretch of some LFSR's output. The polynomial most windows agree
on is the scrambler's; how much of the stream its recurrence predicts tells a PRBS (all of it) from a scrambler over
data (the constant stretches) and gives where those stretches are (a frame period, when they repeat).
Source code in src/rpps/analysis/sequence/scrambler.py
descramblers ¶
Self-synchronising descramblers {name: taps}: out[t] = in[t] ^ in[t-k] for each tap
cached_scrambler
cached
¶
A scrambler definition's JSON (its "poly": the taps), read once
spread ¶
Direct-sequence spread spectrum below the noise: the code period, the chip rate, the code, and the data under it
p = rp.analysis.sequence.spread.period(x, Fs) # code period (s), from autocorrelation fluctuations
f = rp.analysis.spectrum.cyclic.features(x, Fs) # the chip rate is the |x|^2 line (f.baud)
c = rp.analysis.sequence.spread.code(x, Fs, chip_rate, p.chips) # the code's chips (up to sign and a cyclic shift)
y = rp.analysis.sequence.spread.despread(c.chips_rx, c.code) # the data symbols, the code's gain back
A DSSS signal spreads each data symbol over a code of N chips: under the noise, its spectrum shows nothing. Its autocorrelation over a window R(tau) = sum x(t) x*(t + tau) has, at lags of a whole code period, a part from the code repeating, signed by the data: averaged it cancels, but its square does not. So the variance of R_w(tau) over many short windows w (Burel's fluctuation method, the deterministic part taken off: a pulse's own correlation and its ringing are the same in every window) peaks at multiples of the period, while noise alone gives it flat.
With the chip rate (rpps.analysis.spectrum.cyclic: chips are symbols to it) the signal is taken at one sample a chip; cut into windows of the period, the windows are +-code (a symbol each) plus noise when they start at a symbol boundary: their covariance's leading eigenvector is the code (Bouder & Burel). Detection goes further under the noise than recovery: the period's fluctuation peak gains with the record, the chip rate needs the |x|^2 line (searched for in a narrow window once the period is known, still a few dB short: a 127-chip code over 600k samples is detected at -13 dB, recovered at -11). Not aligned, it splits into two eigenvectors, each the code over part of the window and zero elsewhere: the leading one's support gives the misalignment, and windows from there give the code.
Classes:
| Name | Description |
|---|---|
Period |
Result of |
Code |
Result of |
Functions:
| Name | Description |
|---|---|
fluctuations |
Variance over windows of R_w(tau), tau = 0 .. max_lag (R_w the autocorrelation of window w): E|R_w|^2 - |E R_w|^2. |
period |
The code period of a DSSS signal from autocorrelation fluctuations (see the module). max_period: longest tried |
code |
The spreading code ( |
despread |
Symbols: each period of chip samples correlated with the code (the processing gain back; rpps.symbol.despread.correlate) |
chip_rate |
The chip rate given the code period (lag, samples, maybe a sample off): |x|^2 of a code repeating every period has |
Period ¶
Result of period: lag (samples), fine (the lag between samples, from the peak's shape), seconds, chips (when
chip_rate is given), contrast (the peak over the
fluctuations' median at other lags: noise alone stays near 1 + a few sigma), significant
Source code in src/rpps/analysis/sequence/spread.py
Code ¶
Result of code: code (+-1 chips, one period), offset (chips: where a symbol starts in the chip stream),
chips_rx (the chip-rate samples, from offset), gain (leading eigenvalue over the next: how clear)
Source code in src/rpps/analysis/sequence/spread.py
fluctuations ¶
Variance over windows of R_w(tau), tau = 0 .. max_lag (R_w the autocorrelation of window w): E|R_w|^2 - |E R_w|^2. A spread code's part is signed by the data, so its mean is 0 and it is all variance; a signal's own correlation (the pulse, its ringing) is the same in every window: all mean, taken off
Source code in src/rpps/analysis/sequence/spread.py
period ¶
The code period of a DSSS signal from autocorrelation fluctuations (see the module). max_period: longest tried (samples, default len/64). window: samples a window (default 2 max_period: the code's part adds a symbol at a time, so short windows, more of them, are what helps). min_lag: shortest (default 4 Fs / the occupied bandwidth: the pulse's own correlation). The peak's contrast over the other lags is about 1 + T SNR^2 (T the period in samples, SNR per sample): a long code is found further under the noise. Significance: (contrast - 1) sqrt(windows) over z_min
Source code in src/rpps/analysis/sequence/spread.py
code ¶
The spreading code (chips long) of a DSSS signal at chip_rate (see the module). The carrier must be off to
well under the symbol rate (chip_rate / chips) or the windows turn: take cyclic.features' cfo off first
Source code in src/rpps/analysis/sequence/spread.py
despread ¶
Symbols: each period of chip samples correlated with the code (the processing gain back; rpps.symbol.despread.correlate)
Source code in src/rpps/analysis/sequence/spread.py
chip_rate ¶
The chip rate given the code period (lag, samples, maybe a sample off): |x|^2 of a code repeating every period has
lines at multiples of 1/period; the chip rate is the strongest significant one (the pulse's line) near such a
multiple, at most Fs / min_sps; without one (far under the noise), from the width of the fluctuation peak (fluct,
Period.fluct, and fine, Period.fine, for the narrow search): a chip. Returns (chip rate Hz, chips a period, the period refined: chips / chip rate, s)
Source code in src/rpps/analysis/sequence/spread.py
rpps.analysis.signal_profile ¶
A signal's profile: every step it takes to process it, as far as analysis can tell, and what it might be where it can't
profiles = rp.analysis.profile(rp.source.File("ci16t", "capture.cs16", Fs=100e6)) # every signal the survey finds
profiles = rp.analysis.profile(src, signals=[0, 3]) # or some of them
for p in profiles:
print(p) # numbered steps; an unsolved one ends the list with its top candidates
p.solved, p.to_dict(), p.rx() # whether every step is known, a JSON-able form, the receiver (when solved)
Each signal goes through the chain once: its channel (every signal's from one rp.signal.FFTBank: one FFT of the
capture a hop for all of them), Acquire (rate, modulation, offset), the
matrix matched filter and feed-forward carrier, then AcquireFEC (the code, its bit map and alignment, with the blind tools
when blind). When no code is found, shipped profiles that find their own frames (a preamble and a header: DVB-S2) are run
on the timed symbols, and named by what their own checks verify (rank: a step whose CRC or header code passes;
the most general profile when nothing past a shared header tells them apart). A step is "found" (a definition covers it), "guess" (a blind find: a definition once saved, see
rpps.analysis.result.Guess) or "unsolved", which ends the profile with what it might be: hypotheses and their weight, a
softmax over their z-scores (a clear leader near 100%, close calls shared).
rpps.analysis.spectrum ¶
What is in a capture and at what rate (see rpps.analysis)
Modules:
| Name | Description |
|---|---|
burst |
Moved to rpps.analysis.burst. |
cyclic |
Cyclostationary features: the symbol rate and carrier lines a signal has, and how sure each one is |
find |
Signals in a capture: centre, width, SNR and when they are on, with a false-alarm rate you set |
hopping |
Frequency hopping: the hops, their dwell, the hop set and its spacing, and the signal de-hopped |
levels |
The finder's steps 4-6 (rpps.analysis.spectrum.find): a line raised from the floor; a signal comes up and holds |
ofdm_pilots |
OFDM pilot patterns, blind: which cells of the time-frequency grid carry known values, and the lattice they form |
pencil |
Spectral lines from short records: the matrix pencil (Hua & Sarkar 1990) |
psd |
|
scf |
Spectral coherence over all cycle frequencies (FFT accumulation), the significant ones, and blind FRESH filtering |
separate |
Two signals of equal power on one channel, separated: each one's carrier and timing, then both symbol streams |
signal |
|
waveform |
What kind of waveform a signal is, when it isn't a single linearly modulated carrier: tones, OFDM, bursts |
burst ¶
Moved to rpps.analysis.burst. demodulate (stable API) stays here for one release with a DeprecationWarning
Functions:
| Name | Description |
|---|---|
demodulate |
rpps.analysis.burst.demodulate, under its old name: it goes in the next release |
demodulate ¶
rpps.analysis.burst.demodulate, under its old name: it goes in the next release
Source code in src/rpps/analysis/spectrum/burst.py
cyclic ¶
Cyclostationary features: the symbol rate and carrier lines a signal has, and how sure each one is
f = rp.analysis.spectrum.cyclic.features(x, Fs) # x at baseband, a few times wider than the signal
print(f) # e.g. "baud 1.000 MHz (line 31 dB over the floor, P_fa 1e-12); carrier
# lines x^4 at +12.3 kHz: QPSK / QAM / APSK"
f.baud, f.order, f.cfo # None where no line is significant: "no rate" is an answer
A linearly modulated signal is cyclostationary: its statistics repeat every symbol. Put through a nonlinearity, it gives
spectral lines a stationary signal (noise, OFDM without its prefix, a carrier with a continuous phase) does not:
|x|^2 a line at the symbol rate (stronger the larger the roll-off: the line lives in the band edges)
x^M a line at M times the carrier offset when the constellation repeats every 360/M degrees (x^2 for BPSK / ASK,
x^4 for QPSK and QAM, x^8 for 8PSK, x^12 for 4+12 / 4+12+16 APSK), with side lines at that +- the symbol
rate. Between symbols the pulses overlap and spoil high powers, so once the rate is known the powers are also
taken of matched-filtered samples at the symbol instants (symbol_instants), far more sensitive at small
roll-off and for x^8 / x^12; noise raised to the 12th power needs Es/N0 near 15 dB or more
x a line at the carrier itself if any of it is left (a pilot tone, AM, an unbalanced constellation)
|d|^2 d = the instantaneous frequency (x[n] conj(x[n-1])): a line at the symbol rate for a constant-envelope signal
(FSK, MSK, CPM) whose |x|^2 is flat
Each line is tested against the spectrum around it. Without a line, the power of a periodogram bin is exponential about its
local mean, so a bin r times over the floor happens with probability exp(-r); over K bins searched, the chance noise
alone gives one that high is P_fa = 1 - (1 - exp(-r))^K; the floor is itself estimated from about m bins, which makes the
tail (1 + r/m)^-m instead. A line is significant when P_fa is under pfa. The floor is the
local median over ln 2 (robust to the lines themselves).
The band the signal occupies is estimated first (Welch PSD over its floor) and everything else is filtered off (a Wiener mask), so the noise outside the signal does not dilute the lines.
scf is the spectral correlation function (FFT accumulation method) for a picture of all cyclic frequencies at once.
Classes:
| Name | Description |
|---|---|
Line |
A spectral line of a nonlinearity of the signal. kind: one of KINDS. freq: where it is (Hz; for x^M, M times the |
Features |
Result of |
Functions:
| Name | Description |
|---|---|
lines |
Significant spectral lines of the sequence |
spectrum_floor |
The noise floor of a power spectrum: its q-th percentile, the bins more than |
occupied |
(Wiener mask over FFT bins of x's length, occupied bandwidth Hz, (lowest, highest) frequency over the floor Hz): the |
comb_rate |
The symbol rate behind a set of significant lines (cyclic.Line) of a nonlinearity of the signal: every line is a |
symbol_instants |
Matched-filtered samples at the symbol instants: an RRC at the baud (roll-off |
features |
Symbol rate and carrier lines of baseband samples x (see the module). lo/hi: the symbol rates searched, Hz |
scf |
Spectral correlation function by the FFT accumulation method (Roberts, Brown & Loomis 1991). |
alpha_profile |
Max over frequency of |SCF| against cyclic frequency alpha (alpha = 0 removed): (alpha Hz, profile). The symbol rate |
Line ¶
A spectral line of a nonlinearity of the signal. kind: one of KINDS. freq: where it is (Hz; for x^M, M times the carrier offset). strength: its power over the local floor (linear). pfa: chance noise gives one that strong in the band searched. significant: pfa under the threshold asked for
Source code in src/rpps/analysis/spectrum/cyclic.py
Features ¶
Result of features.
baud: the symbol rate (Hz) from the strongest significant |x|^2 line, else from |d|^2 (constant envelope), else None. baud_line: that Line. baud_from: "|x|^2" or "|d|^2". order: the smallest M whose x^M spectrum has a significant line (1, 2, 4, 8), None without one. cfo: carrier offset (Hz) from that line (ambiguous by Fs/M). carrier: {M: Line} of every significant x^M line. confirmed: the x^M line has side lines at +- baud (the rate and carrier belong to one signal). envelope: E|x|^4 / (E|x|^2)^2 (1 constant envelope, 1.3-1.8 filtered PSK/QAM, 2 Gaussian). bandwidth: of the occupied band (Hz). lines: every line tested.
Attributes:
| Name | Type | Description |
|---|---|---|
linear |
A symbol rate seen in |x|^2: a linearly modulated carrier (PSK, QAM, APSK, ASK) |
Source code in src/rpps/analysis/spectrum/cyclic.py
linear
property
¶
A symbol rate seen in |x|^2: a linearly modulated carrier (PSK, QAM, APSK, ASK)
lines ¶
Significant spectral lines of the sequence z (sampled at Fs) between lo and hi Hz (negative frequencies allowed for
a complex z): up to top Lines, strongest first, each at least exclude Hz from a stronger one (default 4 bins)
Source code in src/rpps/analysis/spectrum/cyclic.py
spectrum_floor ¶
The noise floor of a power spectrum: its q-th percentile, the bins more than stop_db under the median left out
(a channelizer's stopband, zeros: not noise, and far under it)
Source code in src/rpps/analysis/spectrum/cyclic.py
occupied ¶
(Wiener mask over FFT bins of x's length, occupied bandwidth Hz, (lowest, highest) frequency over the floor Hz): the signal's band estimated from a Welch PSD over its floor (the quietest tenth of the spectrum)
Source code in src/rpps/analysis/spectrum/cyclic.py
comb_rate ¶
The symbol rate behind a set of significant lines (cyclic.Line) of a nonlinearity of the signal: every line is a
harmonic k R, or one folded about the sample rate, Fs - k R. The rate is the largest R whose harmonics explain
explaining the most of the lines' strength (dB over the floor, summed), within (1 - explain)/3 of the best: a
submultiple of R explains them as well but is smaller, a multiple leaves R's own line unexplained. Returns (R, the strongest line on R's comb)
Source code in src/rpps/analysis/spectrum/cyclic.py
symbol_instants ¶
Matched-filtered samples at the symbol instants: an RRC at the baud (roll-off beta, a guess: a mismatch only
leaves a little ISI), timing from the phase of the |y|^2 line (its cyclic component peaks at the instants).
Returns (symbols, first instant in samples)
Source code in src/rpps/analysis/spectrum/cyclic.py
features ¶
features(x, Fs, lo=None, hi=None, pfa=0.001, orders=(1, 2, 4, 8, 12), mask=True, max_samples=2 ** 22)
Symbol rate and carrier lines of baseband samples x (see the module). lo/hi: the symbol rates searched, Hz (default Fs/64 .. Fs/1.5). pfa: false-alarm probability of a line. mask: filter to the occupied band first
Silence (zeros, too few samples) has no lines, whatever np.seterr the caller set; samples that are not finite (NaN, inf) are a ValueError that says so
Source code in src/rpps/analysis/spectrum/cyclic.py
scf ¶
Spectral correlation function by the FFT accumulation method (Roberts, Brown & Loomis 1991).
Returns (f, alpha, S): S[i, j] = |S_x^alpha(f)| at f[i], alpha[j] (Hz), on the grid of channel pairs. nfft: channels (frequency resolution Fs/nfft). frames: how many windows of hop samples are used (alpha resolution Fs/(frames hop))
Source code in src/rpps/analysis/spectrum/cyclic.py
alpha_profile ¶
Max over frequency of |SCF| against cyclic frequency alpha (alpha = 0 removed): (alpha Hz, profile). The symbol rate and its multiples stand out for a linear modulation
Source code in src/rpps/analysis/spectrum/cyclic.py
find ¶
Signals in a capture: centre, width, SNR and when they are on, with a false-alarm rate you set
sv = rp.analysis.spectrum.find.find(x, Fs, cf=cf) # a Survey of Signal (the same types as find_signals)
for s in sv: s.lo, s.hi, s.snr, s.t0, s.t1, s.bursts
How it works, each step a known detector:
- One spectrogram: Hann frames, |FFT|^2 (P[t, f]; every later step reads only this).
- The noise floor as a function of frequency (the receiver's passband: tilt, ripple, roll-off), so the spectrum can be whitened: Z = P / floor. The band is cut into blocks, each the mean of its noise bins (FCME: bins clearly in signals are cut out and the floor fitted again), a block with too little noise left interpolated from its neighbours. The floor shows between carriers side by side in their notches: a block whose notches (its least 4-bin means) sit well under its fit is held to them. The first guess is a line through the blocks' low percentiles, fitted again without the blocks over it (a plateau even half the band wide stays out); the receiver's roll-off at the edges is left out.
- Detection at a false-alarm rate: under noise the mean of k bins over m frames of Z is Gamma distributed with known
degrees of freedom (the window's correlation between bins and between overlapping frames counted), so a threshold for
pfacomes from its quantile (Wilson-Hilferty). Widths k = 1, 2, 4... bins are each tested, on means over k bins at a stride of k/2 (a GLRT over an unknown width: a weak wide signal is found at a coarse scale, a narrow one at a fine one), on the mean over all frames and on the most of each group of frames (bursts, which the average dilutes; a max-hold of single frames loses weak steady signals). The test count is split over scales and groups (Bonferroni) and the floor's own error, measured on the noise bins, widens each threshold. A high threshold seeds a detection and a low one grows it (hysteresis, LAD's double threshold); what a width finds is excised before the next (CLEAN). - When it is on: each span's band power frame by frame, gated by the same two thresholds (bursts timed on frames 32 bins of the span wide); a bursty span is measured on the frames it is on.
- The signals, read by level (rpps.analysis.spectrum.levels): in each region the detector marked, a line is raised
from the floor a step of a few noise deviations at a time. What comes up and holds its sides from one step to the
next is a signal; one that comes up out of a wider one stands on it (
over; the widerholdsit: a pedestal, or a carrier under a narrower signal); a hump's sides never hold. Two carriers side by side come up as one run and part at the notch: the run is only them. Lines (a few bins wide: tones, spurs) are taken out first: no signal. - Each signal's edges: where it falls
drop_dbunder its top, or halfway to where it came up (the floor, a notch, a pedestal) when that is less; it passes the detector at its own width and has an SNR of 3 dB or more (what can't be processed is no signal). A Finder keeps each region's reading while it holds (measured again each step).
Effort (rp.set_effort): fast skips frame overlap and tests bursts only in groups of 8 frames; balanced and max overlap frames by half and test groups of 2 and 8. Every level tests widths up to a quarter of the band: capped lower, a wide weak signal or a hump is found as fragments, each passing on its own.
Classes:
| Name | Description |
|---|---|
FloorFit |
The noise floor fitted to a spectrogram (find's step 2): floor per bin (power per Hz), the usable bins a..b (past |
Finder |
Signals in a stream, block by block (a live display): find over the last |
Functions:
| Name | Description |
|---|---|
spectrogram |
P[t, f] (fftshifted, power per Hz) and the hop |
find |
Signals in a capture (see the module): a Survey of Signal sorted by frequency, each with t0/t1 (when it is on, |
fit_floor |
find's step 2 on a spectrogram P[t, f]: the FloorFit |
FloorFit ¶
The noise floor fitted to a spectrogram (find's step 2): floor per bin (power per Hz), the usable bins a..b (past the receiver's roll-off), the floor's own error sys (natural log) and busy: the bins clearly signal (left out of the fit, before it was widened)
Source code in src/rpps/analysis/spectrum/find.py
Finder ¶
Signals in a stream, block by block (a live display): find over the last frames frames, the floor refitted every
refit frames [4 x frames: the receiver's passband changes slowly], ids kept from block to block (Survey.match)
f = Finder(Fs, nfft=4096, cf=cf, frames=frames_in_a_second)
for blk in source(65536):
sv = f.step(blk.data) # a Survey (None before a first frame); times [s] from the stream's start
For a display, hold about a second of frames: what is shown then changes little from step to step, and a box follows a change within about that. A step costs the FFTs of its new frames, a detection on the mean (a running sum) and on each new group of frames (one complete is detected once), and the boxes: each region keeps its reading while its span and level hold, its boxes measured again, and is read again when they move or once a window (rpps.analysis.spectrum.levels.boxes; track=False: every step). Bursts are timed by the frames (find times them finer). Frames are cut at fixed places in the stream and the floor refitted at fixed frame counts, so without tracking what it holds after a stretch of samples doesn't depend on how the stretch came in blocks. overlap: of the frames [the effort level's when made]; the rest (pfa, edge, drop_db, ...) as find's.
hold [s]: how long a signal not found again stays in the Survey, marked stale (Signal.stale, as last seen; Signal.seen when it was last found): -1 for good [the default: a display keeps what it has seen], 0 not at all. A stale signal found again has its id back (Survey.match)
Methods:
| Name | Description |
|---|---|
reset |
Forget the stream: the next step starts a new one |
step |
Take a block of samples; the Survey of the frames now held (None while there are fewer than 2) |
Source code in src/rpps/analysis/spectrum/find.py
reset ¶
Forget the stream: the next step starts a new one
Source code in src/rpps/analysis/spectrum/find.py
step ¶
Take a block of samples; the Survey of the frames now held (None while there are fewer than 2)
Source code in src/rpps/analysis/spectrum/find.py
spectrogram ¶
P[t, f] (fftshifted, power per Hz) and the hop
Source code in src/rpps/analysis/spectrum/find.py
find ¶
find(x, Fs: float = 1.0, cf=0.0, nfft=None, pfa=0.001, edge=0.005, drop_db=10.0, min_bins=1, min_across=8, blocks=64, sys_db=None)
Signals in a capture (see the module): a Survey of Signal sorted by frequency, each with t0/t1 (when it is on, [s from the start]), bursts ([(t0, t1)], None when continuous or too weak a frame to tell; one with bursts is a Burst), score (dB over the threshold that found it) and over (the box it stands on, or None)
pfa: expected false boxes in a capture of pure noise (spread over every width and group tested) nfft: FFT size [N/16, 64 to 65536] edge: fraction of the band at each end not looked at [0.5%: the receiver's roll-off is found from the spectrum, and carriers can run to within 1% of the band's edge] drop_db: a carrier's edges are this far under its top [dB] (or halfway to the floor or valley beside it) min_bins: narrowest signal; min_across: bins across under which its edges aren't trusted (Signal.resolved False) blocks: blocks the floor is fitted in (at least 8 bins each); sys_db: the floor's own error [measured] For a stream (a display), Finder: the same, block by block.
Source code in src/rpps/analysis/spectrum/find.py
fit_floor ¶
find's step 2 on a spectrogram P[t, f]: the FloorFit
Source code in src/rpps/analysis/spectrum/find.py
hopping ¶
Frequency hopping: the hops, their dwell, the hop set and its spacing, and the signal de-hopped
h = rp.analysis.spectrum.hopping.track(x, Fs) # Hops: dwells (start, end, frequency), dwell time, channels, spacing
y = rp.analysis.spectrum.hopping.dehop(x, Fs, h) # every dwell mixed to 0 Hz and joined: one channel's signal to analyse
A hopper is a narrow signal that jumps: over the capture the spectrum looks wide and flat, at any instant it is one narrow peak. A short-time spectrum (frames much shorter than a dwell, bins much narrower than the hop set) has, frame by frame, its strongest bin over the frame's floor where the signal is; a run of frames at one frequency (within a channel spacing) is a dwell. The dwell time is the median of whole dwells (the first and last are cut by the capture); the hop set is the frequencies the dwells visit, clustered; the spacing is the greatest common step between them (the median of the smallest differences, then refined over all of them).
Classes:
| Name | Description |
|---|---|
Hops |
Result of |
Functions:
| Name | Description |
|---|---|
track |
Dwells of a frequency-hopping signal (see the module). nfft: frame length (shorter than a dwell, bins narrower than |
dehop |
The signal with every dwell mixed to 0 Hz, the dwells joined in order (a |
Hops ¶
Result of track: dwells (Dwell: start, end s, freq Hz), dwell (s, median of whole dwells), rate (hops/s),
channels (Hz, the hop set's frequencies), spacing (Hz), active (share of frames with a signal), hopping (more than
one channel visited, dwells shorter than a quarter of the capture, the signal at an instant under half as wide as over
the capture)
Source code in src/rpps/analysis/spectrum/hopping.py
track ¶
Dwells of a frequency-hopping signal (see the module). nfft: frame length (shorter than a dwell, bins narrower than the channel spacing), hop: frame step (default nfft/2). snr_db: a frame's peak over its median bin to count. merge: frequency (Hz) within which consecutive frames are one dwell (default 2 bins). width: bins each side of a frame's peak its frequency is the power centroid of (default nfft/32)
Source code in src/rpps/analysis/spectrum/hopping.py
dehop ¶
The signal with every dwell mixed to 0 Hz, the dwells joined in order (a guard share of each dwell's ends
dropped: the synthesizer settling); between dwells nothing. Returns complex samples at Fs
Source code in src/rpps/analysis/spectrum/hopping.py
levels ¶
The finder's steps 4-6 (rpps.analysis.spectrum.find): a line raised from the floor; a signal comes up and holds its sides
In a region the detector marked, a line is raised from the floor a step at a time (STEP_K noise deviations, at least STEP_DB), and at each the runs over it are found. A run whose sides hold from one step to the next (to HOLD of its width) is one thing going on up; a run that comes up out of a wider one, or out of the floor, is a new thing standing on it. A thing is what held its sides for a step or more (a hump's move in at every step: it is none) and is not only what comes up out of it (FILL of it or more: two carriers side by side come up as one run and part at the notch; a carrier's top comes up out of it); what stands on a pedestal leaves most of it. Its top is the middle of its own points over where its sides last held (not those of what stands on it), its sides where it stands halfway up from where it came up (or drop_db under its top). Lines (LINE_BINS wide or less) are taken out first (a median over twice that): no signal. A box passes the detector at its width and has an SNR of MIN_SNR or more.
In a Finder each region's reading is kept from step to step: one whose span and level hold keeps its things, measured again, and is read again when they move or once a window (see boxes).
Functions:
| Name | Description |
|---|---|
boxes |
find's steps 4-6 by levels: the Signals of context c (see find._find_frames), the detector's marks occ. |
boxes ¶
find's steps 4-6 by levels: the Signals of context c (see find._find_frames), the detector's marks occ. state: a Finder's: each region's reading kept from step to step; one whose span and level hold (find._same) keeps its things, measured again (find._remeasure), and is read again when they move or a window (state["refresh"] frames) on, the regions' turns spread over it
Source code in src/rpps/analysis/spectrum/levels.py
ofdm_pilots ¶
OFDM pilot patterns, blind: which cells of the time-frequency grid carry known values, and the lattice they form
o = rp.analysis.spectrum.waveform.ofdm(x, Fs) # (or waveform.classify(x, Fs).ofdm): Tu, CP, comb
p = rp.analysis.spectrum.ofdm_pilots.discover(x, Fs, o) # or tu=, tcp= when known
print(p) # e.g. "OFDM 1024 x 1/4 CP, 601 used subcarriers: pattern every 4 symbols; scattered pilots every 12th
# subcarrier, moving 3 a symbol; 45 continual pilots; pilots 2.5 dB over data"
p.mask # (period, K) bool: pilot cells by symbol in the period and subcarrier; p.empty: cells never used
g = rp.analysis.spectrum.ofdm_pilots.grid(x, Fs, tu, tcp) # the grid itself: g.Y (symbols, K), g.on, g.k
The grid: x is resampled so that Tu is a power-of-2 FFT; each symbol's start is the peak of its cyclic-prefix correlation, searched a little either side of where the last one said (so a longer first CP in a slot, LTE's, is followed); the fractional carrier offset is the correlation's phase; the FFT window starts a quarter of the CP early. Subcarriers from the first to the last within floor_db of the signal's plateau are kept; symbols far under the strongest are off (TDD, bursts).
Pilots are cells whose value is known, so a pilot cell is the same (or follows a sequence that repeats) from one
period of the pattern to the next, and data cells are not: Y[t, k] Y[t + L, k] summed over t keeps its phase at a pilot
cell and averages away at a data cell. The lag L that repeats the most power (each subcarrier's autocorrelation along
time, by FFT, the magnitudes summed over subcarriers) is the pattern's period (the smallest lag within share of the
strongest: DVB-T's scattered pilots 4 symbols, a sequence that changes every symbol and repeats each frame its frame,
LTE's cell reference signal 140). At that lag every cell's coherence |sum Y Y| / sum |Y|^2 over its symbols in the
period is near 1 for a pilot and about 1/sqrt(n) for data: over max(coherence, 5/sqrt(n)) is a pilot. Then:
scattered rows (symbols in the period) whose pilots are equally spaced: the spacing, and the offset's step a symbol
continual subcarriers that are pilots in nearly every symbol
empty cells with almost no power in every period (guard bands, DC, the gaps of a comb)
boost pilot over data power
Rows (symbols in the period) are decided as a whole: a lattice of subcarriers (spacing D, offset o) whose coherence
stands over the row's (a t-statistic less what the best of D offsets reaches by chance, holding across the band, not in
one block: a broadcast channel repeating its content is no lattice), strong alone or weaker with the spacing most rows
have; or the whole symbol known (its median coherence high: a preamble, a sync or sounding symbol); single cells only
where enough periods make one cell's coherence telling (irregular continual pilots).
Limits: a long period needs many periods: an 84 ms record of LTE TDD (7 frames of 140 symbols) gives its known symbols
and most of its reference-signal rows (spacing 6, offsets alternating by 3), not all. The pattern is read relative to
the first kept subcarrier (an integer carrier offset shifts it); a common
phase that wanders over the lag (phase noise, a symbol clock off by ppm over a long lag) weakens the coherence (the
per-symbol common phase is taken out against the previous period first).
Classes:
| Name | Description |
|---|---|
Grid |
|
Pilots |
|
Functions:
| Name | Description |
|---|---|
grid |
The OFDM time-frequency grid of baseband x at Fs (see the module): Grid. tu, tcp: useful symbol and CP (s) |
discover |
The pilot pattern of an OFDM signal x (see the module). o: rpps.analysis.spectrum.waveform.ofdm's result (tu and tcp are |
Grid ¶
grid: Y (symbols, K) complex cells (kept subcarriers only), k (K,) their FFT bins (0 = the carrier, signed),
starts (symbols,) each symbol's start (samples at fs), on (symbols,) bool, N (FFT size), ncp (CP samples at fs),
fs (the resampled rate), cfo (Hz: the fractional offset taken out), rho (symbols,) each CP correlation
Source code in src/rpps/analysis/spectrum/ofdm_pilots.py
Pilots ¶
discover: period (symbols), mask (period, K) pilot cells, empty (period, K) unused cells, coherence (period,
K), scattered [(row, offset, spacing, count)], step (offset change a symbol of the scattered lattice, None), spacing
(its subcarrier spacing), continual (kept-subcarrier indices), boost_db, lags [(lag, score)] strongest first,
grid (Grid), lattices {row: (spacing, offset, t)}: each row's pilot lattice (spacing 1: the whole symbol known)
Source code in src/rpps/analysis/spectrum/ofdm_pilots.py
grid ¶
The OFDM time-frequency grid of baseband x at Fs (see the module): Grid. tu, tcp: useful symbol and CP (s)
Source code in src/rpps/analysis/spectrum/ofdm_pilots.py
discover ¶
discover(x, Fs, o=None, tu=None, tcp=None, max_lag=None, share=0.6, row_coherence=0.6, min_t=7.0, weak_t=3.5, max_spacing=24, max_symbols=4000)
The pilot pattern of an OFDM signal x (see the module). o: rpps.analysis.spectrum.waveform.ofdm's result (tu and tcp are taken from it; a pilot comb's symbol is comb x its lag, with the CP of the system it names), else tu and tcp (s). max_lag: longest pattern period searched (symbols; default a quarter of the symbols, at most 320)
Source code in src/rpps/analysis/spectrum/ofdm_pilots.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | |
pencil ¶
Spectral lines from short records: the matrix pencil (Hua & Sarkar 1990)
lines = rp.analysis.spectrum.pencil.lines(x, Fs) # [(freq Hz, amplitude, damping /s), ...] strongest first
An FFT resolves lines 1/T apart (T the record) and smears each over its window. A sum of K exponentials
x[n] = sum a_k z_k^n has a Hankel matrix of rank K, the Vandermonde structure of the z_k; the matrix pencil takes the z_k
from it directly (eigenvalues of Y1^+ Y0, Y0 and Y1 the matrix without its last and first columns, through the K principal
singular vectors), so two lines a fraction of 1/T apart are told apart and each frequency is found to far finer than a bin:
FSK tones in a short burst, a pilot beside a carrier, cyclic lines of a short capture. K comes from the singular values
(those over floor of the largest), or is given.
Functions:
| Name | Description |
|---|---|
lines |
Exponentials in x: [(frequency Hz, amplitude (complex), damping 1/s (0 for a steady line))], strongest first. |
lines ¶
Exponentials in x: [(frequency Hz, amplitude (complex), damping 1/s (0 for a steady line))], strongest first.
K: how many (default: the singular values over floor of the largest). L: the pencil parameter (default n/3)
Source code in src/rpps/analysis/spectrum/pencil.py
psd ¶
scf ¶
Spectral coherence over all cycle frequencies (FFT accumulation), the significant ones, and blind FRESH filtering
table = rp.analysis.spectrum.scf.cycle_frequencies(x, Fs) # [(alpha Hz, coherence, conjugate), ...] significant
f, a, c = rp.analysis.spectrum.scf.coherence(x, Fs) # every (f, alpha) point
y, w = rp.analysis.spectrum.scf.fresh(x, Fs, ref, shifts=(-125e3, 0, 125e3), train=slice(0, len(ref)))
rpps.analysis.spectrum.cyclic tests chosen nonlinearities (|x|^2, x^M) for lines; that sees the strongest signal's rate and carrier. The spectral correlation function S_x^a(f) = E[X(f + a/2) X*(f - a/2)] at every cycle frequency a shows every cyclostationary signal in the band at once, each by its own pattern of cycle frequencies (rates, carriers, and their sums): the way to see signals that share a band. One computes it over all (f, a); here by the FFT accumulation method (Roberts, Brown & Loomis 1991), every pair of channels' product transformed over time, as rpps.analysis.spectrum.cyclic.scf. Normalized by the two channels' power, the spectral coherence is near 0 for noise and up to 1 for a feature, whatever the power: thresholded, it is a blind table of cycle frequencies (the CSP Blog's "spectral coherence and blind estimation of significant cycle frequencies"). Conjugate: E[X(f + a/2) X(a/2 - f)], the cycle frequencies of x^2: twice a carrier, and that plus and minus the rate, for BPSK / OQPSK / MSK-like signals.
fresh: a frequency-shift filter (Gardner 1993) sums filtered copies of x shifted by multiples of a signal's cycle frequencies, the spectral redundancy of a band-limited cyclostationary signal; an interferer overlapping it in frequency but with other cycle frequencies does not share that redundancy and can be taken out, which no filter of x alone can do. The weights are trained by least squares on a stretch where the wanted signal is known: a preamble, or the signal rpps.analysis.modulation.cancel regenerates from decisions (decision-directed). (Blind weights, by self-coherence restoral (Agee, Schell & Gardner 1990), need reference branches that are not shifts of the same copies: with one sensor that is not done here.)
Functions:
| Name | Description |
|---|---|
coherence |
Spectral coherence by the FFT accumulation method (as rpps.analysis.spectrum.cyclic.scf): (f Hz, alpha Hz, |coherence|) over |
cycle_frequencies |
Significant cycle frequencies: [(alpha Hz, coherence, conjugate)] best first, non-conjugate a > 0 only (it is |
fresh |
A frequency-shift filter for the signal |
coherence ¶
Spectral coherence by the FFT accumulation method (as rpps.analysis.spectrum.cyclic.scf): (f Hz, alpha Hz, |coherence|) over the points each channel pair is responsible for. |C| = |S^a(f)| / sqrt(S(f + a/2) S(f - a/2)), each channel's own power the denominator, so 0 <= |C| <= 1. conjugate: X(f + a/2) X(a/2 - f), the cycle frequencies of x^2. Silence (zero power) has coherence 0; samples that are not finite are a ValueError
Source code in src/rpps/analysis/spectrum/scf.py
cycle_frequencies ¶
Significant cycle frequencies: [(alpha Hz, coherence, conjugate)] best first, non-conjugate a > 0 only (it is symmetric) and a = 0 left out. The threshold is where noise alone would exceed it with probability pfa over all the points (coherence of noise: Rayleigh, its scale from the median of all points). merge: Hz within which points are one cycle frequency (default Fs/nfft)
Source code in src/rpps/analysis/spectrum/scf.py
fresh ¶
A frequency-shift filter for the signal reference is a stretch of (a known preamble, training, or what
rpps.analysis.modulation.cancel regenerates from decisions): the least-squares weights over x's copies shifted by shifts (Hz;
multiples of the wanted signal's cycle frequencies, e.g. -Rs, 0, Rs) and, for signals with conjugate features, conj(x)
shifted by conj_shifts. train: the samples (a slice or index array) the reference covers (default all). Returns
(the filtered signal over all of x, the weights). With shifts (0,) it is an ordinary Wiener filter; the shifted copies
are what let it take out an interferer overlapping the signal (Gardner 1993)
Source code in src/rpps/analysis/spectrum/scf.py
separate ¶
Two signals of equal power on one channel, separated: each one's carrier and timing, then both symbol streams
p = rp.analysis.spectrum.separate.estimate(x, Fs, baud, "qpsk") # two Params: carrier (Hz), timing (s), complex gain
r = rp.analysis.spectrum.separate.separate(x, Fs, baud, "qpsk") # (or params=p) r.symbols[0], r.symbols[1], r.evm
A paired carrier (two transmitters sharing a frequency, "carrier in carrier") at equal power is beyond cancellation: each is the other's interference at 0 dB, so neither can be demodulated first. What still tells them apart is their own carrier offset, timing and phase:
carriers x^M of an M-PSK signal has a line at M f_i, each signal its own (the cross terms of the two fall elsewhere):
the two strongest lines near the middle of the x^M spectrum are M f_1 and M f_2
timing the M-th power of a shaped PSK signal also pulses once a symbol: lines at M f_i +- baud, whose phase over the
centre line's is -2 pi baud tau_i (each signal's own, read at its own lines); the half-symbol ambiguity of a
symmetric pulse is settled by which of tau and tau + T/2 gives the more PSK-like matched-filter output
gains each signal's phase (mod 2 pi / M) from its centre line (a^M times a positive sum), its amplitude half the
matched filter's power, then both refitted from decisions, slowly
varying (a running mean over smooth symbols, which takes up a carrier estimate a little off)
Then both streams are matched-filtered on their own grids, z_i[k], and what each picks up of the other is
c_ij(k, m) = A_j RC((m T + tau_j) - (k T + tau_i)) exp(j 2 pi (f_j - f_i) t_km) (the raised-cosine overlap of the
pulses, turned by the carrier difference). Detection is a sequence estimate over both streams at once (the
"paired carrier" receiver): the symbols of both, merged in time order, each output z[n] mostly the sum of its own
symbol and its two neighbours of the other signal, so a Viterbi search over states (u[n-1], u[n]) (M^2 of them) scores
every output exactly; the further neighbours (RC tails) are taken out with the previous pass's decisions, and the
gains refitted, iterations times.
Limits: equal or comparable rates, both of the same PSK. estimate needs the two carriers resolved in the x^M
spectrum: apart by more than about 4 / (M x the record's length) (measured: 20 Hz apart from 0.16 s of QPSK is
separated without a symbol error at 15 dB, 5 Hz is not). Closer carriers need params from elsewhere (a known
offset, a longer record); the detector then works on timing and phase differences alone, but a stretch where the two
coincide in timing and phase as well is genuinely ambiguous. Signal 0 is the lower carrier.
Classes:
| Name | Description |
|---|---|
Params |
One signal's: cfo (Hz), tau (s: a symbol centre), gain (complex), line (its x^M line over the spectrum's median) |
Separation |
|
Functions:
| Name | Description |
|---|---|
estimate |
Both signals' parameters (see the module): [Params, Params], the lower carrier first. search: the largest |
separate |
Both symbol streams of two overlapping signals (see the module): Separation |
Params ¶
Separation ¶
separate: symbols [s0, s1] (decided, on each one's grid), soft [s0, s1] (corrected matched-filter outputs with
the other signal taken out), params [Params, Params], evm [e0, e1], iterations
Source code in src/rpps/analysis/spectrum/separate.py
estimate ¶
Both signals' parameters (see the module): [Params, Params], the lower carrier first. search: the largest carrier offset (Hz) looked at (default baud/4)
Source code in src/rpps/analysis/spectrum/separate.py
separate ¶
Both symbol streams of two overlapping signals (see the module): Separation
Source code in src/rpps/analysis/spectrum/separate.py
signal ¶
Classes:
| Name | Description |
|---|---|
Signal |
A signal found in a spectrum |
Burst |
A Signal on part of the time |
Survey |
The signals found in a capture (a list of Signal, by frequency), and the spectrum they came from |
Functions:
| Name | Description |
|---|---|
welch |
Averaged periodogram (Hann window), fftshifted. Returns (power per bin, number of averages) |
noise_floor |
Robust noise floor [dB]: median, then median of what is within |
measure_band |
A band given by hand (a channel plan, a band a user typed) measured as find_signals measures what it finds: a |
find_signals |
The signals in a capture: rpps.analysis.spectrum.find.find (how it works is there), as a Survey of Signal sorted |
survey |
Look at a source (rp.source.File, Device) or an array, and find the signals in it |
reject_spur_bauds |
Drop baud estimates that are really a line in the capture, not the signal's symbol rate |
Signal ¶
Signal(mid, width, bottom, height, snr=None, *, lo=None, hi=None, power=None, peak_freq=None, duty=None, resolved=True, Fs=None, cf=0.0, bin_hz=None, clipped=False)
A signal found in a spectrum
mid: centre [Hz, from the capture's centre], freq: centre [Hz] absolute (cf + mid)
width: occupied bandwidth [Hz] (the span holding occupied of its power), lo/hi: its edges [Hz from the capture's centre]
bottom: noise floor [dB] (global), height: peak above the floor [dB], snr: in-band power over noise power in that band [dB]
power: total in-band power [dB], peak_freq: strongest bin [Hz from the capture's centre]
carrier, cn0: its power without the band's noise [dBFS], C/N0 [dB-Hz]
duty: fraction of the time it is on (1: continuous, less: bursty)
resolved: there were enough bins across it to trust the edges. False means read more samples
clipped: it runs into the edge of the capture's band, so its width and centre are only what is inside
baud_est / baud_strength: symbol rate from the |x|^2 line of the channelized signal (None: no clear line)
holds: how many other signals stand on it (a transponder's pedestal, or a carrier with a narrower signal on it: which
one, the spectrum can't tell; its own symbol-rate line can). over: the one it stands on, when it stands on one
t0/t1, bursts: when it is on
score: dB over the threshold that found it
id: its number, kept from survey to survey by Survey.match
stale, seen: a Finder's: not found in the last block, kept (its hold) as last seen; when it was last found [s]
Fs, cf, bin_hz: the capture's rates and the spectrum's resolution
A signal on only part of the time is a Burst.
Methods:
| Name | Description |
|---|---|
channel |
The filters that bring this signal to baseband at about |
esn0_db |
Es/N0 [dB] from the in-band SNR: the noise in the signal's width (snr) is that density times width, the |
estimate_baud |
Fill baud_est from samples of the capture (this signal is channelized first) |
Attributes:
| Name | Type | Description |
|---|---|---|
carrier |
The carrier's power [dB of the samples' |x|^2: dBFS where |x| = 1 is full scale]: |
|
cn0 |
C/N0 [dB-Hz]: the carrier over the noise density, snr over the band's width (None without snr) |
Source code in src/rpps/analysis/spectrum/signal.py
carrier
property
¶
The carrier's power [dB of the samples' |x|^2: dBFS where |x| = 1 is full scale]: power less the noise in
its band (None without snr)
cn0
property
¶
C/N0 [dB-Hz]: the carrier over the noise density, snr over the band's width (None without snr)
channel ¶
The filters that bring this signal to baseband at about oversample times its width
Shift + multi-stage decimation (rp.signal.channelize), then a sharp filter at the low rate to drop the neighbours
the decimation lets through: passband to guard*width/2 (the pulse skirts reach past the 99% width).
Returns Channel(front, Fs, decimation, delay, settle): block + channel.front.
Source code in src/rpps/analysis/spectrum/signal.py
esn0_db ¶
Es/N0 [dB] from the in-band SNR: the noise in the signal's width (snr) is that density times width, the
symbol energy is the power over the symbol rate, so Es/N0 = snr + 10log10(width/baud). baud defaults to
baud_est. The spectrum can't tell signal from noise inside the band, so this is the guide, the measured one
(rp.sync.quality.measure on the locked symbols) the answer
Source code in src/rpps/analysis/spectrum/signal.py
estimate_baud ¶
Fill baud_est from samples of the capture (this signal is channelized first)
Source code in src/rpps/analysis/spectrum/signal.py
Burst ¶
Burst(mid, width, bottom, height, snr=None, *, lo=None, hi=None, power=None, peak_freq=None, duty=None, resolved=True, Fs=None, cf=0.0, bin_hz=None, clipped=False)
Bases: Signal
A Signal on part of the time
bursts: [(t0, t1)] in seconds, in what was looked at, duty (the fraction on), last (the latest burst), period (the median start to start [s], None under 3 bursts)
Methods:
| Name | Description |
|---|---|
of |
sig as a Burst (the same object, its class changed) |
Source code in src/rpps/analysis/spectrum/signal.py
Survey ¶
Bases: list
The signals found in a capture (a list of Signal, by frequency), and the spectrum they came from
Fs, cf: the capture's rates. nfft, K, bin_hz: the spectrum's size, averages and resolution freq, db: the spectrum [Hz from the centre, dB], floor: its noise floor [dB] head: the samples the survey looked at (a Device can't rewind: feed these first)
Methods:
| Name | Description |
|---|---|
pick |
One signal. near: closest to this offset from the capture's centre [Hz], freq: closest to this absolute |
match |
Carry signal ids over from the survey before this one of the same band (frame to frame): ids are a signal's |
plot |
Draw the spectrum with every signal shaded and numbered. Returns the axes |
choose |
Show the survey and wait for a click (or a number key) on the signal to process. Returns the Signal |
Source code in src/rpps/analysis/spectrum/signal.py
pick ¶
One signal. near: closest to this offset from the capture's centre [Hz], freq: closest to this absolute frequency [Hz], index: by position, strongest: highest in-band SNR, not total power, which a wide pedestal under the carriers would win (also the default for one argument less)
Source code in src/rpps/analysis/spectrum/signal.py
match ¶
Carry signal ids over from the survey before this one of the same band (frame to frame): ids are a signal's own, stable however others come and go.
A signal is the earlier one whose centre is within near of its width and whose width is within ratio of its own
(the closest such); each earlier signal is matched once. One that went missing (not found for a survey or a few:
too weak for a moment) is remembered for hold surveys and gets its id back when it returns. A new signal gets an
id never used before in the chain of surveys, so a signal appearing never renumbers the others. Sets Signal.id in
place (and lost, next_id for the next match) and returns self
Source code in src/rpps/analysis/spectrum/signal.py
plot ¶
Draw the spectrum with every signal shaded and numbered. Returns the axes
choose ¶
Show the survey and wait for a click (or a number key) on the signal to process. Returns the Signal
Without an interactive backend (CI, a script run headless) it can't ask: the strongest signal is taken and said so.
Source code in src/rpps/analysis/spectrum/signal.py
welch ¶
Averaged periodogram (Hann window), fftshifted. Returns (power per bin, number of averages)
Source code in src/rpps/analysis/spectrum/signal.py
noise_floor ¶
Robust noise floor [dB]: median, then median of what is within margin dB above it (signals drop out)
start: where to begin instead of the median. A band mostly full of signal has a median inside the signals; starting from a low level makes the floor the quiet part, wherever the signals are
Source code in src/rpps/analysis/spectrum/signal.py
measure_band ¶
A band given by hand (a channel plan, a band a user typed) measured as find_signals measures what it finds: a Signal with power, SNR, height, peak and duty filled in, so typed and found signals compare alike
freq: the band's centre [Hz, absolute: cf + offset], bw: its width [Hz], cf: the capture's centre frequency. The noise is the capture's floor (find's, per bin); the band is cut to the capture's edges (clipped).
Source code in src/rpps/analysis/spectrum/signal.py
find_signals ¶
find_signals(samps, Fs: float = 1, nfft=None, cf=0.0, pfa=0.001, edge=0.005, drop_db=10.0, min_bins=1, min_across=8, nested=True, **retired)
The signals in a capture: rpps.analysis.spectrum.find.find (how it works is there), as a Survey of Signal sorted by frequency, ids 0, 1... in that order
pfa: expected false boxes in a capture of pure noise; nfft: FFT size [N/16, up to 65536]; cf: the capture's centre
frequency [Hz], for Signal.freq; edge: fraction of the band at each end not looked at (the receiver's roll-off is
also found); drop_db: a carrier's edges are this far under its level (or halfway to what is beside it); min_bins: narrowest signal; min_across: bins across under which its
edges aren't trusted (Signal.resolved); nested: keep the boxes that hold other signals (a pedestal, a carrier a
narrower one jams: Signal.holds). False: only what stands on them
The thresholds of the rules this replaced (min_snr_db, gap, occupied, min_band_snr_db, edges, edge_db, split_db) are taken
for one release with a DeprecationWarning, and do nothing: pfa sets what the detection lets through.
Source code in src/rpps/analysis/spectrum/signal.py
survey ¶
Look at a source (rp.source.File, Device) or an array, and find the signals in it
how many samples to read. More means a finer spectrum, so close neighbours stay apart and the edges
are right, whatever block size the receive chain will use later
more: if some signal is too narrow for its bins, read up to this many (once) and look again baud: also estimate each signal's symbol rate (Signal.baud_est) The rest (pfa, drop_db, ...) is for find_signals. Returns a Survey; Survey.head is what was read.
Source code in src/rpps/analysis/spectrum/signal.py
reject_spur_bauds ¶
Drop baud estimates that are really a line in the capture, not the signal's symbol rate
A symbol rate above the signal's width can't be (width is at least the symbol rate). A rate found again and again on signals of different widths is a spur of the capture (a clock coupling into every signal's |x|^2); it, and its half multiples, are dropped from every signal of this capture. Signals sharing a rate and width are carriers of one service and keep it.
Source code in src/rpps/analysis/spectrum/signal.py
waveform ¶
What kind of waveform a signal is, when it isn't a single linearly modulated carrier: tones, OFDM, bursts
w = rp.analysis.spectrum.waveform.classify(x, Fs) # x: the signal at baseband (rp.signal.baseband / Signal.channel)
print(w) # e.g. "OFDM 15 kHz subcarriers ... LTE / NR 15 kHz, normal CP; bursts ..."
Each test is cheap and says why it holds
tones: nearly all the power in a few lines narrower than a few Hz (a beacon, a pilot, an unmodulated carrier; two
tones beat, and the beat looks like a symbol rate to the cyclostationary search)
ofdm: the cyclic prefix repeats the end of each symbol, so the signal correlates with itself at the useful symbol length
Tu (1/subcarrier spacing), about Tcp/(Tu+Tcp) of its power; x(t)x*(t+Tu) then pulses once a symbol, at 1/(Tu+Tcp).
Many subcarriers add up to a Gaussian (E|x|^4/E|x|^2^2 near 2), which tells OFDM from a single carrier whose frame
repeats (a preamble and pilots correlate at the frame length too). (Tu, Tcp) names the system: SYSTEMS
bursts: the power switches on and off; the period of the switching (a TDD frame, a TDMA slot)
envelope: E|x|^4/E|x|^2^2: 1 for a constant envelope (FM, FSK, CPM, a carrier), 1.3-1.7 for filtered PSK, 2 for noise
or OFDM
Classes:
| Name | Description |
|---|---|
Tones |
|
OFDM |
|
Bursts |
|
Waveform |
|
Functions:
| Name | Description |
|---|---|
envelope |
E|x|^4/E|x|^2^2: 1 constant envelope, about 1.3-1.7 filtered PSK, 2 Gaussian (noise, OFDM, many carriers) |
autocorr |
|sum x(n+L) x*(n)| / sum |x|^2 for every lag L >= 0 (by FFT) |
tones |
Lines holding |
ofdm |
OFDM in baseband samples x at Fs: OFDM, or None (no lag stands out, no symbol period, or not Gaussian) |
on_samples |
The samples of x inside its bursts (a boolean mask): those every window of the smoothed power over them is on, |
on_off |
Whether the power switches on and off: Bursts, or None (steady, or too weak to tell). smooth: the power is averaged |
classify |
Tones, OFDM, bursts and the envelope of baseband samples x at Fs (see the module): a Waveform |
Tones ¶
OFDM ¶
ofdm: tu, tcp (s), strength (the correlation at Tu: about tcp/(tu+tcp) at a high SNR), ratio (over other lags),
line (the symbol-rate line over its floor), envelope, systems [(name, misfit)] that fit, best first. comb: when the
lag found repeats (correlating at 2x and 3x it too), it isn't the symbol but a pilot comb's period inside symbols:
every comb-th subcarrier used, so the symbol is comb x tu (systems then fit that); None for plain OFDM
Source code in src/rpps/analysis/spectrum/waveform.py
Bursts ¶
Waveform ¶
classify: tones, ofdm, bursts (each None when not), envelope (E|x|^4/E|x|^2^2)
Attributes:
| Name | Type | Description |
|---|---|---|
kind |
"tones", "ofdm", "constant envelope", or None (nothing here says what it is) |
Source code in src/rpps/analysis/spectrum/waveform.py
envelope ¶
E|x|^4/E|x|^2^2: 1 constant envelope, about 1.3-1.7 filtered PSK, 2 Gaussian (noise, OFDM, many carriers)
autocorr ¶
|sum x(n+L) x*(n)| / sum |x|^2 for every lag L >= 0 (by FFT)
tones ¶
Lines holding share of the power, at most max_lines of them, each within width_bins bins: Tones, or None.
The resolution is Fs/len(x): a long stretch tells a carrier from a narrow modulated signal
Source code in src/rpps/analysis/spectrum/waveform.py
ofdm ¶
ofdm(x, Fs, tu_min=2e-06, tu_max=0.005, min_ratio=8.0, min_envelope=1.8, max_samples=2 ** 21, max_rate_line=8.0)
OFDM in baseband samples x at Fs: OFDM, or None (no lag stands out, no symbol period, or not Gaussian)
tu_min/tu_max: useful symbol lengths searched. min_ratio: the correlation at Tu over the median of the other lags. max_rate_line: a |x|^2 line this far over its floor (rpps.sync.find_baud) is a single carrier's symbol rate
Source code in src/rpps/analysis/spectrum/waveform.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
on_samples ¶
The samples of x inside its bursts (a boolean mask): those every window of the smoothed power over them is on, so a filtered signal's dips between symbols stay in and the bursts' edges stay out. All of x when it doesn't switch
Source code in src/rpps/analysis/spectrum/waveform.py
on_off ¶
Whether the power switches on and off: Bursts, or None (steady, or too weak to tell). smooth: the power is averaged over this long, and over 32 samples at least; contrast: the on level over the off level needed (power ratio); min_off: the least time off. The period (None when the bursts are not regular enough: autocorrelation under 0.5) is found from 0.5 ms to half of the record
Source code in src/rpps/analysis/spectrum/waveform.py
classify ¶
Tones, OFDM, bursts and the envelope of baseband samples x at Fs (see the module): a Waveform