Gravity

The gravity problem uses an integral equation approach for solving the forward and inverse problem. This module supports both gravity and gravity gradient modeling.

Gravity Integral eq. approach

class SimPEG.potential_fields.gravity.Simulation3DIntegral(*args, **kwargs)[source]

Bases: SimPEG.potential_fields.base.BasePFSimulation

Gravity simulation in integral form.

Required Properties:

  • actInd (Array): Array of active cells (ground), a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

  • counter (Counter): A SimPEG.utils.Counter object, an instance of Counter

  • mesh (BaseMesh): a discretize mesh instance, an instance of BaseMesh

  • sensitivity_path (String): path to store the sensitivty, a unicode string, Default: ./sensitivity/

  • None

  • solver_opts (Dictionary): solver options as a kwarg dict, a dictionary

  • store_sensitivities (StringChoice): Compute and store G, any of “disk”, “ram”, “forward_only”, Default: ram

  • survey (BaseSurvey): a survey object, an instance of BaseSurvey

Optional Properties:

  • linear_model (PhysicalProperty): The model for a linear problem, a physical property

  • model (Model): Inversion model., a numpy array of <class ‘float’>, <class ‘int’> with shape (*, *) or (*)

  • model_map (Mapping): Mapping of The model for a linear problem to the inversion model., a SimPEG Map

  • rho (PhysicalProperty): Physical property, a physical property, Default: 1.0

  • rhoMap (Mapping): Mapping of Physical property to the inversion model., a SimPEG Map

Other Properties:

  • model_deriv (Derivative): Derivative of The model for a linear problem wrt the model.

  • rhoDeriv (Derivative): Derivative of Physical property wrt the model.

property rho

Physical property

property rhoMap

Mapping of Physical property to the inversion model.

property rhoDeriv

Derivative of Physical property wrt the model.

fields(m)[source]

u = fields(m) The field given the model. :param numpy.ndarray m: model :rtype: numpy.ndarray :return: u, the fields

getJtJdiag(m, W=None)[source]

Return the diagonal of JtJ

getJ(m, f=None)[source]

Sensitivity matrix

Jvec(m, v, f=None)[source]

Sensitivity times a vector

Jtvec(m, v, f=None)[source]

Sensitivity transposed times a vector

property G

Gravity forward operator

property gtg_diagonal

Diagonal of GtG

evaluate_integral(receiver_location, components)[source]

Compute the forward linear relationship between the model and the physics at a point and for every components of the survey.

Parameters
  • receiver_location (numpy.ndarray) – array with shape (n_receivers, 3) Array of receiver locations as x, y, z columns.

  • components (list[str]) – List of gravity components chosen from: ‘gx’, ‘gy’, ‘gz’, ‘gxx’, ‘gxy’, ‘gxz’, ‘gyy’, ‘gyz’, ‘gzz’, ‘guv’

Rtype numpy.ndarray

rows

Returns

ndarray with shape (n_components, n_cells) Dense array mapping of the contribution of all active cells to data components:

rows =
    g_1 = [g_1x g_1y g_1z]
    g_2 = [g_2x g_2y g_2z]
           ...
    g_c = [g_cx g_cy g_cz]

Jtvec_approx(m, v, f=None)[source]

Approximate effect of transpose of J(m) on a vector v. :param numpy.ndarray m: model :param numpy.ndarray v: vector to multiply :param Fields f: fields :rtype: numpy.ndarray :return: JTv

Jvec_approx(m, v, f=None)[source]

Approximate effect of J(m) on a vector v :param numpy.ndarray m: model :param numpy.ndarray v: vector to multiply :param Fields f: fields :rtype: numpy.ndarray :return: approxJv

property Solver

Solver has been deprecated. See simulation.solver for documentation

property actInd

actInd (Array): Array of active cells (ground), a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

clean_on_model_update = []
property counter

counter (Counter): A SimPEG.utils.Counter object, an instance of Counter

deleteTheseOnModelUpdate = []
classmethod deserialize(value, trusted=False, strict=False, assert_valid=False, **kwargs)[source]

Creates HasProperties instance from serialized dictionary

This uses the Property deserializers to deserialize all JSON-compatible dictionary values into their corresponding Property values on a new instance of a HasProperties class. Extra keys in the dictionary that do not correspond to Properties will be ignored.

