Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Matched filter — covariance flavours on a heterogeneous scene

Covariance flavours for the matched filter

The MF score formula α^=(x−μ)⊤Σ−1t/(t⊤Σ−1t)\hat\alpha = (x - \mu)^\top \Sigma^{-1} t / (t^\top \Sigma^{-1} t) is agnostic to the structure of Σ\Sigma — but the right choice of estimator makes the difference between a detector that works and one that fires on every surface reflectance feature. This notebook runs four covariance models on a simulated two-surface scene (high-albedo + low-albedo halves with a plume straddling the boundary) and shows how each one changes the detection map.

Same HAPI methane LUT as plumax’s 01_mf_vs_3dvar.ipynb. Four flavours:

  1. Empirical — sample covariance with a small ridge.

  2. Ledoit–Wolf shrunk — shrinkage toward a scaled identity, PD even when nsamples<nbandsn_{\text{samples}} < n_{\text{bands}}.

  3. Low-rank + Tikhonov — Σ=τI+VDV⊤\Sigma = \tau I + V D V^\top from sklearn’s randomised SVD, Woodbury-solved via gaussx.LowRankUpdate.

  4. Cluster-specific (GMM) — one (μk,Σk)(\mu_k, \Sigma_k) per GMM component, so each surface type gets its own background statistics.

Outputs recorded before the move. The outputs below were produced by plumax 0.1.2 (28f257e), whose code radtrax ports unchanged, so cache paths in them still read .cache/plumax. Re-execute with the [hitran] extra and network access to hitran.org to refresh them.

1. Build the forward operator (same HAPI LUT as the 3D-Var notebook)

2. Synthesise a heterogeneous scene

Two surface types (bright, dark) with distinct reflectance spectra, plus a compact rectangular plume that crosses the boundary. The key point: a global mean/covariance will smear the two surface populations together; only the GMM flavour can represent them separately.

scene 40×64, 100 bands, noise_std 1.587e-02

3. Target signature

The target is the transmittance spectral derivative — it is surface-albedo-independent in the linear approximation, so we compute it with the zero-VMR background. For this comparison we use the nonlinear target at 3 ppm (matches the injected peak); in the linear regime the choice barely matters.

4. Run all four covariance estimators

Empirical                688.3 ms
Ledoit–Wolf               88.3 ms
Low-rank (rank 8)       1411.8 ms
GMM (per-surface)        517.2 ms

5. Score maps

Each panel shows the MF score on the same colour scale. The plume rectangle is outlined in black. Look for:

  • How clean the off-plume background is (ideally flat and zero — high contrast = weak detector).

  • How uniform the on-plume score is across the vertical midline (the surface-type boundary). A global covariance will show a discontinuity at the boundary because μ\mu and Σ\Sigma are wrong on one of the two surfaces; per-cluster estimation should not.

<Figure size 1200x900 with 8 Axes>

6. Quantitative detection metrics

For each flavour, compute:

  • Contrast = (mean score inside plume) − (mean score outside plume).

  • Off-plume std = spatial std of the score outside the plume rectangle — this approximates the detection noise floor.

  • Detection SNR = contrast / off-plume std.

The GMM flavour should have the lowest off-plume std because it does not confuse surface-type variation for a plume signal. The low-rank flavour should have comparable SNR at a fraction of the precompute cost.

Flavour                    contrast        off-σ  det-SNR    bias@peak
Empirical                  2.67e-06     2.49e-07     10.7    -5.40e-07
Ledoit–Wolf                2.68e-06     2.43e-07     11.0    -5.31e-07
Low-rank (rank 8)          2.72e-06     2.39e-07     11.4    -4.91e-07
GMM (per-surface)          2.78e-06     2.02e-07     13.8    -4.32e-07

7. Take-aways

  • Empirical and Ledoit–Wolf are almost indistinguishable on this well-populated scene (2560 pixels, 100 bands → nsamples≫nbandsn_{\text{samples}} \gg n_{\text{bands}}). Shrinkage matters when that inequality reverses.

  • Low-rank + Tikhonov produces a cleaner off-plume background at a fraction of the precompute cost (typically 5–20× faster on the covariance estimation and apply). The gaussx.LowRankUpdate / Woodbury path is the right default for hyperspectral scenes where the spectral covariance is approximately rank ~O(10).

  • GMM per-surface gives the best detection SNR here because it removes the surface-type population as a nuisance component — the bright/dark boundary no longer leaks into the “plume” direction. The cost is more sensitive to the number of components and the GMM fit quality; for production one typically runs BayesianGaussianMixture so the effective rank is learned.

  • All four succeed at localising the plume — the failure modes are in (i) false-positive rate on the wrong-surface half and (ii) amplitude bias from using the wrong reflectance in the target. The GMM approach fixes both at once by making both μ\mu and tt cluster-local.

The unifying point: switching the covariance model means swapping one call to an estimator function. The MF kernel itself — apply_image — is a single implementation that dispatches through gaussx.solve.