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.

Seen on one overpass in five: how often does a facility emit?

GeoStack · background · the modeling cycle · example 3 of 3 · L4 → L5

Abstract

The third worked example of the modeling cycle. Examples 1 and 2 turned one overpass into one emission rate. A year of overpasses gives a catalogue, and the question becomes how persistent the source is. The usual first answer is the share of overpasses with a detection. Deriving what that share actually measures shows it mixes the source with the sensor, so the next model describes the source in its own time: events at a rate, sizes from a distribution, thinned by what each instrument can see while it is looking. Its likelihood is derived here, it has a closed-form posterior when the rate is constant, and the questions operations ask become integrals of the fitted rate.

Keywords:persistencythinned point processprobability of detectionemission inventorymodeling cycleplumax

The operators

1 · The facility

A generative story of when the facility emits, how big each event is, and who saw it. Events arrive as a Poisson process with a daily cycle, sizes are lognormal, and an event is detected with the instrument’s detection probability if an overpass window covers it.

{ti}∼PoissonProcess(ρ(t))\{\rOut{t_i}\} \sim \mathrm{PoissonProcess}(\rho(t))
Qi∼LogNormal(μQ,σQ2)\rOut{Q_i} \sim \mathrm{LogNormal}(\rPar{\mu_Q}, \rPar{\sigma_Q}^2)
δi∼Bernoulli(Pd(Qi)) if ti∈w for some window w\rOut{\delta_i} \sim \mathrm{Bernoulli}\left(\rCon{P_d}(\rOut{Q_i})\right) \text{ if } \rOut{t_i} \in \rExt{w} \text{ for some window } \rExt{w}
RoleSymbolNameShapeUnitNote
Parameterρ0\rPar{\rho_0}mean rate()day⁻¹
A\rPar{A}cycle amplitude()day⁻¹
tpeak\rPar{t_\text{peak}}peak hour()h
ParameterμQ\rPar{\mu_Q}log-size mean()log kg h⁻¹of the event sizes
σQ\rPar{\sigma_Q}log-size spread()—
External input{w}\rExt{\{w\}}overpass windows(window,)dayswho was looking when
ConstantPd(j)(Q)\rCon{P_d^{(j)}(Q)}detection probability——published curve of instrument jj
Output{(ti,Qi):δi=1}\rOut{\{(t_i, Q_i) : \delta_i = 1\}}detected events(event,)days, kg h⁻¹the catalogue, eq. 3

2 · Thinned point-process fit

Fit the story to the catalogue with NUTS over the rate, the sizes and the detection curves. The likelihood counts the detections and also the windows that saw nothing, through the number of events each window should have caught.

Peff,w(θ)=∫p(Q;θ)Pd,w(Q)dQP_{\text{eff},w}(\rOut{\gvect{\theta}}) = \int p(Q; \rOut{\gvect{\theta}}) P_{d,w}(Q) \mathrm{d}Q
LNLL(θ)=−∑i[log⁡ρ(ti)+log⁡p(Qi)+log⁡Pd,wi(Qi)]+∑wΛwPeff,w(θ)\mathcal{L}_\text{NLL}(\rOut{\gvect{\theta}}) = -\sum_i \left[\log \rho(\rIn{t_i}) + \log p(\rIn{Q_i}) + \log P_{d,w_i}(\rIn{Q_i})\right] + \sum_w \rEst{\Lambda_w} P_{\text{eff},w}(\rOut{\gvect{\theta}})
RoleSymbolNameShapeUnitNote
Inputti\rIn{t_i}detection times(event,)days
draws of Qi\rIn{Q_i}emission rates(event, draw)kg h⁻¹each with example 2’s uncertainty
External input{w}\rExt{\{w\}}overpass windows(window,)daysalso the windows that saw nothing
EstimatedΛw=∫wρ(t)dt\rEst{\Lambda_w = \int_w \rho(t) \mathrm{d}t}expected events per window(window,)events
Outputdraws of θ\rOut{\gvect{\theta}}posterior draws(draw, …)

3 · Persistency metrics

Read off what operations ask for, as functions of the fitted rate: the chance of at least one event in the next hh hours, the expected wait for the next one, and the mass emitted over a period.

