Radiometry¶
What an instrument adds to Planck's law: the band-integrated Planck radiance
and the band brightness temperature that inverts it, by Newton with implicit
differentiation. Planck's law in wavenumber, its logarithm, its per-µm and
per-GHz views and the monochromatic brightness temperature are
radiomax's (radiomax.thermal).
radiomax's Planck function is held here to the checks that radtrax's own was
(gate TH12): the constants against the SI 2019 exact h, c and k, the
Stefan–Boltzmann law from the spectral integral, the Wien peaks, and pyradi's
ryplanck (radiance, derivatives and Widger–Woodall band integrals, rtol
1e-12). pyradi is never imported: scripts/make_planck_oracle.py evaluates
ryplanck.py at commit c7cfe9df96fdf0e6c258ee6fd624f62f19ebab06 (MIT licence
at the root, BSD-3 per file) in an isolated interpreter and stores the values,
with the commit, the NumPy and SciPy versions and SciPy's constants, in
tests/data/planck_pyradi_c7cfe9d.npz.
radiometry
¶
Band radiances and brightness temperatures through an instrument.
Planck's law in wavenumber, its views per µm and per GHz and the monochromatic
brightness temperature are radiomax.thermal's. What needs an instrument is
here: the Planck radiance of its bands, and its inverse (radtrax#248).
surface/ (emission), solvers/ (layer sources), instrument/
(NEΔT) and the retrievals all reach it; it depends on radiomax and
exceptions, and names Instrument for type checkers only (radtrax#246).
brightness¶
Band Planck radiance, and the band brightness temperature that inverts it.
radiomax.thermal holds the monochromatic functions: the Planck radiance
\(B(\tilde\nu, T)\) and its closed-form inverse \(T_b(\tilde\nu, L)\). This
module holds what an instrument adds.
An instrument is linear in radiance, \(y = A L\) with \(A\) its response matrix
(Instrument.response_matrix, (B, G)), so the band-integrated Planck
radiance at one temperature per band is
and the band brightness temperature solves \(\bar B_b(T_b) = y_b\) for every
band. The bands decouple (the Jacobian of the residual is diagonal), so
band_brightness_temperature runs optimistix.Newton with a diagonal
linear solve, from the monochromatic \(T_b\) at each band's centroid
\(\bar\nu_b = \sum_g A_{bg} \tilde\nu_g / \sum_g A_{bg}\), and is
differentiated by the implicit function theorem:
\(\partial T_b / \partial y_b = 1 / (\partial \bar B_b / \partial T_b)\) and
\(\partial T_b / \partial \theta = -(\partial \bar B_b / \partial \theta) /
(\partial \bar B_b / \partial T_b)\) for instrument parameters \(\theta\).
Every formula holds for any linear \(A\); the centroid divides by the row sum, so an instrument in other radiance units (rows that do not sum to 1) works in its own units. The dense \(A\) is materialised once per call, so band brightness temperature is for multispectral thermal bands (tens of bands); for a hyperspectral instrument use the monochromatic \(T_b\) at the centroid.
Shapes: G wavenumbers, B bands; *B means a scalar or (B,).
band_planck_radiance
¶
band_planck_radiance(instrument: Instrument, t_k: Float[ArrayLike, '*B']) -> Float[Array, ' B']
Band-integrated Planck radiance \(\bar B_b(T_b) = \sum_g A_{bg} B(\tilde\nu_g, T_b)\).
One temperature for every band (a scalar) is one instrument call,
instrument(planck_radiance(instrument.nu_cm, t_k)); one temperature
per band, (B,), contracts the response matrix with \(B\) on the
(B, G) grid. Differentiable in t_k and in the instrument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrument
|
Instrument
|
The bands, any |
required |
t_k
|
Float[ArrayLike, '*B']
|
Temperature [K], a scalar or one per band, |
required |
Returns:
| Type | Description |
|---|---|
Float[Array, ' B']
|
\(\bar B\) |
Float[Array, ' B']
|
(W m⁻² sr⁻¹ (cm⁻¹)⁻¹ for a response whose rows sum to 1). |
Examples:
>>> import jax.numpy as jnp
>>> from radtrax.instrument import GaussianInstrument
>>> nu = jnp.linspace(700.0, 1300.0, 1201)
>>> tir = GaussianInstrument(nu, jnp.array([10900.0]), jnp.array([500.0]))
>>> f"{float(band_planck_radiance(tir, 300.0)[0]):.4f}"
'0.1142'
Source code in src/radtrax/radiometry/brightness.py
band_brightness_temperature
¶
band_brightness_temperature(instrument: Instrument, y: Float[ArrayLike, ' B'], *, rtol: float = 1e-12, atol: float = 1e-10, max_steps: int = 32, throw: bool = True) -> Float[Array, ' B']
Band brightness temperature: the \(T_b\) with \(\bar B_b(T_b) = y_b\) [K].
Solves \(\ln \bar B_b(T_b) - \ln y_b = 0\) for every band by
optimistix.Newton, with a diagonal Jacobian (one JVP per step) and a
diagonal linear solve, from the monochromatic \(T_b\) at each band's
centroid. The residual is taken in log radiance so that the tolerances
mean the same at 0.4 µm and at 15 µm; it has the same root and the same
implicit derivatives as \(\bar B_b - y_b\). The unknown is \(u = \ln T_b\),
so no Newton step can leave \(T_b > 0\): in \(T\) a broad band's first step
from the centroid guess can overshoot below 0 K. Gradients come from the
implicit function theorem (optimistix.ImplicitAdjoint), in y and in
the instrument's parameters alike.
A band with \(y_b \le 0\) has no brightness temperature: it is solved on a safe value and returned as NaN (double where), so a masked band does not poison the gradient of the others.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrument
|
Instrument
|
The bands, any |
required |
y
|
Float[ArrayLike, ' B']
|
Band values, |
required |
rtol
|
float
|
Relative tolerance of the Newton solve in \(\ln T\). |
1e-12
|
atol
|
float
|
Absolute tolerance of the Newton solve (in \(\ln T\) and in the log residual). |
1e-10
|
max_steps
|
int
|
The most Newton steps. |
32
|
throw
|
bool
|
Raise when the solve fails to converge
( |
True
|
Returns:
| Type | Description |
|---|---|
Float[Array, ' B']
|
\(T_b\) [K], |
Examples:
>>> import jax.numpy as jnp
>>> from radtrax.instrument import GaussianInstrument
>>> nu = jnp.linspace(700.0, 1300.0, 1201)
>>> tir = GaussianInstrument(nu, jnp.array([10900.0]), jnp.array([500.0]))
>>> y = band_planck_radiance(tir, 300.0)
>>> round(float(band_brightness_temperature(tir, y)[0]), 9)
300.0
Source code in src/radtrax/radiometry/brightness.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | |