fatiando.seismic.epic2d
)¶Epicenter determination in 2D, i.e., assuming a flat Earth.
There are solvers for the following approximations.
Homogeneous Earth
Estimates the (x, y) cartesian coordinates of the epicenter based on travel-time residuals between S and P waves, assuming a homogeneous velocity distribution.
fatiando.seismic.epic2d.
Homogeneous
(ttres, recs, vp, vs)[source]¶Bases: fatiando.inversion.misfit.Misfit
Estimate the epicenter assuming a homogeneous Earth.
Parameters:
Travel-time residuals between S and P waves
List with the (x, y) coordinates of the receivers
Assumed velocity of P waves
Assumed velocity of S waves
Note
The recommended solver for this inverse problem is the
Levemberg-Marquardt method. Since this is a non-linear problem, set the
desired method and initial solution using the
config
method.
See the example bellow.
Examples:
Using synthetic data.
>>> from fatiando.mesher import Square
>>> from fatiando.seismic import ttime2d
>>> # Generate synthetic travel-time residuals
>>> area = (0, 10, 0, 10)
>>> vp = 2
>>> vs = 1
>>> model = [Square(area, props={'vp':vp, 'vs':vs})]
>>> # The true source (epicenter)
>>> src = (5, 5)
>>> recs = [(5, 0), (5, 10), (10, 0)]
>>> srcs = [src, src, src]
>>> #The travel-time residual between P and S waves
>>> ptime = ttime2d.straight(model, 'vp', srcs, recs)
>>> stime = ttime2d.straight(model, 'vs', srcs, recs)
>>> ttres = stime - ptime
>>> # Pass the data to the solver class
>>> solver = Homogeneous(ttres, recs, vp, vs).config('levmarq',
... initial=[1, 1])
>>> # Estimate the epicenter
>>> x, y = solver.fit().estimate_
>>> print "(%.4f, %.4f)" % (x, y)
(5.0000, 5.0000)
Notes:
The travel-time residual measured by the ith receiver is a function of the (x, y) coordinates of the epicenter:
The elements \(G_{i1}\) and \(G_{i2}\) of the Jacobian matrix for this data type are
The Hessian matrix is approximated by \(2\bar{\bar{G}}^T\bar{\bar{G}}\) (Gauss-Newton method).
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_
.
fmt_estimate
(p)¶Called when accessing the property estimate_
.
Use this to convert the parameter vector (p) to a more useful form, like a geometric object, etc.
Parameters:
The parameter vector.
Returns:
Pretty much anything you want.
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
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.