EarthModel#

class evodcinv.EarthModel[source]#

Layered Earth model class.

add(layer)[source]#

Add a new layer.

Parameters:

layer (evodcinv.Layer) – Layer to add.

configure(optimizer='cpso', misfit='rmse', density='nafe-drake', normalize_weights=True, increasing_velocity=False, extra_terms=None, dc=0.001, dt=0.01, optimizer_args=None)[source]#

Configure misfit function to minimize.

Parameters:
  • optimizer (str, optional, default 'cpso') –

    Type of solver. Should be one of:

    • ’cmaes’

    • ’cpso’

    • ’de’

    • ’na’

    • ’pso’

    • ’vdcma’

  • misfit (str or callable, optional, default 'rmse') –

    Function to evaluate error. If callable, must be in the form f(e), where e is the error between observed and calculated data in the form of a 1-D array. If str, should be one of:

    • ’norm1’

    • ’norm2’

    • ’rmse’

  • density (str or callable, optional, default 'nafe-drake') –

    Function to evaluate density. If callable, must be in the form f(vp), where vp is the P-wave velocity (in km/s). If str, should be one of:

    • ’nafe-drake’

  • normalize_weights (bool, optional, default True) – If True, weights associated to individual misfit terms are normalized.

  • increasing_velocity (bool, optional, default True) – If True, optimize for increasing velocity models. Note that a penalty term is added to extra_terms.

  • extra_terms (sequence of callable or None, optional, default None) – Additional misfit terms. Must be a sequence of callables.

  • dc (scalar, optional, default 0.001) – Phase velocity increment for root finding.

  • dt (scalar, optional, default 0.01) – Frequency increment (%) for calculating group velocity.

  • optimizer_args (dict or None, optional, default None) –

    A dictionary of solver options. All methods accept the following generic options:

    • maxiter (int): maximum number of iterations to perform

    • popsize (int): total population size

    • seed (int or None): seed for random number generator

    See stochopy’s documentation for more options.

invert(curves, maxrun=1, split_results=False)[source]#

Invert model.

Parameters:
  • curves (sequence of evodcinv.Curve) – Sequence of data curves to fit.

  • maxrun (int, optional, default 1) – Maximum number of runs. Each run starts with a different population.

  • split_results (bool, optional, default False) – If True, results of the different runs are not concatenated.

Returns:

Inversion results.

Return type:

evodcinv.InversionResult or sequence of evodcinv.InversionResult

property layers#

Return layers in model.

property n_layers#

Return number of layers.

pop()[source]#

Remove last layer.

Returns:

Last layer.

Return type:

evodcinv.Layer

transform(x)[source]#

Transform model parameters to velocity model.

Parameters:

x (array_like) – Model parameters.

Returns:

Velocity model with shape (n_layers, 4).

Return type:

array_like