This code is designed to solve one-point ray tracing problems in 3D, isotropic, heterogenous media. The code solves the ODE ray system
Where
The user provides a velocity model, an initial source location scipy.integrate.solve_ivp
which by default uses an explicit Runge-Kutta method of order 5(4).
The only dependancies are Scipy and Numpy. An installation of Scipy includes Numpy so a working environment can be built by
If you use anaconda to manage your environments
conda create -n raytrace3d python=3.x #Change x to any scipy compatible python
conda activate raytrace3d
conda install -c conda-forge scipy
or
pip install scipy
The tutorial notebook tutorial.ipynb
shows an example of setting up the solver and tracing rays in a simple velocity model. Below I list a few key considerations for a user
- The output of a run is a list of solution objects for each ray. It has values which can be accesed in a dictionary like manner to view the solution and the evaluation points. The solution is stored in the attribute
y
and the evaluation$\lambda$ 's are stored int
. For example, if you traced a single ray and stored the solution inout
you can access the$\mathbf{x}$ coordinates of the ray,$\mathbf{p}$ values, and traveltime$T$ by:
x, y, z, = out['y'][0], out['y'][1], out['y'][2]
p_0, p_1, p_2, = out['y'][3], out['y'][4], out['y'][5]
T = out['y'][-1]
lambdas = out['t']
The initial conditions are also available under the key
init_conds = out['init_conds']
Refer to the Scipy documentation for more details about the solver and the output object.
- The properties of the solver can be modified by passing
kwargs
through to the scipy API.
The takeoff direction is specified with a pair of angles
Multiple rays can be traced by passing a list of tuples for the source coordinates and takeoff angles e.g. srcs=[(0,0,0), (0,0,0)]
angles=[(0,45), (0,30)]
.