# Confidential codes for EIP partners only

**Below are code packages available for EIP partners only, which are password protected.** Password can be obtained by emailing Xuebin Zhao at *xuebin.zhao@ed.ac.uk* or Andrew Curtis at *andrew.curtis@ed.ac.uk*.

**GeoPVI – Geophysical Inversion using Parametric Variational Inference:**This code package performs geophysical inversion using parametric variational inference methods that have been introduced and tested by the EIP. In GeoPVI, the posterior probability distribution is parametrised explicitly and (semi-)analytically, allowing the posterior probability value for any model sample to be evaluated efficiently (without invoking Bayes’ rule). In addition, new posterior samples can be obtained easily post inversion. GeoPVI is designed to help researchers perform variational inversion and their uncertainty analysis easily, and on a broader range of applications. A user guide is available within the package.

# Publicly available code packages

Below are code packages developed by the EIP and are now publicly available. Check out our GitHub page for the newest codes: Edinburgh Imaging Project. In addition, the following codes are publicly available in the form of zip packages. Our fileserver requires us to have a password on the links. **If you are prompted for a DataSync password, the password is ‘EIP’.**

**Statistical Experimental Design for Source Location Problems:**Matlab codes used in Experimental design for fully nonlinear source location problems: which method should I choose? (Bloem et al., 2020). Statistical experimental design (SED) is the field of statistics concerned with designing experiments to obtain as much information as possible about a target of interest. SED algorithms can be divided into two categories: those that assume a linear or linearized relationship between measured data and parameters, and those that account for a fully nonlinear relationship. We compare the most commonly used linear method, Bayesian D-optimization, to two nonlinear methods, maximum entropy design and

*D*_{N}-optimization, in a synthetic seismological source location problem where we define a region of the subsurface in which earthquake sources are likely to occur. Example random sources in this region are sampled with a uniform distribution and their arrival time data across the ground surface are forward modelled; the goal of SED is to define a surface monitoring network that optimally constrains this set of source locations given the data that would be observed. Receiver networks so designed are evaluated on performance—the percentage of earthquake pairs whose arrival time differences are above a threshold of measurement uncertainty at each receiver, the number of prior samples (earthquakes) required to evaluate the statistical performance of each design and the SED compute time for different subsurface velocity models. We find that*D*_{N}-optimization provides the best results both in terms of performance and compute time. Linear design is more computationally expensive and designs poorer performing networks. Maximum entropy design is shown to be effectively impractical due to the large number of samples and long compute times required.

**An introduction to Marchenko methods for Imaging:**Geoscientists often have little information about earth’s subsurface heterogeneities prior to mapping them using seismic or other geophysical data. Marchenko methods are a set of novel, data-driven techniques that help us to project surface seismic data to points in the subsurface, to form seismograms as though they had been created at each point. In so doing, Marchenko methods account for many of the complex, multiply reflected seismic wave interactions that take place in the real earth’s subsurface. The resulting seismograms are the information required to create subsurface images that are more accurate than standard methods. Our aim is to introduce these concepts with the minimum amount of mathematics required to understand how the Marchenko method can iterate to a solution and to provide a well-commented, easily editable MATLAB code package for demonstration and training purposes. Green’s function estimation using the Marchenko method is first illustrated for a constant velocity, variable density, 1D medium, with results that indicate a near-perfect match when compared with true, synthetically modeled solutions. Similar quality results are shown for variable velocity, 2D Green’s function estimation. Finally, we determine how these estimates could be used to create images of the subsurface, which, when compared with standard methods, contain reduced contamination due to multiple-related artifacts. Our code package includes the 2D data set required to reconstruct the relevant figures that we present, and it allows for experimentation with the implementation of the Marchenko method and the application of Marchenko imaging (

**PDF**).

**3D Monte Carlo tomography using both body and surface wave data:**This code implements a fully 3D Monte Carlo Tomography method using both surface and body wave data. It employs Voronoi tessellation to parameterize the subsurface, and the reversible jump Markov chain Monte Carlo method to sample the parameter space. It supports 3D travel time tomography using body wave arrival (or travel) times, surface wave frequency-dependent travel times, as well as joint inversion using both body and surface wave data.

**Non-linear transdimensional electrical resistivity tomography:**These Fortran 90 codes can be used to perform non-linear transdimensional electrical resistivity tomography with the reversible-jump Markov chain Monte Carlo (rj-McMC) algorithm. The codes combine the rj-McMC algorithm (Bodin & Sambridge (2009)) with a 2.5D forward solver (Pidlisecky & Knight (2008)) to make the inversion fully non-linear, and make use of parallel tempering (Sambridge, 2014) to accelerate convergence.

**Non-linear transdimensional travel-time tomography using reversible-jump Markov chain Monte Carlo:**This Fortran 90 code can be used to perform non-linear transdimensional seismic traveltime tomography with the reversible-jump Markov chain Monte Carlo (rj-McMC) algorithm. The code combines the rj-McMC algorithm (Bodin & Sambridge (2009), Bodin et al. (2012)) with a Fast Marching eikonal raytracer (Rawlinson et al. (2004)) to make the inversion fully non-linear. A user guide and a synthetic example are provided within the package.

**Relative source location using coda wave interferometry:**

The matlab code package for coda wave interferometry called CWIcluster. A user manual accompanies the coda wave interferometry relative source location MATLAB code package (CWIcluster). The code estimates the relative location of a cluster of events of similar source mechanisms using inter-source separations estimated with CWI (Snieder, 2006). The advantage of this location technique is that the location result is insensitive to the number and distribution of seismic stations. The method is particularly useful where there are not a large number of seismic stations with a good event-sensor azimuthal coverage so that the performance of the conventional double-difference relative source location method of Waldhauser & Ellsworth (2000) deteriorates. It also provides an alternative, entirely independent method with which conventional methods can be compared in order to assess relative location uncertainties.This manual provides a brief introduction of CWI and the location algorithm. This is sufficient to run the code. More details are given in the accompanying paper. The package consists of three sections, each of which contains codes that conduct one step of the location method: 1) classifying events into different clusters with given waveforms recorded by one or multiple seismic station channels, 2) estimating inter-source separations with the CWI method, and 3) estimating the relative event locations from the separation data. The code solves for the event locations as an optimization problem, where the most likely set of event locations are found where an objective function attains its minimum. This algorithm takes account of the known biases of CWI-estimated source separations, and is able to correct for them to a significant extent in location results. Examples on synthetic and real data are presented in this manual to demonstrate how to use the codes, and test-data is included in the package.A MATLAB code which implements the method of Foldy has been developed in Edinburgh by Erica Galetti and David Halliday (a previous version was developed by Dirk-Jan van Manen). In 1945, Foldy published a method to model multiply-scattered wavefields exactly, including all orders of inter-scatterer interactions. A manual and several examples applying the method to interferometric methods are included within that zip file.The codes use analytical Green’s function formulae to compute the impulse response of a medium of constant background velocity with embedded scatterers. The analytical nature of the solution makes it an ideal tool to test interferometric theoretical results as it does not suffer from the limitations associated with finite difference codes (dispersion, spurious reflections from absorbing boundaries etc.).**Simple and exact modelling of scattered wavefields using the Foldy method:**