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.

Absorptive plume detection: change of variables, the LMP and the GLRT

Absorptive plume detection

The matched filter starts from an additive model, y=μ+αt+ε\vect{y} = \gvect{\mu} + \alpha \vect{t} + \gvect{\varepsilon}, which is what makes it linear and optimal. However, a gas does not add light to a pixel, it removes a fraction of it, so the plume’s footprint in a spectrum depends on the spectrum it lands on. This page redoes the detection problem with the multiplicative model that Beer–Lambert actually gives, following Theiler & Schaum [1] and Theiler [2]. The tools are the ones a statistician would reach for: a change of variables to get the plume-on density, a likelihood ratio, and a Taylor series in the plume strength to deal with the fact that we do not know it. What comes out is a family of detectors (the clairvoyant detector, the quadratic matched filter, the GLRT) and a precise statement of where the linear matched filter sits among them.

TL;DR

A plume of strength α\alpha multiplies each band of the plume-free spectrum, y=eαTybg\vect{y} = e^{\alpha \mat{T}} \vect{y}_\text{bg} with T=diag(t)\mat{T} = \op{diag}(\vect{t}). Changing variables from ybg\vect{y}_\text{bg} to y\vect{y} gives the plume-on density, and its ratio to the background density is the optimal detector when α\alpha is known:

log⁡LR(α;y)=log⁡p0(e−αTy)−log⁡p0(y)+ατ\log \mathrm{LR}(\alpha; \vect{y}) = \log p_0(e^{-\alpha \mat{T}} \vect{y}) - \log p_0(\vect{y}) + \alpha \tau

For Gaussian clutter, a second-order Taylor series in α\alpha turns the unknown strength into a closed-form estimate and a detector, the GLRT:

α^(y)=Q(y)+τE(y)\hat{\alpha}(\vect{y}) = \frac{Q(\vect{y}) + \tau}{E(\vect{y})}
DGLRT(y)=Q(y)+τE(y)D_\text{GLRT}(\vect{y}) = \frac{Q(\vect{y}) + \tau}{\sqrt{E(\vect{y})}}

with Q(y)=(Ty)⊤Σy−1(y−μy)Q(\vect{y}) = (\mat{T}\vect{y})^\top \gmat{\Sigma}_y^{-1} (\vect{y} - \gvect{\mu}_y) the slope and E(y)E(\vect{y}) the curvature of the log likelihood ratio. Stopping at first order instead gives the “locally most powerful” quadratic matched filter, Q+τQ + \tau, which is optimal only for plumes too weak to detect. Replacing Tybg\mat{T}\vect{y}_\text{bg} by Tμy\mat{T}\gvect{\mu}_y gives the linear matched filter with target μy⊙t\gvect{\mu}_y \odot \vect{t}.

The assumptions are 1) Beer–Lambert per band, 2) a background distribution estimated from plume-free pixels, 3) Gaussian clutter and 4) a plume strength small enough for a second-order series. Practically speaking, on an EMIT-like 2.3 μm scene the Tμ matched filter is already within a factor of two of the clairvoyant bound, and as a detector it is indistinguishable from the GLRT. Where the GLRT pulls ahead is the strength estimate, which stays within 5 % of the truth up to 25 detection limits, whereas the matched filter’s has lost a quarter by then.

The problem

An imaging spectrometer like EMIT or AVIRIS-NG gives one radiance spectrum per pixel, and we want to flag the pixels whose spectrum carries a gas’s absorption. The signal is tiny: at the detection limit a methane plume changes the radiance by about two parts in ten thousand (Check), far below the pixel-to-pixel variation of the surface. What makes detection possible is that we know the gas’s absorption spectrum to high precision and see it across many bands, and that we can model the clutter (the statistics of plume-free pixels) from the scene itself.

So the question is a hypothesis test per pixel: is y\vect{y} a draw from the background distribution (no plume, α=0\alpha = 0), or from the background seen through a plume of some unknown strength α>0\alpha > 0? The unknown α\alpha makes this a composite hypothesis test [3], which is why there is no single “optimal” detector and why the papers end up with several.

Running example · an EMIT-like 2.3 μm pixel