Parameters:

  • value - Dictionary to deserialize new instance from.

  • trusted - If True (and if the input dictionary has '__class__' keyword and this class is in the registry), the new HasProperties class will come from the dictionary. If False (the default), only the HasProperties class this method is called on will be constructed.

  • strict - Requires '__class__', if present on the input dictionary, to match the deserialized instance’s class. Also disallows unused properties in the input dictionary. Default is False.

  • assert_valid - Require deserialized instance to be valid. Default is False.

  • Any other keyword arguments will be passed through to the Property deserializers.

dpred(m, f=None)[source]

Create the projected data from a model. The fields, f, (if provided) will be used for the predicted data instead of recalculating the fields (which may be expensive!).

\[d_\text{pred} = P(f(m))\]

Where P is a projection of the fields onto the data space.

equal(other)[source]

Determine if two HasProperties instances are equivalent

Equivalence is determined by checking if all Property values on two instances are equal, using Property.equal.

property forwardOnly

The forwardOnly property has been deprecated. Please set the store_sensitivites property instead. This will be removed in version 0.15.0 of SimPEG

property linear_model

The model for a linear problem

linear_operator()[source]
make_synthetic_data(m, relative_error=0.05, noise_floor=0.0, f=None, add_noise=False, **kwargs)[source]

Make synthetic data given a model, and a standard deviation. :param numpy.ndarray m: geophysical model :param numpy.ndarray relative_error: standard deviation :param numpy.ndarray noise_floor: noise floor :param numpy.ndarray f: fields for the given model (if pre-calculated)

property mesh

mesh (BaseMesh): a discretize mesh instance, an instance of BaseMesh

property model

model (Model): Inversion model., a numpy array of <class ‘float’>, <class ‘int’> with shape (*, *) or (*)

property model_deriv

Derivative of The model for a linear problem wrt the model.

property model_map

Mapping of The model for a linear problem to the inversion model.

property n_cpu

The parallelized property has been removed. If interested, try out loading dask for parallelism by doing import SimPEG.dask. This will be removed in version 0.15.0 of SimPEG

property needs_model

True if a model is necessary

pair(survey)[source]

Deprecated pairing method. Please use simulation.survey=survey instead

property parallelized

The parallelized property has been removed. If interested, try out loading dask for parallelism by doing import SimPEG.dask. This will be removed in version 0.15.0 of SimPEG

residual(m, dobs, f=None)[source]

The data residual:

\[\mu_\text{data} = \mathbf{d}_\text{pred} - \mathbf{d}_\text{obs}\]
Parameters
Return type

numpy.ndarray

Returns

data residual

property sensitivity_path

sensitivity_path (String): path to store the sensitivty, a unicode string, Default: ./sensitivity/

serialize(include_class=True, save_dynamic=False, **kwargs)[source]

Serializes a HasProperties instance to dictionary

This uses the Property serializers to serialize all Property values to a JSON-compatible dictionary. Properties that are undefined are not included. If the HasProperties instance contains a reference to itself, a properties.SelfReferenceError will be raised.

Parameters:

  • include_class - If True (the default), the name of the class will also be saved to the serialized dictionary under key '__class__'

  • save_dynamic - If True, dynamic properties are written to the serialized dict (default: False).

  • Any other keyword arguments will be passed through to the Property serializers.

property solver

None

property solverOpts

solverOpts has been deprecated. See solver_opts for documentation

property solver_opts

solver_opts (Dictionary): solver options as a kwarg dict, a dictionary

property store_sensitivities

store_sensitivities (StringChoice): Compute and store G, any of “disk”, “ram”, “forward_only”, Default: ram

summary()[source]
property survey

survey (BaseSurvey): a survey object, an instance of BaseSurvey

validate()[source]

Call all registered class validator methods

These are all methods decorated with @properties.validator. Validator methods are expected to raise a ValidationError if they fail.

Gravity Survey

class SimPEG.potential_fields.gravity.Survey(*args, **kwargs)[source]

Bases: SimPEG.survey.BaseSurvey

Base Gravity Survey

Required Properties:

  • counter (Counter): A SimPEG counter object, an instance of Counter

  • source_list (a list of BaseSrc): A list of sources for the survey, a list (each item is an instance of BaseSrc)

rxType = None

receiver type

eval(fields)[source]
property nRx
property receiver_locations

receiver locations

property nD

Number of data

property components
property Qfx
property Qfy
property Qfz
property counter

counter (Counter): A SimPEG counter object, an instance of Counter

classmethod deserialize(value, trusted=False, strict=False, assert_valid=False, **kwargs)[source]

Creates HasProperties instance from serialized dictionary

This uses the Property deserializers to deserialize all JSON-compatible dictionary values into their corresponding Property values on a new instance of a HasProperties class. Extra keys in the dictionary that do not correspond to Properties will be ignored.

