fatiando.seismic.srtomo
)¶Straight-ray 2D travel-time tomography (i.e., does not consider reflection or refraction)
Solver
SRTomo
: Data misfit class that runs the
tomography.Functions
slowness2vel
: Safely convert slowness to
velocity (avoids zero division)fatiando.seismic.srtomo.
SRTomo
(ttimes, srcs, recs, mesh)[source]¶Bases: fatiando.inversion.misfit.Misfit
2D travel-time straight-ray tomography.
Use the fit
method to run the
tomography and produce a velocity estimate. The estimate is stored in the
estimate_
attribute.
Generaly requires regularization, like
Damping
or
Smoothness2D
.
Parameters:
Array with the travel-times of the straight seismic rays.
List of the [x, y] positions of the sources.
List of the [x, y] positions of the receivers.
SquareMesh
or compatibleThe mesh where the inversion (tomography) will take place.
The ith travel-time is the time between the ith element in srcs and the ith element in recs.
config
(method, **kwargs)¶Configure the optimization method and its parameters.
This sets the method used by
fit
and the keyword
arguments that are passed to it.
Parameters:
The optimization method. One of: 'linear'
, 'newton'
,
'levmarq'
, 'steepest'
, 'acor'
Other keyword arguments that can be passed are the ones allowed by each method.
Some methods have required arguments:
initial
argument
(an initial estimate for the gradient descent)bounds
argument (min/max values for the
search space)See the corresponding docstrings for more information:
copy
(deep=False)¶Make a copy of me together with all the cached methods.
estimate_
¶A nicely formatted version of the estimate.
If the class implements a fmt_estimate method, this will its results.
This can be used to convert the parameter vector to a more useful form,
like a fatiando.mesher
object.
fit
()¶Solve for the parameter vector that minimizes this objective function.
Uses the optimization method and parameters defined using the
config
method.
The estimated parameter vector can be accessed through the
p_
attribute. A (possibly) formatted version (converted to a more
manageable type) of the estimate can be accessed through the property
estimate_
.
gradient
(p)¶The gradient vector of the misfit function.
where \(\bar{\bar{J}}\) is the Jacobian matrix and \(\bar{r}\) is the residual vector.
Parameters:
The parameter vector where the gradient is evaluated
Returns:
The gradient vector.
hessian
(p)¶The Hessian of the misfit function with respect to the parameters.
Calculated using the Gauss approximation:
where \(\bar{\bar{J}}\) is the Jacobian matrix.
For linear problems, the Hessian matrix is cached in memory, so calling this method again will not trigger a re-calculation.
Parameters:
The parameter vector where the Hessian is evaluated
Returns:
The Hessian matrix
jacobian
(p)[source]¶Build the Jacobian (sensitivity) matrix.
The matrix will contain the length of the path takes by the ray inside each cell of the mesh.
Parameters:
An estimate of the parameter vector or None
.
Returns:
scipy.sparse
)The Jacobian
predicted
(p)[source]¶Calculate the travel time data predicted by a parameter vector.
Parameters:
An estimate of the parameter vector
Returns:
The predicted travel time data.
regul_param
¶The regularization parameter (scale factor) for the objetive function.
Defaults to 1.
residuals
(p=None)¶Calculate the residuals vector (observed - predicted data).
Parameters:
The parameter vector used to calculate the residuals. If None, will
use the current estimate stored in estimate_
.
Returns:
The residual vector. If this is the sum of 1 or more Misfit instances, will return the residual vector from each of the summed misfits in the order of the sum.
set_weights
(weights)¶Set the data weights.
Using weights for the data, the least-squares data-misfit function becomes:
Parameters:
Weights for the data vector.
If None, will remove any weights that have been set before.
If it is a 2d-array, it will be interpreted as the weight matrix
\(\bar{\bar{W}}\).
If it is a 1d-array, it will be interpreted as the diagonal of the
weight matrix (all off-diagonal elements will default to zero).
The weight matrix can be a sparse array from scipy.sparse
.
value
(p)¶Calculate the value of the misfit for a given parameter vector.
The value is given by:
where \(\bar{r}\) is the residual vector and \(bar{\bar{W}}\) are optional data weights.
Parameters:
The parameter vector.
Returns:
The value of the misfit function.
fatiando.seismic.srtomo.
slowness2vel
(slowness, tol=1e-08)[source]¶Safely convert slowness to velocity.
Almost 0 slowness is mapped to 0 velocity.
Parameters:
The slowness values
Slowness < tol will be set to 0 velocity
Returns:
The converted velocities
Examples:
>>> import numpy as np
>>> slow = np.array([1, 2, 0.000001, 4])
>>> slowness2vel(slow, tol=0.00001)
array([ 1. , 0.5 , 0. , 0.25])