Traveltimes and rays - ttimerays
Various functions to calculate travel times and ray in a rectilinear grid.
- pestoseis.ttimerays.buildtomomat(gridpar, rays, ttpick)[source]
Build forward matrix from rays for traveltime tomography.
- Parameters:
gridpar (dict) – grid parameters dictionary (as defined by setupgrid())
rays (ndarray of ndarrays) – seismic rays, as outputted by traceallrays()
ttpick (ndarray) – traveltime picks at the receivers. [These are needed only to provide the vector of traveltime picks flattened for performing tomography in the same order than the tomography matrix]
- Returns:
- the ‘tomography’ matrix and the vector of traveltime picks
(flattened for performing tomography)
- Return type:
(ndarray)
- pestoseis.ttimerays.lininv(G, cov_m, cov_d, mprior, dobs)[source]
Linear inversion under Gaussian assumptions.
- Parameters:
G – forward model matrix (d=Gm)
cov_m,cov_d – covariances for model parameters and observed data, respectively
mprior – prior model
dobs – obsrved data
- Returns:
the posterior mean model and the posterior covariance matrix
- pestoseis.ttimerays.plotgrid(gridpar)[source]
Plot staggered grid edges: traveltime at nodes and velocity in cells
- Parameters:
gridpar – grid parameters dictionary (as defined by setupgrid())
- pestoseis.ttimerays.plotrays(src, rec, rays)[source]
Plot rays as polylines.
- Parameters:
src (ndarray) – coordinates of the sources
rec (ndarray) – coordinates of the receivers
rays (narray of arrays) – seismic rays, as outputted by traceallrays()
- pestoseis.ttimerays.plotttimemod(gridpar, ttime, units='')[source]
Plot traveltime array as an image.
- Parameters:
gridpar (dict) – grid parameters dictionary (as defined by setupgrid())
ttime (ndarray) – traveltime array
units (str) – optional string to specify the units of measurement for traveltime
- pestoseis.ttimerays.plotvelmod(gridpar, velmod, vmin=None, vmax=None, units='', cmap=<matplotlib.colors.LinearSegmentedColormap object>)[source]
Plot velocity model as an image.
- Parameters:
gridpar (dict) – grid parameters dictionary (as defined by setupgrid())
velmod (ndarray) – velocity model
vmin (float,float) – optional values to clip the colorbar min and max values
vmax (float,float) – optional values to clip the colorbar min and max values
units (str) – optional string to specify the units of measurement for velocity
cmap (colormap) – optional parameter to specify a colormap. Defaults to “rainbow”.
- pestoseis.ttimerays.rollmod(mod, nx, ny)[source]
Reshape a flattened (a vector) model to 2D (an array).
- Parameters:
mod (ndarray) – input flattened model
nx (float,float) – sizes of the input 2D model
ny (float,float) – sizes of the input 2D model
- Returns:
the reshaped model as a 2D array
- Return type:
(ndarray)
- pestoseis.ttimerays.setupgrid(nx, ny, dh, xinit, yinit)[source]
Setup grid parameters.
- Parameters:
nx,ny – grid dimensions in x and y
dx,dy – grid spacing (cell size) in x and y
xinit,yinit – x and y axes origin
- pestoseis.ttimerays.traceall_straight_rays(gridpar, srccoo, reccoo)[source]
Trace multiple straight rays.
- Parameters:
gridpar (dict) – grid parameters dictionary (as defined by setupgrid())
srccoo (ndarray) – position of the source, a 2D array with two columns, representing x and y
reccoo (ndarray) – position of the receiver, a 2D array with two columns, representing x and y
- Returns:
the coordinates of the ray paths
- Return type:
(ndarray)
- pestoseis.ttimerays.traceallrays(gridpar, srccoo, reccoo, grdsttime)[source]
Trace multiple rays, for all sources and receivers.
- Parameters:
gridpar (dict) – grid parameters dictionary (as defined by setupgrid())
srccoo (ndarray) – position of the source, a 2D array with two columns, representing x and y
reccoo (ndarray) – position of the receiver, a 2D array with two columns, representing x and y
grdsttime (list of ndarrays) – array of traveltime arrays [list of 2D arrays, one per source]
- Returns:
the traced rays as (x,y) coordinates of the points defining the segments
- Return type:
(ndarray of ndarrays)
- pestoseis.ttimerays.tracerayhorlay(laydep, vel, xystart, takeoffangle, maxnumiterations=20000)[source]
Trace rays in a horizontally layered model.
- Parameters:
laydep (ndarray) – input depth of layers
vel (ndarray) – velocity for each layer
xystart (ndarray) – origin coordinates of the ray
takeoffangle (float) – take off angle
maxnumiterations (int) – limit the number of ray segments to calculate, in case the ray never reaches the surface
- Returns:
- coordinates of the the ray path, traveltime
and distance covered
- Return type:
(ndarray,float,float)
- pestoseis.ttimerays.traveltime(velmod, gridpar, srcs, recs)[source]
Calculate traveltime for all sources and receivers.
- Parameters:
velmod – input velocity model
gridpar – grid parameters dictionary (as defined by setupgrid())
srcs – coordinates of sources
recs – coordinates of receivers
- Returns:
traveltimes at the receivers and traveltime arrays
- Return type:
ndarray,ndarray