P(N(t,t+h)≥1)=1−exp⁡(−Λ(t,t+h))\mathbb{P}(N(t, t + h) \ge 1) = 1 - \exp(-\Lambda(t, t + h))
E[Δt∣t0]=∫0∞exp⁡(−Λ(t0,t0+τ))dτ\mathbb{E}[\Delta t \mid t_0] = \int_0^\infty \exp(-\Lambda(t_0, t_0 + \tau)) \mathrm{d}\tau
M=Λ(0,T)Ep(Q)[Q]tdur\rOut{M} = \Lambda(0, T) \mathbb{E}_{p(Q)}[Q] \rCon{t_\text{dur}}
RoleSymbolNameShapeUnitNote
Inputdraws of θ\rIn{\gvect{\theta}}posterior draws(draw, …)
Constanttdur\rCon{t_\text{dur}}event duration()h
Outputoccurrencechance of an event(draw,)—eq. 1
waitexpected wait(draw,)heq. 2
countexpected event count(draw,)eventseq. 3
massemitted mass(draw,)kgeq. 3

The running example

Notation

ii indexes detected events, ww coverage windows and jj instruments. NdetN_\text{det}, NwindowN_\text{window} and NhitN_\text{hit} count detections, overpass windows and windows with a detection. Time tt is in days; the hour of the day is its fractional part.

SymbolRoleShapeUnit
ti,Qit_i, Q_iobservation · time and emission rate of detection iiR\mathbb{R}, R\mathbb{R}days, kg h⁻¹
ρ(t)\rho(t)state · event rate (intensity)function of ttevents day⁻¹
Λ(t1,t2)\Lambda(t_1, t_2)est · expected events between two times, ∫t1t2ρ\int_{t_1}^{t_2} \rhoR\mathbb{R}events
p(Q;μQ,σQ)p(Q; \mu_Q, \sigma_Q)state · size distribution of eventsdensity(kg h⁻¹)⁻¹
Pd(j)(Q)P_d^{(j)}(Q)const · probability that instrument jj detects an event of size QQ[0,1][0, 1]—
Peff,wP_{\text{eff},w}est · share of events detectable in window ww[0,1][0, 1]—
tdurt_\text{dur}const · event durationR\mathbb{R}h
MMout · methane emitted in the window [0,T][0, T]R\mathbb{R}kg
TTconst · horizon of the metricsR\mathbb{R}days
hhconst · length of a visitR\mathbb{R}h
t0,Δtt_0, \Delta tconst · start of the wait, and the wait for the next eventR\mathbb{R}, R\mathbb{R}days, days
a0,b0a_0, b_0const · shape and rate of the Gamma prior on ρ\rhoR>0\mathbb{R}_{>0}, R>0\mathbb{R}_{>0}—, day
θfrac\theta_\text{frac}state · detection fraction of model 1[0,1][0, 1]—

Model 1 · Count the overpasses with a plume

The simplest persistency is a fraction: overpasses with a detection over overpasses. As a model, it says every overpass is a coin flip with the same probability θfrac\theta_\text{frac}:

Nhit∣θfrac∼Binomial(Nwindow,θfrac) and θfrac∣Nhit∼Beta(1+Nhit,1+Nwindow−Nhit)N_\text{hit} \mid \theta_\text{frac} \sim \mathrm{Binomial}(N_\text{window}, \theta_\text{frac}) \text{ and } \theta_\text{frac} \mid N_\text{hit} \sim \mathrm{Beta}(1 + N_\text{hit}, 1 + N_\text{window} - N_\text{hit})

That is testable: split the overpasses by instrument or by hour and see whether one θfrac\theta_\text{frac} fits them all. It does not, and the reason can be derived. Suppose the facility is a Poisson source with rate ρ\rho and an overpass sees the events of the window ww before it. The number of detectable events in the window is Poisson with mean ΛwPeff,w\Lambda_w P_{\text{eff},w} (thinning a Poisson process keeps it Poisson), so

θfrac,w=P(at least one detection at w)=1−exp⁡(−ΛwPeff,w) and Peff,w=∫p(Q)Pd(jw)(Q)dQ\theta_{\text{frac},w} = \mathbb{P}(\text{at least one detection at } w) = 1 - \exp\left(-\Lambda_w P_{\text{eff},w}\right) \text{ and } P_{\text{eff},w} = \int p(Q) P_d^{(j_w)}(Q) \mathrm{d}Q

The fraction depends on the instrument through Peff,wP_{\text{eff},w} and on the hour through Λw\Lambda_w. It is a property of the looking as much as of the source.

Model 2 · Give the source its own clock

