SimPEG.regularization.BaseRegularization.set_weights#

BaseRegularization.set_weights(**weights)[source]#

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

Parameters:
**kwargskey, numpy.ndarray

Each keyword argument is added to the weights used by the regularization. They can be accessed with their keyword argument.

Examples

>>> import discretize
>>> from SimPEG.regularization import Smallness
>>> mesh = discretize.TensorMesh([2, 3, 2])
>>> reg = Smallness(mesh)
>>> reg.set_weights(my_weight=np.ones(mesh.n_cells))
>>> reg.get_weights('my_weight')
array([1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.])