Point processes¶
The intensity and probability-of-detection registries as xtremax.point_processes processes: an inhomogeneous Poisson ground process per intensity kernel, a POD curve as a thinning retention, and the detected-event process ThinningProcess(MarkedTemporalPointProcess(...)). xtremax supplies the likelihoods and samplers; plumax supplies the methane-domain kernels. Needs the population extra. Tier V.
processes
¶
Registry intensities and POD curves as xtremax point processes (implementation in plumax.population._src.processes).
LogIntensity
¶
LogIntensity(intensity: Callable[[Array], Array], origin: ArrayLike = 0.0, n_integration_points: int = NODES_PER_DAY + 1)
Bases: Module
A registry intensity as an xtremax log-intensity on window time.
log λ̃(s) = log λ(t₀ + s), with s ∈ [0, T] the time since the window start t₀ in days, so the seasonal and diurnal phases of the kernel stay tied to calendar days.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intensity
|
Callable[[Array], Array]
|
A kernel from :mod: |
required |
origin
|
ArrayLike
|
Window start t₀ [days]. |
0.0
|
n_integration_points
|
int
|
Simpson nodes for the compensator when the kernel has no closed form. |
NODES_PER_DAY + 1
|
Examples:
>>> import jax.numpy as jnp
>>> from plumax.population.intensity import ConstantIntensity
>>> log_intensity = LogIntensity(ConstantIntensity(lambda_0=2.0), origin=0.0)
>>> bool(jnp.allclose(log_intensity(jnp.zeros(3)), jnp.log(2.0)))
True
>>> float(log_intensity.integrate(0.0, 3.0))
6.0
Source code in src/plumax/population/_src/processes.py
integrate
¶
Compensator Λ̃(b) − Λ̃(a) = ∫ₐᵇ λ(t₀ + s) ds.
The kernel's own integrate when it has one (exact), else composite
Simpson quadrature through xtremax.point_processes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
ArrayLike
|
Lower limit a [days since t₀]. |
required |
stop
|
ArrayLike
|
Upper limit b [days since t₀]. |
required |
Returns:
| Type | Description |
|---|---|
Float[Array, '*time']
|
Expected event count on |
Raises:
| Type | Description |
|---|---|
ImportError
|
Without the |
Source code in src/plumax/population/_src/processes.py
max_intensity
¶
PODRetention
¶
PODRetention(pod: Callable[..., Array], covariates: Mapping[str, ArrayLike] | None = None, mark_scale: float = 1.0)
Bases: Module
A probability-of-detection curve as an xtremax retention callable.
p(t, H, Q) = P_d(c · Q; covariates), with c converting the mark units to the POD's flux units (the registry PODs take kg/h, so c = 3600 for marks in kg/s). Time and history are ignored: detection depends on the mark alone.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pod
|
Callable[..., Array]
|
A model from :mod: |
required |
covariates
|
Mapping[str, ArrayLike] | None
|
Fixed keyword covariates of the POD beyond the flux (wind
speed |
None
|
mark_scale
|
float
|
The factor c from mark units to the POD's flux units. |
1.0
|
Examples:
>>> import jax.numpy as jnp
>>> from plumax.population.pod import LogLogisticPOD
>>> retention = PODRetention(LogLogisticPOD(beta_0=0.0, beta_1=2.0))
>>> float(retention(0.0, None, jnp.asarray(1.0)))
0.5
Source code in src/plumax/population/_src/processes.py
detection_process
¶
detection_process(ground: Any, mark_distribution: Any, retention: Callable[..., Array], *, n_integration_points: int | None = None) -> Any
The detected-event process: POD-thinned, marked ground process.
λ_det(t, Q) = p(t, H, Q) · λ(t) · f(Q), as
ThinningProcess(MarkedTemporalPointProcess(ground, f), p).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ground
|
Any
|
The ground process, e.g. from :func: |
required |
mark_distribution
|
Any
|
The mark law f(Q), a NumPyro distribution. |
required |
retention
|
Callable[..., Array]
|
The retention p, e.g. a :class: |
required |
n_integration_points
|
int | None
|
Trapezoid nodes of the retention compensator. Default: the ground process's own. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
|
Any
|
|
Any
|
retention over f by Monte Carlo inside the compensator (xtremax's |
Any
|
|
Raises:
| Type | Description |
|---|---|
ImportError
|
Without the |
Source code in src/plumax/population/_src/processes.py
expected_events_by_tod_bin
¶
expected_events_by_tod_bin(intensity: Callable[[Array], Array], start: float, stop: float, *, n_bins: int, tod_origin: float = 0.0, nodes_per_day: int = NODES_PER_DAY) -> Float[Array, ' bin']
Expected events in each hour-of-day bin over a time interval.
Λ_b = Σ_c ∫_c λ(t) dt, over the cells c of [start, stop] that fall in bin b.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intensity
|
Callable[[Array], Array]
|
The rate λ(t) [events per day]. |
required |
start
|
float
|
Start of the interval [days]. |
required |
stop
|
float
|
End of the interval [days]. |
required |
n_bins
|
int
|
Bins per day. |
required |
tod_origin
|
float
|
Local hour of day at t = 0 [hours]. |
0.0
|
nodes_per_day
|
int
|
Simpson nodes per day, without an exact |
NODES_PER_DAY
|
Returns:
| Type | Description |
|---|---|
Float[Array, ' bin']
|
Λ_b for each bin. |
Source code in src/plumax/population/_src/processes.py
make_process
¶
make_process(intensity: str | Module, window: tuple[float, float], *, nodes_per_day: int = NODES_PER_DAY, **params: Any) -> Any
An xtremax inhomogeneous Poisson process for a registry intensity.
N(t) on s ∈ [0, T], T = t₁ − t₀, with log-intensity log λ(t₀ + s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intensity
|
str | Module
|
A registry name (see
:data: |
required |
window
|
tuple[float, float]
|
|
required |
nodes_per_day
|
int
|
Quadrature density for kernels without a closed-form compensator. |
NODES_PER_DAY
|
**params
|
Any
|
Kernel parameters, when |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
|
Any
|
class: |
Any
|
t₀ (see :func: |
Raises:
| Type | Description |
|---|---|
KeyError
|
For an unknown registry name. |
ValueError
|
For an empty window, parameters passed with an instance,
or the Weibull renewal hazard (a renewal process, not a Poisson
intensity: use |
ImportError
|
Without the |
Examples:
>>> import jax.numpy as jnp
>>> process = make_process("constant", (0.0, 10.0), lambda_0=0.5)
>>> times = jnp.array([1.0, 4.0, 10.0])
>>> mask = jnp.array([True, True, False])
>>> bool(jnp.allclose(process.log_prob(times, mask), 2 * jnp.log(0.5) - 5.0))
True
Source code in src/plumax/population/_src/processes.py
padded_event_buffer
¶
padded_event_buffer(times: ArrayLike | Sequence[float], window: tuple[float, float], *, max_events: int | None = None) -> tuple[Float[Array, ' event'], Bool[Array, ' event']]
Detection times as xtremax's padded buffer on window time.
Sorts s_i = t_i − t₀, pads to max_events with T = t₁ − t₀ and returns
the mask, which is a contiguous prefix of True.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
ArrayLike | Sequence[float]
|
Detection times t_i [days]. |
required |
window
|
tuple[float, float]
|
|
required |
max_events
|
int | None
|
Buffer length. Default: the number of events. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[Float[Array, ' event'], Bool[Array, ' event']]
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If a time lies outside the window or the buffer is too short. |
Examples:
>>> event_times, mask = padded_event_buffer([3.0, 1.0], (0.0, 5.0), max_events=3)
>>> event_times.tolist(), mask.tolist()
([1.0, 3.0, 5.0], [True, True, False])