Educational software
The following is a collection of simple educational codes, mostly in the form of Jupyter notebooks. They are intended to illustrate basic concepts in geophysics and in inverse theory.
Most codes are licensed under a external page Creative Commons Attribution 4.0 International License: You are free to share and adapt the codes as long as you give appropriate credit to this website and to the author of the codes, Andreas Fichtner.
1. Fundamentals of Geophysics
This is a collection of Jupyter notebooks covering basic topics in geophysics. They are the same as the computer exercises in the external page Fundamentals of Geophysics textbook by William Lowrie and Andreas Fichtner.
Download Euler pole rotation of tectonic plates (IPYNB, 11 KB) [Rotation of tectonic plates, represented as many points with fixed mutual distance, across the surface of a sphere.]
Download Gravity of an extended body (IPYNB, 8 KB) [Numerical calculation of the gravitational attraction caused by an arbitrary 2D density distribution.]
Download Tides and Roche limit (IPYNB, 4 KB) [Tidal acceleration at the surface of a planet in relation to the planet's self gravitation.]
Download Fourier series (IPYNB, 5 KB) [Illustration of Fourier analysis and synthesis, the Gibbs phenomenon, and filtering.]
Download Gravity corrections (IPYNB, 9 KB) [Numerical illustration of elevation and topography corrections in 2D.]
Download Creep mechanisms (IPYNB, 6 KB) [Realistic examples of dislocation and diffusion creep in olivine, and their dependence of pressure, temperature and grain size.]
Download Finite-difference approximation of the wave equation (IPYNB, 7 KB) [Finite-difference simulation of wave propagation in 1D.]
Download Reflections at dipping interface (IPYNB, 3 KB) [Modelling and inversion of seismic wave reflections from a dipping interface below the surface.]
Download Origin time and location (IPYNB, 6 KB) [Estimation of the origin time and the location of an earthquake.]
Download Concordia-discordia (IPYNB, 3 KB) [Estimation of the age of a volcanic rock using the concordia-discordia diagram.]
Download Heat flow and age (IPYNB, 4 KB) [Real-data correlation of oceanic heatflow and ocean floor age.]
Download Four-electrode methods (IPYNB, 4 KB) [Numerical illustration of various four-electrode methods in geoelectricity.]
Download Magnetic anomalies (IPYNB, 4 KB) [Numerical calculation of magnetic anomalies caused by differently shaped bodies.]
Download Apparent polar wander (IPYNB, 3 KB) [Calculation of virtual geomagnetic poles.]
2. Inverse Theory
2.1. Basic Concepts and Illustrations
Download Bayes' table (IPYNB, 32 KB) [Thomas Bayes' thought experiment to illustrate the concept of a binomial distribution and of what is now known as Bayes' theorem.]
Download Gauss coefficients (IPYNB, 14 KB) [Simple exercise to obtain the posterior distribution of the Gauss coefficients of the geomagnetic field using artificial magnetic data and a line search approach.]
Download Gaussian samples (IPYNB, 3 KB) [Generation of random samples from a two-dimensional Gaussian with non-diagonal covariance using Cholesky decomposition.]
Download Line fitting in 1D (IPYNB, 36 KB) [Simple illustration of linear least squares and the concept of data covariance.]
2.2. Linear Inverse Problems
Download Straight-ray tomography (IPYNB, 407 KB) [Straight-ray tomography in 2D to illustrate basic concepts of linear least-squares inversion, such as prior and posterior covariances, smoothing, damping, over- and under-fitting, and resolution. The Download utils (ZIP, 14 KB) need to be located in the same directory as the Jupyter notebook.]
Download Straight-ray tomography - Subjectivity Experiment (IPYNB, 14 KB) [Synthetic experiment to assess the impact of subjective choices (data selection, regularisation, ...) in a simple straight-ray tomography. The Download synthetic dataset (ZIP, 24 KB) needs to be located in the same directory as the Jupyter notebook.]
2.3. Nonlinear Optimisation Methods
Download Nonlinear optimisation in 2D (IPYNB, 29 KB) [Collection of nonlinear optimisation methods applied to 2D test functions. Currently implemented methods are steepest descent, conjugate gradients (Fletcher-Reeves, Polak-Ribiere, Hestenes-Stiefel), Newton's method, BFGS, and L-BFGS. The Download test functions (PY, 3 KB) (including their first and second derivatives) need to be located in the same directory as the Jupyter notebook.]
2.4. Markov-Chain Monte Carlo Methods & Nullspace Shuttles
Download Hamiltonian Nullspace Shuttle (analytic 2D) (IPYNB, 221 KB) [Analytic example of the nonlinear Hamiltonian Nullspace Shuttle for a one-dimensional model space (2D phase space).]
Download Hamiltonian Nullspace Shuttle (analytic 2D randomised) (IPYNB, 390 KB) [Randomised version of the 2D analytic Hamiltonian Nullspace shuttle where the misfit tolerance is interpreted as a random variable. The algorithm is nearly identical to Hamiltonian Monte Carlo.]
Download Metropolis-Hastings I (IPYNB, 13 KB) [Finding the time shift between two noisy time series using Metropolis-Hastings sampling and Simulated Annealing.]
Download Metropolis-Hastings II (IPYNB, 164 KB) [Illustration of Metropolis-Hastings sampling in two dimensions using local or global proposals.]
Download Transdimensional sampling - Naive (IPYNB, 11 KB) [Naive transdimensional sampling for polynomial fitting of variable degree. Fixed-dimensional posteriors are sampled individually, and their respective evidences are approximated explicitly from the samples.]
Download Transdimensional sampling - Reversible Jump (IPYNB, 9 KB) [Reversible-jump algorithm applied to polynomial fitting of variable degree.]
Download Hamiltonian Monte Carlo for 2D analytical test functions with unit mass matrix (IPYNB, 11 KB) [Simplest possible HMC illustration. Requires Download input file (PY, 1 KB) and Download test functions (PY, 3 KB).]
Download Hamiltonian Monte Carlo for 2D analytical test functions with adaptable mass matrix (IPYNB, 12 KB) [In contrast to the previous example, the mass matrix can be any positive definite matrix. Illustrates the influence of the mass matrix on convergence and sample independence. The same input and test function files are needed.]
Download Hamiltonian Monte Carlo for 2D analytical test functions with autotuned mass matrix (IPYNB, 17 KB) [A nearly optimal mass matrix is found on-the-fly using a BFGS approximation of the local Hessian. Requires the same input and test function files as the two examples above.]
2.5. Adjoint Methods
Download Forward and adjoint wave propagation in 1D (IPYNB, 18 KB) [Second-order finite-difference approximation of the 1D frequency-domain visco-elastic wave equation, including solutions of the forward and and discrete adjoint problems, as well as gradient accuracy tests (e.g., hockey-stick test).]
Download Forward and adjoint wave propagation in 1D using logarithmic parameters (IPYNB, 23 KB) [This is the same as above, but instead of (complex-valued) velocities, logarithmic velocities are used. The important benefit is a reparameterisation from the Jeffreys parameter velocity to its inverse, slowness, does not change the functional form of probability densities.]