QuantityValue
Bands9 Gaussian bands, 2296–2356 nm every 7.5 nm, FWHM 8.5 nm
AtmosphereAFGL US Standard to 20 km, CH₄ and H₂O from radtrax’s synthetic Voigt tables, Beer–Lambert
Geometrysun at 35°, sensor at 10°
Plumea column enhancement in the bottom layer, 1 ppm·m = 4.03 × 10⁻⁵ mol/m²
SurfaceLambertian, mean albedo 0.25, brightness spread 35 %, small spectral slope and curvature
Noiseadditive Gaussian, SNR 300 at albedo 0.25
Pixels200 000 plume-free, and the same pixels with a plume implanted

The numbers come from radtrax itself: t\vect{t} from unit_absorption_target and the implanted plume from the exact band transmittance of transmittance_table, so the implant includes the curve of growth that the derivation leaves out. Nine bands is the window of the synthetic table; a real EMIT scene has many more, which lowers the detection limit but changes none of the comparisons.

Symbols

SymbolMeaningShapeUnit
BBnumber of bandsscalarnone
y\vect{y}observed band radiance of one pixelRB\mathbb{R}^{B}radiance
ybg\vect{y}_\text{bg}the same pixel without the plumeRB\mathbb{R}^{B}radiance
α\alphaplume strength (column enhancement)R≥0\mathbb{R}_{\ge 0}mol/m²
t\vect{t}unit absorption spectrum, tb=∂ln⁡yb/∂αt_b = \partial \ln y_b / \partial \alpha at 0; negative where the gas absorbsRB\mathbb{R}^{B}m²/mol
T\mat{T}diag(t)\op{diag}(\vect{t})RB×B\mathbb{R}^{B \times B}m²/mol
τ\tau−1⊤t-\vect{1}^\top \vect{t}, the unit optical depth summed over bandsR≥0\mathbb{R}_{\ge 0}m²/mol
p0p_0, pαp_\alphadensity of plume-free and plume-on spectraRB→R≥0\mathbb{R}^{B} \to \mathbb{R}_{\ge 0}radiance⁻ᴮ
μy\gvect{\mu}_y, Σy\gmat{\Sigma}_ymean and covariance of p0p_0RB\mathbb{R}^{B}, RB×B\mathbb{R}^{B \times B}radiance, radiance²
LR(α;y)\mathrm{LR}(\alpha; \vect{y})likelihood ratio pα(y)/p0(y)p_\alpha(\vect{y}) / p_0(\vect{y})scalarnone
AA, QQ, EEMahalanobis distance, slope and curvature of the log likelihood ratioscalar–, m²/mol, (m²/mol)²
α0\alpha_0characteristic plume strengthscalarmol/m²
DnameD_\text{name}a detector’s statistic; larger means more plume-likescalarnone

The matched-filter page writes the pixel as xx; here it is y\vect{y}, the observation. Theiler writes the strength as aa and the absorption as a positive TT; his aTaT is our −αT-\alpha \mat{T}, so every formula below is his with that sign flipped, and τ\tau, QQ and EE keep his meaning exactly.

Part 1 · From Beer–Lambert to a likelihood ratio

In words: we first write what a plume does to a spectrum, then use that map to get the density of plume-on spectra from the density of plume-free ones. The only non-obvious ingredient is the Jacobian of the map, which is where the summed optical depth τ\tau comes from. With both densities in hand, the Neyman–Pearson lemma says their ratio is the best detector, if we knew α\alpha.

Step 1 · Write the plume as a map (uses Assumption 1)

Stacking the bands, the plume is a diagonal linear map on the plume-free spectrum, so we will have:

y=eαTybg\vect{y} = e^{\alpha \mat{T}} \vect{y}_\text{bg}
ybg=e−αTy\vect{y}_\text{bg} = e^{-\alpha \mat{T}} \vect{y}

where eαTe^{\alpha \mat{T}} is the matrix exponential, which for a diagonal matrix is the diagonal of the elementwise exponentials. As seen above, the map is linear in ybg\vect{y}_\text{bg} but not in α\alpha, and that is the whole difficulty. For a fixed pixel the plume moves the spectrum along a curve rather than a straight line, and the direction it moves in, Tybg\mat{T}\vect{y}_\text{bg}, depends on the pixel.

Step 2 · Change variables (uses Assumption 2)

If ybg\vect{y}_\text{bg} has density p0p_0 and y\vect{y} is an invertible function of it, the density of y\vect{y} is p0p_0 at the preimage times the absolute Jacobian determinant of the inverse map, so we will have:

pα(y)=p0(e−αTy)∣det⁡∂ybg∂y∣p_\alpha(\vect{y}) = p_0(e^{-\alpha \mat{T}} \vect{y}) \left\vert \det \frac{\partial \vect{y}_\text{bg}}{\partial \vect{y}} \right\vert
det⁡e−αT=∏b=1Be−αtb=e−αtr(T)=eατ\det e^{-\alpha \mat{T}} = \prod_{b=1}^{B} e^{-\alpha t_b} = e^{-\alpha \op{tr}(\mat{T})} = e^{\alpha \tau}
pα(y)=p0(e−αTy)eατp_\alpha(\vect{y}) = p_0(e^{-\alpha \mat{T}} \vect{y}) e^{\alpha \tau}

The factor eατe^{\alpha \tau} is easy to drop by accident, and Theiler credits Schaum with insisting on it. It has a plain meaning: the plume shrinks every axis of spectrum space by eαtb<1e^{\alpha t_b} < 1, so it packs the background’s probability into a smaller volume, and the density goes up by the inverse of the volume ratio. Without it the likelihood ratio is biased against the plume hypothesis by exactly the amount the plume compresses the clutter. We will see on the companion page that the factor disappears in log space, where the plume is a translation and translations preserve volume.

Step 3 · Take the ratio

With both densities, the ratio of plume-on to plume-free density at the observed spectrum is:

LR(α;y)=pα(y)p0(y)=p0(e−αTy)eατp0(y)\mathrm{LR}(\alpha; \vect{y}) = \frac{p_\alpha(\vect{y})}{p_0(\vect{y})} = \frac{p_0(e^{-\alpha \mat{T}} \vect{y}) e^{\alpha \tau}}{p_0(\vect{y})}

For a known α\alpha the Neyman–Pearson lemma makes this the most powerful test at every false-alarm rate. It is called the clairvoyant detector [3], because it knows the one thing we do not: the plume strength. It is still worth writing down, since every other detector on this page is an approximation to it. In simulation, where we do know α\alpha, it is also the bound the others are measured against.

Step 4 · The clairvoyant detector for Gaussian clutter (uses Assumption 3)

Taking the logarithm of (11) and inserting the Gaussian, the normalising constants cancel and we will have:

log⁡LR(α;y)=−12A(e−αTy)+12A(y)+ατ\log \mathrm{LR}(\alpha; \vect{y}) = -\frac{1}{2} A(e^{-\alpha \mat{T}} \vect{y}) + \frac{1}{2} A(\vect{y}) + \alpha \tau

A(y)A(\vect{y}) is the Mahalanobis distance of the pixel from the background mean (the RX anomaly detector), so the clairvoyant detector asks how much closer to the background the pixel moves when the plume is “taken off”, plus the volume term. It holds for every α>0\alpha > 0, not just weak plumes.

Part 2 · Two ways around the unknown strength

In words: α\alpha appears inside A(e−αTy)A(e^{-\alpha \mat{T}} \vect{y}), so maximising over it is a transcendental problem with no closed form. Both papers handle this with a Taylor series in α\alpha. Keeping only the first-order term gives the locally most powerful (LMP) detector, which is what “assume a weak plume” usually means. Keeping the second-order term as well lets us maximise over α\alpha in closed form, which is the GLRT. So the maximiser is an estimate of the plume strength that we get almost for free.

Step 5 · Expand the Mahalanobis distance (uses Assumption 4)

Write the perturbation as δ=−αTy+α22T2y\gvect{\delta} = -\alpha \mat{T}\vect{y} + \frac{\alpha^2}{2} \mat{T}^2 \vect{y}, expand the quadratic form A(y+δ)A(\vect{y} + \gvect{\delta}) and collect powers of α\alpha, so we will have:

A(e−αTy)=A(y)−2αQ(y)+α2E(y)+O(α3)A(e^{-\alpha \mat{T}} \vect{y}) = A(\vect{y}) - 2\alpha Q(\vect{y}) + \alpha^2 E(\vect{y}) + O(\alpha^3)
Q(y)=(Ty)⊤Σy−1(y−μy)Q(\vect{y}) = (\mat{T}\vect{y})^\top \gmat{\Sigma}_y^{-1} (\vect{y} - \gvect{\mu}_y)
E(y)=(Ty)⊤Σy−1(Ty)+(T2y)⊤Σy−1(y−μy)E(\vect{y}) = (\mat{T}\vect{y})^\top \gmat{\Sigma}_y^{-1} (\mat{T}\vect{y}) + (\mat{T}^2 \vect{y})^\top \gmat{\Sigma}_y^{-1} (\vect{y} - \gvect{\mu}_y)

