Tuning the reflection update period

Tutorial goal

Explore the speed/quality tradeoff from updating reflection coefficients less frequently.

Note

New to the terminology? See the lattice DSP concept map and the causality/data-use guide for how online, offline, block, and MIMO examples should be read.

Context

Updating denominator parameters can be more expensive than updating numerator taps. This tutorial sweeps the reflection update period and reports which periods preserve quality while reducing work.

Key idea and equations

A period P updates reflection coefficients only when

\[n \equiv 0 \pmod P.\]

How to read the result

Look for the largest period that keeps the tail MSE close to the period-1 baseline.

Run command

python examples/tune_reflection_update_period.py

Source code

 1"""Tune the adaptive reflection-update period on one identification problem."""
 2
 3from __future__ import annotations
 4
 5import numpy as np
 6
 7import lattice_dsp
 8
 9rng = np.random.default_rng(1234)
10x = rng.normal(size=20_000)
11
12# Synthetic target for the example. In a real system, ``desired`` is measured.
13target = lattice_dsp.LatticeIIR([0.35, -0.25, 0.15, -0.08], [0.2, -0.1, 0.05, 0.0, 0.75])
14desired = np.asarray(target.process(x), dtype=float)
15
16result = lattice_dsp.tune_reflection_update_period(
17    x,
18    desired,
19    periods=[1, 2, 4, 8, 16, 32],
20    order=4,
21    max_tail_mse_ratio=1.5,
22    max_worst_tail_mse_ratio=2.0,
23)
24
25print("recommended period:", result["recommended_period"])
26print("scope:", result["metadata"]["recommendation_scope"])
27print("warnings:", result["warnings"])
28print("recommended row:", result["recommended"])
29
30# Robust validation mode: stack multiple independent validation trials as rows.
31X = np.vstack([x, rng.normal(size=x.size), rng.normal(size=x.size)])
32D = np.vstack([desired, target.process(X[1]), target.process(X[2])]).astype(float)
33robust = lattice_dsp.tune_reflection_update_period(
34    X,
35    D,
36    periods=[1, 2, 4, 8, 16, 32],
37    order=4,
38    max_tail_mse_ratio=1.5,
39    max_worst_tail_mse_ratio=2.0,
40)
41print("robust recommended period:", robust["recommended_period"])
42print("robust scope:", robust["metadata"]["recommendation_scope"])