SimPEG.regularization.SmoothnessFullGradient#

class SimPEG.regularization.SmoothnessFullGradient(mesh, alphas=None, reg_dirs=None, ortho_check=True, **kwargs)[source]#

Bases: BaseRegularization

Measures the gradient of a model using optionally anisotropic weighting.

This regularizer measures the first order smoothness in a mesh ambivalent way by observing that the N-d smoothness operator can be represented as an inner product with an arbitrarily anisotropic weight.

By default it assumes uniform weighting in each dimension, which works for most discretize mesh types.

Parameters:
meshdiscretize.BaseMesh

The mesh object to use for regularization. The mesh should either have a cell_gradient or a stencil_cell_gradient defined.

alphas(mesh.dim,) or (mesh.n_cells, mesh.dim) array_like of float, optional.

The weights of the regularization for each axis. This can be defined for each cell in the mesh. Default is uniform weights equal to the smallest edge length squared.

reg_dirs(mesh.dim, mesh.dim) or (mesh.n_cells, mesh.dim, mesh.dim) array_like of float

Matrix or list of matrices whose columns represent the regularization directions. Each matrix should be orthonormal. Default is Identity.

ortho_checkbool, optional

Whether to check reg_dirs for orthogonality.

**kwargs

Keyword arguments passed to the parent class BaseRegularization.

Notes

The regularization object is the discretized form of the continuous regularization

..math:

f(m) = int_V nabla m cdot mathbf{a} nabla m hspace{5pt} partial V

The tensor quantity a is used to represent the potential preferential directions of regularization. a must be symmetric positive semi-definite with an eigendecomposition of:

..math:

mathbf{a} = mathbf{Q}mathbf{L}mathbf{Q}^{-1}

Q is then the regularization directions reg_dirs, and L is represents the weighting along each direction, with alphas along its diagonal. These are multiplied to form the anisotropic alpha used for rotated gradients.

Examples

Construct of 2D measure with uniform smoothing in each direction.

>>> from discretize import TensorMesh
>>> from SimPEG.regularization import SmoothnessFullGradient
>>> mesh = TensorMesh([32, 32])
>>> reg = SmoothnessFullGradient(mesh)

We can instead create a measure that smooths twice as much in the 1st dimension than it does in the second dimension. >>> reg = SmoothnessFullGradient(mesh, [2, 1])

The alphas parameter can also be indepenant for each cell. Here we set all cells lower than 0.5 in the x2 to twice as much in the first dimension otherwise it is uniform smoothing. >>> alphas = np.ones((mesh.n_cells, mesh.dim)) >>> alphas[mesh.cell_centers[:, 1] < 0.5] = [2, 1] >>> reg = SmoothnessFullGradient(mesh, alphas)

We can also rotate the axis in which we want to preferentially smooth. Say we want to smooth twice as much along the +x1,+x2 diagonal as we do along the -x1,+x2 diagonal, effectively rotating our smoothing 45 degrees. Note and the columns of the matrix represent the directional vectors (not the rows). >>> sqrt2 = np.sqrt(2) >>> reg_dirs = np.array([ … [sqrt2, -sqrt2], … [sqrt2, sqrt2], … ]) >>> reg = SmoothnessFullGradient(mesh, alphas, reg_dirs=reg_dirs)

Attributes

W

The inner product operator using rotated coordinates

active_cells

Active cells defined on the regularization mesh.

cell_gradient

The (approximate) cell gradient operator

cell_weights

Deprecated property for 'volume' and user defined weights.

indActive

active_cells.indActive has been deprecated.

mapping

Mapping from the inversion model parameters to the regularization mesh.

model

The model parameters.

mref

reference_model.mref has been deprecated.

nP

Number of model parameters.

parent

The parent objective function

reference_model

Reference model.

regmesh

regularization_mesh.regmesh has been deprecated.

regularization_mesh

Regularization mesh.

units

Units for the model parameters.

weights_keys

Return the keys for the existing cell weights

Methods

__call__(m)

Evaluate the regularization function for the model provided.

deriv(m)

Gradient of the regularization function evaluated for the model provided.

deriv2(m[, v])

Hessian of the regularization function evaluated for the model provided.

f_m(m)

Not implemented for BaseRegularization class.

f_m_deriv(m)

Not implemented for BaseRegularization class.

get_weights(key)

Cell weights for a given key.

map_class

alias of IdentityMap

remove_weights(key)

Removes the weights for the key provided.

set_weights(**weights)

Adds (or updates) the specified weights to the regularization.

test([x, num])

Run a convergence test on both the first and second derivatives.