The two terms of EE have different origins: the first is δ⊤Σy−1δ\gvect{\delta}^\top \gmat{\Sigma}_y^{-1} \gvect{\delta} at first order, and the second is the cross term of the second-order perturbation with the residual. That makes EE exactly a Newton curvature, and its first term alone the Gauss–Newton curvature, which is always positive. However, the full EE can go negative for a pixel far from μy\gvect{\mu}_y, where the second-order series has no interior maximum. This never happened on the running example, but the code in Code falls back to the Gauss–Newton term there anyway (on the running example the two give the same false-alarm rates to three digits). Inserting (16) into (14):

2log⁡LR(α;y)=2α(Q(y)+τ)−α2E(y)+O(α3)2 \log \mathrm{LR}(\alpha; \vect{y}) = 2\alpha \left(Q(\vect{y}) + \tau\right) - \alpha^2 E(\vect{y}) + O(\alpha^3)

Step 6 · First order: the quadratic matched filter

The locally most powerful detector keeps the slope of the log likelihood ratio at α=0\alpha = 0. Since log⁡LR(0;y)=0\log \mathrm{LR}(0; \vect{y}) = 0, we divide by α\alpha (a monotone rescaling for α>0\alpha > 0, which does not change the detector) before taking the limit, so we will have:

DQMF(y)=lim⁡α→0log⁡LR(α;y)α=Q(y)+τD_\text{QMF}(\vect{y}) = \lim_{\alpha \to 0} \frac{\log \mathrm{LR}(\alpha; \vect{y})}{\alpha} = Q(\vect{y}) + \tau

This is a “matched filter” matched to Ty\mat{T}\vect{y}, the pixel’s own plume direction, rather than to a fixed target, which makes it quadratic in y\vect{y}. The constant τ\tau does not change it as a detector; it only makes its mean zero over background pixels. It is the result most people have in mind when they say the weak-plume limit justifies a linear filter, and it shows that it does not: even as α→0\alpha \to 0, the optimal detector is quadratic. Part 3 · Where the linear matched filter sits explains why it is still the worst detector here.

Step 7 · Second order: the GLRT

The GLRT replaces the unknown α\alpha by its maximum-likelihood estimate and evaluates the likelihood ratio there. (19) is a parabola in α\alpha, of the form 2αa−α2b2\alpha a - \alpha^2 b, maximised at a/ba / b with maximum a2/ba^2 / b, so we will have:

α^(y)=max⁡(0,Q(y)+τ)E(y)\hat{\alpha}(\vect{y}) = \frac{\max(0, Q(\vect{y}) + \tau)}{E(\vect{y})}
DGLRT(y)=Q(y)+τE(y)D_\text{GLRT}(\vect{y}) = \frac{Q(\vect{y}) + \tau}{\sqrt{E(\vect{y})}}

The max⁡(0,⋅)\max(0, \cdot) imposes α≥0\alpha \ge 0: an absorptive plume cannot brighten a pixel. The detector itself is the square root of the maximised 2log⁡LR2 \log \mathrm{LR}, signed, which is monotone in it, and Theiler drops the clipping in the detector, (Q+τ)/E(Q + \tau)/\sqrt{E}, since it changes only negative values and no useful threshold is negative. In addition, α^\hat{\alpha} is a plume-strength estimate in its own right, with a built-in albedo correction: numerator and denominator both scale with the pixel’s brightness through Ty\mat{T}\vect{y}, so a bright pixel is not read as a strong plume. Foote et al. [4] add that correction by hand to the matched filter, dividing its estimate by r=y⊤μy/μy⊤μyr = \vect{y}^\top \gvect{\mu}_y / \gvect{\mu}_y^\top \gvect{\mu}_y; here it falls out of the likelihood.

Part 3 · Where the linear matched filter sits

In words: the linear matched filter needs an additive model, a fixed vector that the plume adds to every pixel. We get one by linearising Beer–Lambert and then replacing the pixel-dependent direction Tybg\mat{T}\vect{y}_\text{bg} by a constant. The choice of constant is the difference between a good and a bad matched filter. The same constant also defines the strength of a “just detectable” plume, and that strength is what explains why the LMP detector does so badly.

