inversion_ideas.WrappedSimulation#

class inversion_ideas.WrappedSimulation(simulation, *, store_jacobian=False, cache_fields=True, cache=True)#

Wrapper of SimPEG’s simulations.

Allows to use SimPEG simulations in the new framework, extending them to be compatible with the inversion_ideas.base.Simulation interface.

Important

This class is meant to be a glue between current SimPEG simulations and the new framework. The ultimate goal is to make SimPEG simulations compatible with this framework. After that, this class will become obsolete and we’ll be able to remove it.

Parameters:
simulationobject

Instance of a SimPEG simulation.

store_jacobianbool, optional

Whether to store the jacobian matrix as a dense or sparse matrix. If False, the jacobian() method will return a LinearOperator that calls the Jvec and Jtvec methods of the SimPEG simulation. Default to False.

cache_fieldsbool, optional

Whether to cache fields within the simulation or not. If True, the fields in PDE-based SimPEG simualtions will be cached within the WrappedSimulation object to avoid recomputing them when the object gets called, or an operation with the Jacobian matrix is performed. Default to True.

cachebool, optional

Whether to cache the last result of the __call__() and jacobian() methods. Default to True.

Attributes

n_data

Number of data values.

n_params

Number of model parameters.

Methods

__call__(model)

Evaluate simulation for a given model.

jacobian(model)

Jacobian matrix for a given model.

Attributes#

WrappedSimulation.n_data#

Number of data values.

WrappedSimulation.n_params#

Number of model parameters.

Methods#

Methods documentation

WrappedSimulation.__call__(model)#

Evaluate simulation for a given model.

Parameters:
model(n_params) array

Array with model parameters.

Returns:
(n_data) array

Array with predicted data for the given model.


WrappedSimulation.jacobian(model)#

Jacobian matrix for a given model.

Parameters:
model(n_params) array

Array with model parameters.

Returns:
(n_data, n_params) array or LinearOperator

2D dense or sparse array or a LinearOperator that represents the Jacobian matrix: the matrix of first derivatives of the forward model with respect to each model parameter. If store_jacobian is True, a dense or sparse array will be returned. Otherwise, a LinearOperator will be returned.