Describe the facility, not the looking. Card 1 is the generative story; its likelihood follows in three steps.

The second sum is what the fraction threw away. An overpass with no detection is evidence, and how much it is worth depends on who was looking: an empty pass by the sensitive instrument says the source was probably quiet; an empty pass by the coarse one says little.

The closed form. With a constant rate, known Peff,wP_{\text{eff},w} and a Gamma prior ρ∼Gamma(a0,b0)\rho \sim \mathrm{Gamma}(a_0, b_0) (shape a0a_0, rate b0b_0 in day), the time part of eq. (11) is ρ∑w∣w∣Peff,w−Ndetlog⁡ρ\rho \sum_w \vert w \vert P_{\text{eff},w} - N_\text{det} \log \rho, so the posterior is again Gamma:

ρ∣data∼Gamma(a0+Ndet,b0+∑w∣w∣Peff,w)\rho \mid \text{data} \sim \mathrm{Gamma}\left(a_0 + N_\text{det}, b_0 + \sum_w \vert w \vert P_{\text{eff},w}\right)

This is the referee for the sampler when the rate is constant: NUTS on eq. (11) must reproduce it.

import plumax.population as pop
from numpyro.infer import MCMC, NUTS

# Shapes: N_det detections; N_draw draws per detection; N_window windows; N_instr instruments
# Units: [t] = days; [ρ] = events day⁻¹; [Q] = kg h⁻¹

# today (plumax)
# P_d^j(Q) = 1 / (1 + (Q₅₀ / Q)^γ_det), with a prior on Q₅₀
pods = [pop.InstrumentPOD(name="hyperspectral", model="log_logistic", q50=500.0, q50_std=0.2, slope=3.0),
        pop.InstrumentPOD(name="multispectral", model="log_logistic", q50=4_000.0, q50_std=0.2, slope=3.0)]
# today* (plumax)
# Qᵢ⁽ᵉ⁾ ~ p(Q | Δyᵢ) from example 2, with the log prior they were drawn under
evidence = pop.EventEvidence(log_weights=log_prior_of_draws, q_samples=rate_draws)       # (I, S)
# today* (plumax)
# ℒ_NLL = −Σᵢ[log ρ(tᵢ) + mᵢ(θ)] + Σ_w Λ_w P_eff,w(θ)
sampler = MCMC(NUTS(pop.tmtpp_iw_model), num_warmup=400, num_samples=400)
sampler.run(key, event_times, mask, evidence, mark=pop.LognormalMark(), intensity="constant",
            window=(0.0, 365.0), pods=pods, coverage=coverage, coverage_intervals=windows)

Compare: counts by group

A point-process model predicts counts. Split the overpasses into groups the fit did not single out (by instrument, and by morning and afternoon) and compare observed with expected detections:

χ2=∑g(Ng−E[Ng])2E[Ng] and E[Ng]=∑w∈gΛwPeff,w\chi^2 = \sum_g \frac{(N_g - \mathbb{E}[N_g])^2}{\mathbb{E}[N_g]} \text{ and } \mathbb{E}[N_g] = \sum_{w \in g} \Lambda_w P_{\text{eff},w}

With a handful of groups, values up to about the number of groups are what chance gives. Model 1 fails this test between instruments, as eq. (10) says it must. Model 2 passes between instruments, because Peff,wP_{\text{eff},w} is in the prediction. If it still fails between morning and afternoon, the misfit has a pattern in time of day, which a constant rate cannot produce: the rate itself varies.

A week at the facility: events, windows, detections
day 1day 2day 3day 4day 5day 6day 7
hyperspectral windowmultispectral windowdetectednot detected

A week of the facility. Events (bars, height = size) arrive at a rate that peaks in the evening; overpass windows (shaded) fall in daylight; detections (filled) are the events inside a window and above the instrument’s curve. Most events are never looked at, and the evening, where the facility is busiest, is never looked at at all.

Model 3 · The rate has a daily cycle

The structural change is a rate that depends on the hour:

ρ(t)=max⁡(0,ρ0+Acos⁡(2π(t−tpeak)))\rho(t) = \max\left(0, \rho_0 + A \cos\left(2 \pi (t - t_\text{peak})\right)\right)

with tt in days. Equation (11) is unchanged; only Λw\Lambda_w now depends on when each window falls. The model is plumax’s DiurnalSinusoidalIntensity, so the change to the fit is one word, intensity="diurnal".

