simpeg.regularization.SmoothnessSecondOrder#
- class simpeg.regularization.SmoothnessSecondOrder(mesh, orientation='x', reference_model_in_smooth=False, **kwargs)[source]#
- Bases: - SmoothnessFirstOrder- Second-order smoothness (flatness) least-squares regularization. - SmoothnessSecondOrderregularization is used to ensure that values in the recovered model have small second-order spatial derivatives. When a reference model is included, the regularization preserves second-order smoothness within the reference model along the direction specified (x, y or z). Optionally, custom cell weights can be used to control the degree of smoothness being enforced throughout different regions the model.- See the Notes section below for a comprehensive description. - Parameters:
- meshdiscretize.base.BaseMeshmesh
- The mesh on which the regularization is discretized. 
- orientation{‘x’, ‘y’, ‘z’}
- The direction along which smoothness is enforced. 
- active_cellsNone, (n_cells, )numpy.ndarrayofbool
- Boolean array defining the set of - RegularizationMeshcells that are active in the inversion. If- None, all cells are active.
- mappingNone,simpeg.maps.BaseMap
- The mapping from the model parameters to the active cells in the inversion. If - None, the mapping is the identity map.
- reference_modelNone, (n_param, )numpy.ndarray
- Reference model. If - None, the reference model in the inversion is set to the starting model. To include the reference model in the regularization, the reference_model_in_smooth property must be set to- True.
- reference_model_in_smoothbool, optional
- Whether to include the reference model in the smoothness regularization. 
- unitsNone,str
- Units for the model parameters. Some regularization classes behave differently depending on the units; e.g. ‘radian’. 
- weightsNone,dict
- Weight multipliers to customize the least-squares function. Each key points to a (n_cells, ) numpy.ndarray that is defined on the - regularization.RegularizationMesh.
 
- mesh
 - Attributes - Weighting matrix. - Active cells defined on the regularization mesh. - Partial cell gradient operator. - Mapping from the inversion model parameters to the regularization mesh. - The model parameters. - Number of model parameters. - Direction along which smoothness is enforced. - The parent objective function - Reference model. - Regularization mesh. - Units for the model parameters. - Return the keys for the existing cell weights - reference_model_in_smooth - 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)- Evaluate the regularization kernel function. - f_m_deriv(m)- Derivative of the regularization kernel function. - 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, random_seed])- Run a convergence test on both the first and second derivatives. - Notes - We define the regularization function (objective function) for second-order smoothness along the x-direction as: \[\phi (m) = \int_\Omega \, w(\mathbf{r}) \, \left\lvert \frac{\partial^2 m(\mathbf{r})}{\partial x^2} \right\rvert^2 \, d\mathbf{r}\]- where \(m(\mathbf{r})\) is the model, and \(w(\mathbf{r})\) is a user-defined weighting function. - For the implementation within SimPEG, the regularization function and its variables must be discretized onto a mesh. The discretized approximation for the regularization function (objective function) is expressed in linear form as: \[\phi (\mathbf{m}) = \sum_i \tilde{w}_i \, \left\lvert \, \frac{\partial^2 m_i}{\partial x^2} \, \right\rvert^2\]- where \(m_i \in \mathbf{m}\) are the discrete model parameter values defined on the mesh, and \(\tilde{w}_i \in \mathbf{\tilde{w}}\) are amalgamated weighting constants that: - account for cell dimensions in the discretization, and 
- apply any user-defined weighting. 
 - This is equivalent to an objective function of the form: \[\phi (\mathbf{m}) = \left\lVert \mathbf{W} \mathbf{L_x} \mathbf{m} \right\rVert^2\]- where \(\mathbf{m}\) is the model vector, \(\mathbf{L_x}\) is the second-order derivative operator with respect to \(x\), and \(\mathbf{W}\) is the weighting matrix. - Reference model in smoothness: - Second-order smoothness within a discrete reference model \(\mathbf{m}^\text{ref}\) can be preserved by including the reference model the smoothness regularization function. In this case, the objective function becomes: \[\phi(\mathbf{m}) = \left\lVert \mathbf{W L_x} \left[ \mathbf{m} - \mathbf{m}^\text{ref} \right] \right\rVert^2\]- This functionality is used by setting a reference model with the reference_model property, and by setting the reference_model_in_smooth parameter to - True.- Mapping function: - In case make use of a mapping function \(\mu\) that maps values of the model into a different space, then the regularization function for second-order smoothness along the x-direction as: \[\phi (m) = \int_\Omega \, w(\mathbf{r}) \, \left\lvert \frac{\partial^2}{\partial x^2} \left[ \mu(m) - \mu(m^\text{ref}) \right] \right\rvert^2 \, d\mathbf{r}\]- In matrix form, the previous equation is expressed as: \[\phi (\mathbf{m}) = \left\lVert \mathbf{W} \mathbf{L_x} \left[ \mu(\mathbf{m}) - \mu(\mathbf{m}^\text{ref}) \right] \right\rVert^2.\]- Custom weights and the weighting matrix: - Let \(\mathbf{w_1, \; w_2, \; w_3, \; ...}\) each represent an optional set of custom cell weights. The weighting applied within the objective function is given by: \[\mathbf{\tilde{w}} = \mathbf{v} \odot \prod_j \mathbf{w_j}\]- where \(\mathbf{v}\) are the cell volumes. The weighting matrix used to apply the weights is given by: \[\mathbf{W} = \textrm{diag} \Big ( \, \mathbf{\tilde{w}}^{1/2} \Big )\]- Each set of custom cell weights is stored within a - dictas an (n_cells, )- numpy.ndarray. The weights can be set all at once during instantiation with the weights keyword argument as follows:- >>> reg = SmoothnessSecondOrder(mesh, weights={'weights_1': array_1, 'weights_2': array_2}) - or set after instantiation using the set_weights method: - >>> reg.set_weights(weights_1=array_1, weights_2=array_2}) 
