Regularization stores the model-structure penalty vocabulary shared by
built-in, SimPEG, and pyGIMLi inversion paths. The residual helpers operate on
model-parameter arrays, usually log-domain resistivity values, and return
unweighted structure residuals that can be multiplied by a global scalar such
as \(\sqrt{\lambda}\).
For a smooth model \(m\), the penalty contains finite differences such as
For damped/reference regularization, a smallness term
\(\alpha_s\|m-m_{ref}\|_2^2\) is added. For "blocky" models, the
finite differences are normalized by
\(\sqrt{(\Delta m)^2 + \epsilon^2}\) to reduce sensitivity to sharp
edges.
Parameters:
kind ({"none", "smooth", "damped", "blocky"}, default "smooth") – Regularization family. "none" disables the penalty, "smooth"
penalizes model roughness, "damped" combines smallness/reference and
roughness terms, and "blocky" applies an edge-preserving normalized
gradient penalty.
alpha_s (float, default 1.0) – Smallness or reference-model weight. This controls residual terms of the
form \(m - m_{ref}\) when damping/reference regularization is active.
alpha_x (float, default 1.0) – Lateral roughness weight applied along the profile or X axis.
alpha_z (float, default 1.0) – Vertical roughness weight applied along the depth or Z axis.
reference_weight (float, default 0.0) – Extra multiplier for the reference-model term. When a reference model is
provided, values below one are promoted to one for damped/smallness terms.
metadata (dict, optional) – Free-form provenance metadata attached to the regularization settings.
Notes
This class stores relative penalty settings only. The scalar objective weight
is read separately by regularization_weight(), while pyGIMLi-specific
lambda handling is read by pygimli_lambda().
Examples
Build a smoothness penalty for a 2-D log-resistivity model:
Return unweighted residual terms for smooth/damped/blocky penalties.
values are normally log-domain model parameters. The returned vector
already contains the square-root alpha factors; callers can multiply by
a global scalar such as sqrt(regularization_weight).
Parameters:
values (array-like) – Model parameter array. One-dimensional arrays are treated as depth
profiles. Two-dimensional arrays are treated as (z,x) sections.
reference (array-like, optional) – Reference model with the same shape as values or broadcastable to
that shape.
regularization (Regularization, optional) – Regularization settings. If omitted, Regularization() is used.
blocky_eps (float, default 1e-2) – Stabilization value in the blocky normalized-gradient penalty.
axes (tuple of {"x", "z"}, optional) – Axes on which to compute roughness. Defaults to ("z",) for 1-D
arrays and ("x","z") for 2-D or higher arrays.
Returns:
Concatenated residual vector. Empty when kind="none" or all active
penalty terms have zero weight.