Step 8 · The Tμ matched filter (uses Assumption 5)

With a constant target Tμy=μy⊙t\mat{T}\gvect{\mu}_y = \gvect{\mu}_y \odot \vect{t} on Gaussian clutter, the problem is the additive one of the matched filter, so we will have:

DAMF(y)=(Tμy)⊤Σy−1(y−μy)(Tμy)⊤Σy−1(Tμy)D_\text{AMF}(\vect{y}) = \frac{(\mat{T}\gvect{\mu}_y)^\top \gmat{\Sigma}_y^{-1} (\vect{y} - \gvect{\mu}_y)}{(\mat{T}\gvect{\mu}_y)^\top \gmat{\Sigma}_y^{-1} (\mat{T}\gvect{\mu}_y)}

Comparing with (20), the QMF is this filter with μy\gvect{\mu}_y replaced by y\vect{y} in the target and no normalisation. Both papers also test the “naive” target t\vect{t} itself, which assumes a spectrally flat background. The Tμ target beat it in every case they tried, and in the running example it cuts the false-alarm rate at 80 % detection five- to six-fold for a plume at 5 α0\alpha_0 (Check). In radtrax this is the μ ⊙ t option that unit_absorption_target documents: apply_image(cube, mean, cov, mean * t).

Step 9 · The characteristic plume strength

Under the background hypothesis the matched filter’s estimate (24) has mean zero and standard deviation α0\alpha_0, so a plume of strength nα0n \alpha_0 is an nn-sigma detection. Theiler takes α0\alpha_0 as the scale of a “just detectable” plume, so we will have:

α0=1(Tμy)⊤Σy−1(Tμy)=1∥Σy−1/2Tμy∥2\alpha_0 = \frac{1}{\sqrt{(\mat{T}\gvect{\mu}_y)^\top \gmat{\Sigma}_y^{-1} (\mat{T}\gvect{\mu}_y)}} = \frac{1}{\Vert \gmat{\Sigma}_y^{-1/2} \mat{T} \gvect{\mu}_y \Vert_2}

This is the inverse of the per-unit-strength SNR that matched_filter_snr computes, SNR(α)=α/α0\mathrm{SNR}(\alpha) = \alpha / \alpha_0, with the target μy⊙t\gvect{\mu}_y \odot \vect{t}. The same scale also says how weak a detectable plume is in the raw data: at α0\alpha_0 the spectrum changes by a fraction α0∥Tμy∥2/∥μy∥2\alpha_0 \Vert \mat{T}\gvect{\mu}_y \Vert_2 / \Vert \gvect{\mu}_y \Vert_2, which is 2×10−42 \times 10^{-4} in the running example and below 10-3 on all four of Theiler’s real scenes. The matched filter’s gain comes from whitening, from looking along the directions where the clutter is quiet.

Step 10 · Why the “locally most powerful” detector fails

The QMF dropped the α2E\alpha^2 E term of (19) on the grounds that α\alpha is small. However, small compared with what? Averaging EE over background pixels (the expectation of a quadratic form, E[u⊤Mu]=E[u]⊤ME[u]+tr(MΣy)\mathbb{E}[\vect{u}^\top \mat{M} \vect{u}] = \mathbb{E}[\vect{u}]^\top \mat{M} \mathbb{E}[\vect{u}] + \op{tr}(\mat{M} \gmat{\Sigma}_y)), we will have:

Ep0[E(y)]=1α02+tr(TΣy−1TΣy)+tr(T2)≥1α02\mathbb{E}_{p_0}[E(\vect{y})] = \frac{1}{\alpha_0^2} + \op{tr}(\mat{T} \gmat{\Sigma}_y^{-1} \mat{T} \gmat{\Sigma}_y) + \op{tr}(\mat{T}^2) \ge \frac{1}{\alpha_0^2}

so the dropped term is at least (α/α0)2(\alpha / \alpha_0)^2, the squared detection SNR. A plume weak enough for the first-order term to dominate is weaker than α0\alpha_0, which is to say undetectable. At a pixel that does carry a plume, Q+τ≈αEQ + \tau \approx \alpha E, so the dropped term is half the kept one whatever the strength (0.50–0.53 in the running example from 3 to 25 detection limits). The LMP detector is optimal in exactly the regime where no detector works, which is Theiler’s Appendix B. Theiler states the bound per pixel; it holds on average over background pixels, and at a typical pixel in the running example Eα02=1.12E \alpha_0^2 = 1.12.

Check

Units

QuantityUnits
αtb\alpha t_b, ατ\alpha \taumol/m² × m²/mol✓ dimensionless
QQ(m²/mol × radiance) × radiance⁻² × radiancem²/mol, like τ\tau ✓
EE(m²/mol)²✓
α^=(Q+τ)/E\hat{\alpha} = (Q + \tau)/E(m²/mol) / (m²/mol)²✓ mol/m²
DGLRT=(Q+τ)/ED_\text{GLRT} = (Q + \tau)/\sqrt{E}(m²/mol) / (m²/mol)✓ dimensionless, an SNR
α0\alpha_01 / (m²/mol)✓ mol/m²

Numbers · the running example (Gaussian albedo; lognormal brightness in parentheses)

QuantityValue
strongest band, min⁡btb\min_b t_b−0.19 m²/mol
τ\tau0.54 m²/mol
α0\alpha_00.028 mol/m² ≈ 690 ppm·m (0.027 mol/m², 660 ppm·m)
fractional radiance change at α0\alpha_02.0 × 10⁻⁴
E[E]α02\mathbb{E}[E] \alpha_0^2 over background pixels1.12 (1.13) ✓ ≥ 1
median α^GLRT/α\hat{\alpha}_\text{GLRT} / \alpha at 3, 5, 25 α0\alpha_00.99, 0.99, 0.95
median α^AMF/α\hat{\alpha}_\text{AMF} / \alpha at 3, 5, 25 α0\alpha_00.96, 0.93, 0.74 (0.93, 0.90, 0.71)

False-alarm rate at 80 % detection, plume at 5 α0\alpha_0

DetectorGaussian albedoLognormal brightness
clairvoyant (14)7.2 × 10⁻⁴6.2 × 10⁻⁴
GLRT (22)1.1 × 10⁻³1.0 × 10⁻³
Tμ-AMF (24)1.2 × 10⁻³1.0 × 10⁻³
t-AMF6.3 × 10⁻³6.5 × 10⁻³
QMF (20)2.7 × 10⁻²2.6 × 10⁻²

Each rate is over 200 000 background pixels, so the smallest is 120–140 false alarms and good to roughly ±10 %. The Tμ target beating t\vect{t} and the QMF in last place match Theiler throughout. One difference: on his simulated Gaussian backgrounds (his Table VI) the GLRT is substantially better than the Tμ filter, whereas here they tie, as they do on his real AVIRIS-NG scene (his Fig. 1a). The synthetic scene has nine bands and mostly brightness clutter, so it leaves the GLRT little to gain as a detector; its strength estimate is where it still pulls ahead.

Limits. At α=0\alpha = 0, (14) is zero, as a log likelihood ratio must be. As μy\gvect{\mu}_y becomes spectrally flat, Tμy∝t\mat{T}\gvect{\mu}_y \propto \vect{t} and the Tμ and t filters coincide, which is when the naive target is fine. If the pixel equals the mean, Q=0Q = 0 and α^=τ/E\hat{\alpha} = \tau / E, a small positive bias from the volume term that the clipping at zero then dominates.

Code

The Tμ matched filter is one call; the GLRT is a handful of lines on the same operators. The snippet below ran against radtrax main (with Float, Array from jaxtyping and lx for lineax). The symmetry Σy−1=Σy−⊤\gmat{\Sigma}_y^{-1} = \gmat{\Sigma}_y^{-\top} is what lets one solve, Σy−1(Ty)\gmat{\Sigma}_y^{-1} (\mat{T}\vect{y}), serve all three quadratic forms.

import gaussx_linalg
import jax
import jax.numpy as jnp

from radtrax.retrieval.matched_filter import apply_image, estimate_cov_shrunk, estimate_mean

# Shapes: H × W pixels; B bands
# cube: radiance (H, W, B); t from unit_absorption_target, (B,) [m²/mol]

# today (radtrax)
# μ_y = background mean of the scene
mean = estimate_mean(cube)                                   # (H, W, B) → (B,)
# today (radtrax)
# Σ_y = Ledoit–Wolf shrunk covariance of the scene
cov = estimate_cov_shrunk(cube, mean)                        # → (B, B) PD operator

