simpeg.maps.SurjectUnits#

class simpeg.maps.SurjectUnits(indices, **kwargs)[source]#

Bases: IdentityMap

Surjective mapping to all mesh cells.

Let \(\mathbf{m}\) be a model that contains a physical property value for nP geological units. SurjectUnits is used to construct a surjective mapping that projects \(\mathbf{m}\) to the set of voxel cells defining a mesh. As a result, the mapping \(\mathbf{u(\mathbf{m})}\) is defined as a projection matrix \(\mathbf{P}\) acting on the model. Thus:

\[\mathbf{u}(\mathbf{m}) = \mathbf{Pm}\]

The mapping therefore has dimensions (mesh.nC, nP).

Parameters:
indices(nP) list of (mesh.nC) numpy.ndarray

Each entry in the list is a boolean numpy.ndarray of length mesh.nC that assigns the corresponding physical property value to the appropriate mesh cells.

Examples

For this example, we have a model that defines the property values for two units. Using SurjectUnit, we construct the mapping from the model to a 1D mesh where the 1st unit’s value is assigned to all cells whose centers are located at x < 0 and the 2nd unit’s value is assigned to all cells whose centers are located at x > 0.

>>> from simpeg.maps import SurjectUnits
>>> from discretize import TensorMesh
>>> import numpy as np
>>> nP = 8
>>> mesh = TensorMesh([np.ones(nP)], 'C')
>>> unit_1_ind = mesh.cell_centers < 0
>>> indices_list = [unit_1_ind, ~unit_1_ind]
>>> mapping = SurjectUnits(indices_list, nP=nP)
>>> m = np.r_[0.01, 0.05]
>>> mapping * m
array([0.01, 0.01, 0.01, 0.01, 0.05, 0.05, 0.05, 0.05])

Attributes

P

Projection matrix from model parameters to mesh cells.

indices

List assigning a given physical property to specific model cells.

is_linear

Determine whether or not this mapping is a linear operation.

mesh

The mesh used for the mapping

nP

Number of parameters the mapping acts on.

shape

Dimensions of the mapping

Methods

deriv(m[, v])

Derivative of the mapping with respect to the input parameters.

dot(map1)

Multiply two mappings to create a simpeg.maps.ComboMap.

inverse(D)

The transform inverse is not implemented.

test([m, num, random_seed])

Derivative test for the mapping.

Galleries and Tutorials using simpeg.maps.SurjectUnits#

Maps: ComboMaps

Maps: ComboMaps