Giter Site home page Giter Site logo

izzatum / waveform-ot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from msambridge/waveform-ot

0.0 0.0 0.0 283.68 MB

Python libraries for Optimal Transport of time series - examples from paper Sambridge, Jackson and Valentine (2022)

Python 4.00% Jupyter Notebook 96.00%

waveform-ot's Introduction

waveform-ot

This package implements various algorithms described in Sambridge, Jackson & Valentine, Geophysical Journal International, 2022. It is intended to serve as a demonstration of the theory described in the above paper, while also providing examples of access to the underlying Optimal Transport library OTlib.py and time series Fingerprint library FingerprintLib.py.

Contents

Introduction

The current package demonstrates python software to calculate Wasserstein distances between 1D oscillatory time series, as well as the derivatives of those misfit measures with respect to the amplitude and origin time of the time series.

Package contents

The core computational routines of this package are found in two Python modules, both found in the libs directory:

  • FingerprintLib - Routines to calculate time series fingerprints, including a class waveformFP;
  • OTlib - Routines to undertake Optimal Transport calculations between fingerprints, including a class OTpdf.

The libs directory contains several additional modules: these provide various functions that are specific to the examples presented here.

Calculations in the paper are demonstrated through a sequence of Jupyter notebooks:

  • Point_mass_demo_Fig_5.ipynb: An illustration of use of the OT library to calculate Wasserstein misfit between two 1D density functions. Also shows the intermediate steps in calculations of the Wasserstein distance and reproduces Figure 5 of the paper.
  • Ricker_Figs_1_7.ipynb: Demonstrates calculation of a time series Fingerprint using a double Ricker wavelet example. Calculates Wasserstein misfit between noisy and noiseless waveforms as a function of the time shift and amplitude scale factor of the Ricker wavelets. Reproduces Figures 1 and 7 of the paper.
  • Ricker_Figs_3_8.ipynb: Demonstrates calculation of 1D time and amplitude marginals from 2D Fingerprint density field. Shows how to use Wasserstein misfit for optimisation of 3 parameters controlling Ricker wavelets. Reproduces Figures 3 and 8 of the paper.
  • Ricker_waveform_derivatives.ipynb: Illustrates detailed calculation of derivatives of Wasserstein time and amplitude marginals with respect to waveform amplitudes and window origin time. Demonstrates application of chain rule to various intermediate derivatives as described in the paper. All calculations are generic except the final combination involving the forward problem model parameters. This notebook may be helpful in showing how to apply the libraries to other applications involving the fitting of time series.
  • source_location_cmt_W2L2_Figs_9_10_11.ipynb: Demonstrates application of Wasserstein library to earthquake source and moment tensor inversion using example in the paper. Reproduces Figures 9, 10 and 11.
  • source_location_cmt_W2L2_Fig_12.ipynb: Performs repeat inversions for earthquake source parameters starting from different source locations. Reproduces Figure 12 of the paper.

Installation and usage

To explore the examples:

  1. Ensure that you have a working Jupyter installation with a Python 3 kernel: see Project Jupyter for more details.
  2. Obtain a copy of this package:
    • git clone https://github.com/msambridge/waveform-ot.git, or
    • Click the green 'Code' button on this page, select Download ZIP, and unzip the resulting file in an appropriate place on your system.
  3. Ensure that the following modules are available on your system: numpy, scipy, tqdm, pyprop8, matplotlib. A requirements.txt file is provided, so users of pip can simply pip install -r requirements.txt.
  4. Launch a Jupyter server, navigate to your waveform-ot directory, and run one or more of the notebooks.

Seismogram software pyprop8

This notebook makes use of Andrew Valentine's pyprop8 implementation of the seismogram calculation algorithm set out in O'Toole & Woodhouse (2011), together with the source derivatives set out in O'Toole, Valentine & Woodhouse (2012). Detailed installation and usage instructions can be found here; pip install pyprop8 may suffice for many users.

Citing this package

If you make use of this code, please acknowledge the work that went into developing it. In particular, if you are preparing a publication, we would appreciate it if you cite the paper describing the general method used here:

An appropriate form of words might be, "We make use of the software package OTlib.py, which implements the approach of Sambridge et al. (2022)."

Acknowledgements

This package was developed at the Australian National University by Malcolm Sambridge & Andrew Valentine.

This work has received support from the Australian Research Council under grants DE180100040 and DP200100053 and The Commonwealth Scientific Industrial Research Organisation Future Science Platform for Deep Earth Imaging.

waveform-ot's People

Contributors

valentineap avatar msambridge avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.