simpeg.regularization.BaseRegularization.get_weights#
- BaseRegularization.get_weights(key)[source]#
Cell weights for a given key.
- Parameters:
- key: str
Name of the weights requested.
- Returns:
- (
n_cells
, )numpy.ndarray
Cell weights for a given key.
- (
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.])