The outer loop on persistency

Model 1 · Detection fractionone coin per overpass

18 %18\ \% or 5 %5\ \%depending on the instrument

compare: the fraction depends on who lookeda property of the sensor, not the source

Model 2 · Thinned process, constant rateρ\rho, p(Q)p(Q) and a detection curve per instrument

ρ=2.04±0.41\rho = 2.04 \pm 0.41 per dayfits between instruments

compare: afternoon windows see more than predictedthe rate changes through the day

Model 3 · With a daily cycleρ(t)=max⁡(0,ρ0+Acos⁡(2π(t−tpeak)))\rho(t) = \max\left(0, \rho_0 + A \cos\left(2 \pi (t - t_\text{peak})\right)\right)

fits by hour of dayevening only by extrapolation

The outer loop on persistency. The first change replaces a property of the sensor by a model of the source; the second gives the source’s rate the time dependence the residual counts asked for.

What operations ask for

With a fitted rate, the questions that matter are integrals of it, evaluated for every posterior draw so that each answer carries its uncertainty.

# today (plumax)
# ℙ(N(t, t + h) ≥ 1) = 1 − exp(−Λ(t, t + h)), member by member
occurrence = pop.posterior_metric(pop.occurrence_probability, posterior, 20 / 24, 4 / 24)
# today (plumax)
# 𝔼[Δt | t₀] = ∫₀^∞ exp(−Λ(t₀, t₀ + τ)) dτ
wait = pop.posterior_metric(pop.expected_wait_time, posterior, 18 / 24)
# today* (plumax)
# M = Λ 𝔼_p(Q)[Q] t_dur,  M_missed = Λ 𝔼_p(Q)[Q (1 − P_d)] t_dur
total = pop.total_emission(posterior, horizon=(0.0, 365.0), event_duration=3.0, pods=pods)

The detections are not the emissions

Because large events are detected more easily, the detected events are a size-biased sample:

E[Q∣detected]=Ep(Q)[QPd(Q)]Ep(Q)[Pd(Q)]≥Ep(Q)[Q]\mathbb{E}[Q \mid \text{detected}] = \frac{\mathbb{E}_{p(Q)}[Q P_d(Q)]}{\mathbb{E}_{p(Q)}[P_d(Q)]} \ge \mathbb{E}_{p(Q)}[Q]

with equality only when PdP_d is flat. Summing the detected events misses both the events nobody looked at (all but a few percent of them) and the small events that were looked at and missed. A catalogue therefore overstates the typical event and understates the total, both at once.

Worked numbers

ModelWhat it estimatesUses the empty overpasses?Comparable across sensors?Answers “how many events, how much mass?”
1 · Detection fractionθfrac\theta_\text{frac} per lookonly as a denominatornoonly with an assumed duration
2 · Thinned process, constant rateρ\rho, p(Q)p(Q), the Q50Q_{50}yes, via ΛwPeff,w\Lambda_w P_{\text{eff},w}yesyes, with uncertainty
3 · With a daily cycleρ(t)\rho(t), p(Q)p(Q), the Q50Q_{50}yesyesyes; the unobserved hours by extrapolation

The six steps, for this problem

StepIn this exampleStatus
1 · Simple modelA generative story for events: an intensity, a mark and a detection curve per instrument, all in plumax.populationtoday
2 · Model-based inferencetmtpp_iw_model under NUTS, with coverage windows and each detection’s own uncertainty; the conjugate posterior of eq. (12) as its referee for a constant ratetoday
3 · EmulatorSkipped: the fit of one facility-year is seconds to a minute—
4 · Emulator-based inferenceA variational fit takes this place at the scale of a national catalogue—
5 · Amortized inferenceFrom a region and a window of history straight to the posterior of rate, sizes and totals—
6 · ImproveSimulation-based calibration of the whole fit (run_sbc); self-exciting and covariate-driven rates (plumax#115); real catalogues with their coverage (plumax#111)today · plumax#115

Where the chain ends

ExampleQuestionFirst modelWhat the misfit asked forWhat no model could supply
1 · RetrievalHow much gas in each pixel?Matched filterClean background, per-pixel sensitivity, saturationReal spectroscopy and surfaces outside the background
2 · QuantificationHow much is coming out?Mass enhancementA model of the image, then its directionThe wind speed
3 · PersistencyHow often, and how much in a year?Detection fractionThe source’s own clock, then its daily cycleThe hours nobody looks