Parameters:

  • value - Dictionary to deserialize new instance from.

  • trusted - If True (and if the input dictionary has '__class__' keyword and this class is in the registry), the new HasProperties class will come from the dictionary. If False (the default), only the HasProperties class this method is called on will be constructed.

  • strict - Requires '__class__', if present on the input dictionary, to match the deserialized instance’s class. Also disallows unused properties in the input dictionary. Default is False.

  • assert_valid - Require deserialized instance to be valid. Default is False.

  • Any other keyword arguments will be passed through to the Property deserializers.

dpred(m=None, f=None)[source]
equal(other)[source]

Determine if two HasProperties instances are equivalent

Equivalence is determined by checking if all Property values on two instances are equal, using Property.equal.

getSourceIndex(sources)[source]
makeSyntheticData(m, std=None, f=None, force=False, **kwargs)[source]
property nSrc

Number of Sources

pair(simulation)[source]
projectFields(u)[source]

This function projects the fields onto the data space.

First we project our B on to data location

\[\mathbf{B}_{rec} = \mathbf{P} \mathbf{B}\]

then we take the dot product between B and b_0

\[\text{TMI} = \vec{B}_s \cdot \hat{B}_0\]
serialize(include_class=True, save_dynamic=False, **kwargs)[source]

Serializes a HasProperties instance to dictionary

This uses the Property serializers to serialize all Property values to a JSON-compatible dictionary. Properties that are undefined are not included. If the HasProperties instance contains a reference to itself, a properties.SelfReferenceError will be raised.

Parameters:

  • include_class - If True (the default), the name of the class will also be saved to the serialized dictionary under key '__class__'

  • save_dynamic - If True, dynamic properties are written to the serialized dict (default: False).

  • Any other keyword arguments will be passed through to the Property serializers.

property source_list

source_list (a list of BaseSrc): A list of sources for the survey, a list (each item is an instance of BaseSrc)

property srcList

srcList has been deprecated. See source_list for documentation

validate()[source]

Call all registered class validator methods

These are all methods decorated with @properties.validator. Validator methods are expected to raise a ValidationError if they fail.

property vnD

Vector number of data

Gravity Source

class SimPEG.potential_fields.gravity.SourceField(*args, **kwargs)[source]

Bases: SimPEG.survey.BaseSrc

Define the inducing field

Required Properties:

  • receiver_list (a list of BaseRx): receiver list, a list (each item is an instance of BaseRx)

Optional Properties:

  • location (SourceLocationArray): Location of the source [x, y, z] in 3D, a 1D array denoting the source location of <class ‘float’>, <class ‘int’> with shape (*)

parameters = None
classmethod deserialize(value, trusted=False, strict=False, assert_valid=False, **kwargs)[source]

Creates HasProperties instance from serialized dictionary

This uses the Property deserializers to deserialize all JSON-compatible dictionary values into their corresponding Property values on a new instance of a HasProperties class. Extra keys in the dictionary that do not correspond to Properties will be ignored.

Parameters:

  • value - Dictionary to deserialize new instance from.

  • trusted - If True (and if the input dictionary has '__class__' keyword and this class is in the registry), the new HasProperties class will come from the dictionary. If False (the default), only the HasProperties class this method is called on will be constructed.

  • strict - Requires '__class__', if present on the input dictionary, to match the deserialized instance’s class. Also disallows unused properties in the input dictionary. Default is False.

  • assert_valid - Require deserialized instance to be valid. Default is False.

  • Any other keyword arguments will be passed through to the Property deserializers.

equal(other)[source]

Determine if two HasProperties instances are equivalent

Equivalence is determined by checking if all Property values on two instances are equal, using Property.equal.

getReceiverIndex(receiver)[source]
property loc

loc has been deprecated. See location for documentation

property location

location (SourceLocationArray): Location of the source [x, y, z] in 3D, a 1D array denoting the source location of <class ‘float’>, <class ‘int’> with shape (*)

property nD

Number of data

property receiver_list

receiver_list (a list of BaseRx): receiver list, a list (each item is an instance of BaseRx)

property rxList

rxList has been deprecated. See receiver_list for documentation

serialize(include_class=True, save_dynamic=False, **kwargs)[source]

Serializes a HasProperties instance to dictionary

This uses the Property serializers to serialize all Property values to a JSON-compatible dictionary. Properties that are undefined are not included. If the HasProperties instance contains a reference to itself, a properties.SelfReferenceError will be raised.