# today (radtrax)
# α̂_AMF = (Tμ_y)ᵀ Σ_y⁻¹ (y − μ_y) / (Tμ_y)ᵀ Σ_y⁻¹ (Tμ_y)
alpha_amf = apply_image(cube, mean, cov, mean * t)           # (H, W, B) → (H, W)


# user
def glrt_image(
    cube: Float[Array, "H W B"],
    mean: Float[Array, " B"],
    cov_op: lx.AbstractLinearOperator,
    t: Float[Array, " B"],
) -> tuple[Float[Array, "H W"], Float[Array, "H W"]]:
    # τ = −1ᵀt
    tau = -jnp.sum(t)                                        # (B,) → ()
    # r = y − μ_y
    r = cube - mean                                          # (H, W, B)
    # Ty = t ⊙ y
    ty = t * cube                                            # (H, W, B)
    # today (gaussx)
    # s = Σ_y⁻¹ (Ty), one structured solve per pixel
    s_ty = jax.vmap(jax.vmap(lambda v: gaussx_linalg.solve(cov_op, v)))(ty)   # (H, W, B)
    # Q = (Ty)ᵀ Σ_y⁻¹ (y − μ_y)
    q = jnp.einsum("hwb,hwb->hw", s_ty, r)                   # (H, W, B) → (H, W)
    # E_GN = (Ty)ᵀ Σ_y⁻¹ (Ty)
    e_gn = jnp.einsum("hwb,hwb->hw", s_ty, ty)               # (H, W, B) → (H, W)
    # E = E_GN + (T²y)ᵀ Σ_y⁻¹ (y − μ_y)
    e = e_gn + jnp.einsum("hwb,hwb->hw", s_ty * t, r)        # (H, W)
    # E ← E_GN where E ≤ 0 (no interior maximum far from μ_y)
    e = jnp.where(e > 0, e, e_gn)                            # (H, W)
    # α̂ = max(0, Q + τ) / E
    alpha_hat = jnp.maximum(q + tau, 0.0) / e                # (H, W)
    # D_GLRT = (Q + τ) / √E
    d_glrt = (q + tau) / jnp.sqrt(e)                         # (H, W)
    return d_glrt, alpha_hat

apply_image is (24) (Step 8); glrt_image is (16), (21) and (22) (Steps 5 and 7). The double vmap solves per pixel, which keeps the sketch agnostic to the structure of Σy\gmat{\Sigma}_y through gaussx_linalg.solve. For a dense or low-rank Σy\gmat{\Sigma}_y it is cheaper to factorise once and solve the whole cube as one block of right-hand sides, which is what a library version would do.

When the assumptions break

AssumptionFails whenThen use
Assumption 1 Beer–Lambert per bandlines saturate within a band; path radiance; emissionthe exact band transmittance transmittance_table in the clairvoyant detector, or a finite-amplitude target, nonlinear_target_from_obs
Assumption 2 known backgroundplume contamination; mixed surfacesrobust means, GMM clusters, adaptive windows (matched filter, §3)
Assumption 3 Gaussian clutterfat tails, multiplicative albedo variationthe multivariate t, ACE, the lognormal matched filter (Beyond Gaussian clutter)
Assumption 4 second order in α\alphaα∣tb∣\alpha \lvert t_b \rvert near onemaximise (14) over α\alpha numerically (a scalar problem per pixel)
Assumption 5 constant plume directionstrong brightness variationthe GLRT’s α^\hat{\alpha}, or an albedo-corrected matched filter

Draft 1, November 2026. Running-example numbers are from a synthetic 9-band scene built with radtrax; they illustrate the comparisons, not EMIT’s detection limit. Next: Beyond Gaussian clutter.

Footnotes
  1. Theiler, J. & Schaum, A. (2020). Some closed-form expressions for absorptive plume detection. Proc. IEEE IGARSS 2020, 1786–1789. doi:10.1109/IGARSS39084.2020.9323752

  2. Theiler, J. (2021). Absorptive weak plume detection on Gaussian and non-Gaussian background clutter. IEEE JSTARS, 14, 6842–6854. doi:10.1109/JSTARS.2021.3093820 (CC-BY 4.0).

  3. Kay, S. M. (1998). Fundamentals of Statistical Signal Processing, Vol. II: Detection Theory. Prentice Hall.

  4. Foote, M. D., Dennison, P. E., Thorpe, A. K., et al. (2020). Fast and accurate retrieval of methane concentration from imaging spectrometer data using sparsity prior. IEEE TGRS, 58(9), 6480–6492.