Parameters:

  • include_class - If True (the default), the name of the class will also be saved to the serialized dictionary under key '__class__'

  • save_dynamic - If True, dynamic properties are written to the serialized dict (default: False).

  • Any other keyword arguments will be passed through to the Property serializers.

validate()[source]

Call all registered class validator methods

These are all methods decorated with @properties.validator. Validator methods are expected to raise a ValidationError if they fail.

property vnD

Vector number of data

Gravity Receiver

class SimPEG.potential_fields.gravity.Point(*args, **kwargs)[source]

Bases: SimPEG.survey.BaseRx

Gravity point receiver class for integral formulation

param numpy.ndarray locations

receiver locations index (ie. np.c_[ind_1, ind_2, ...])

param string component

receiver component “gx”, “gy”, “gz”, “gxx”, “gxy”, “gxz”, “gyy”, “gyz”, “gzz”, “guv”, “amp” [default]

Required Properties:

  • locations (RxLocationArray): Locations of the receivers (nRx x nDim), an array of receiver locations of <class ‘float’>, <class ‘int’> with shape (*, *)

  • projGLoc (StringChoice): Projection grid location, default is CC, any of “CC”, “Fx”, “Fy”, “Fz”, “Ex”, “Ey”, “Ez”, “N”, Default: CC

  • storeProjections (Boolean): Store calls to getP (organized by mesh), a boolean, Default: True

nD()[source]

Number of data in the receiver.

receiver_index()[source]
classmethod deserialize(value, trusted=False, strict=False, assert_valid=False, **kwargs)[source]

Creates HasProperties instance from serialized dictionary

This uses the Property deserializers to deserialize all JSON-compatible dictionary values into their corresponding Property values on a new instance of a HasProperties class. Extra keys in the dictionary that do not correspond to Properties will be ignored.

Parameters:

  • value - Dictionary to deserialize new instance from.

  • trusted - If True (and if the input dictionary has '__class__' keyword and this class is in the registry), the new HasProperties class will come from the dictionary. If False (the default), only the HasProperties class this method is called on will be constructed.

  • strict - Requires '__class__', if present on the input dictionary, to match the deserialized instance’s class. Also disallows unused properties in the input dictionary. Default is False.

  • assert_valid - Require deserialized instance to be valid. Default is False.

  • Any other keyword arguments will be passed through to the Property deserializers.

equal(other)[source]

Determine if two HasProperties instances are equivalent

Equivalence is determined by checking if all Property values on two instances are equal, using Property.equal.

eval(**kwargs)[source]
evalDeriv(**kwargs)[source]
getP(mesh, projGLoc=None)[source]

Returns the projection matrices as a list for all components collected by the receivers.

Note

Projection matrices are stored as a dictionary listed by meshes.

property locations

locations (RxLocationArray): Locations of the receivers (nRx x nDim), an array of receiver locations of <class ‘float’>, <class ‘int’> with shape (*, *)

property locs

locs has been deprecated. See locations for documentation

property projGLoc

projGLoc (StringChoice): Projection grid location, default is CC, any of “CC”, “Fx”, “Fy”, “Fz”, “Ex”, “Ey”, “Ez”, “N”, Default: CC

serialize(include_class=True, save_dynamic=False, **kwargs)[source]

Serializes a HasProperties instance to dictionary

This uses the Property serializers to serialize all Property values to a JSON-compatible dictionary. Properties that are undefined are not included. If the HasProperties instance contains a reference to itself, a properties.SelfReferenceError will be raised.

Parameters:

  • include_class - If True (the default), the name of the class will also be saved to the serialized dictionary under key '__class__'

  • save_dynamic - If True, dynamic properties are written to the serialized dict (default: False).

  • Any other keyword arguments will be passed through to the Property serializers.

property storeProjections

storeProjections (Boolean): Store calls to getP (organized by mesh), a boolean, Default: True

validate()[source]

Call all registered class validator methods

These are all methods decorated with @properties.validator. Validator methods are expected to raise a ValidationError if they fail.

Gravity analytic solutions

SimPEG.potential_fields.gravity.analytics.GravSphereFreeSpace(x, y, z, R, xc, yc, zc, rho)[source]

Computing the gravity response of a sphere in free-space. >> Input x, y, z: Observation locations R: radius of the sphere xc, yc, zc: Location of the sphere rho: Density of sphere

SimPEG.potential_fields.gravity.analytics.GravityGradientSphereFreeSpace(x, y, z, R, xc, yc, zc, rho)[source]

Computing the induced response of magnetic sphere in free-space. >> Input x, y, z: Observation locations R: radius of the sphere xc, yc, zc: Location of the sphere rho: Density of sphere