PyFK#

PyFK is the python port of FK.

The Frequency-Wavenumber (FK) is a synthetic seismogram package used to calculate the Green’s function and the synthetic waveforms of the 1D Earth model. The first version of FK was developed by Prof. Lupei Zhu in 1996, and the code was written in Fortran, C, and Perl.

Nowadays, it’s usually more efficient to do seismological research based on a python’s workflow, with the help of widely used packages such as Obspy, Numpy and Scipy. Python is also easy to integrate with parallel computing packages either in CPU or GPU to improve the computational speed,

About#

PyFK is the python port of FK used to calculate the Green’s function and the synthetic waveforms for the 1D Earth model.

The main features of this package are:

  • Compute the Green’s function for the explosion, single force, and double couple source using the frequency-wavenumber method.

  • Compute the static displacements and corresponding Green’s function.

  • Compute the synthetic waveforms by convolving Green’s function with the seismic source.

  • Use the seismic data format of Obspy, which is easy to perform the signal processing.

And the package is unique as:

  • all the code is written in pure python, and it’s compatible with Unix-like systems including Mac and Linux. The Windows is not supported, as the package uses the complex number in Cython, which uses the C99 standard of “complex.h” that has not been supported by the Visual Studio compiler.

  • it uses Cython to speed up the computationally expensive part (mainly the wavenumber integration).

  • The package has also provided three modes:

    • Serial mode: the serial version implements the FK algorithm in Python.

    • Parallel mode on CPU: the wavenumber integration can be paralleled by MPI.

    • Parallel mode on GPU: the wavenumber integration can also be paralleled by CUDA on GPU.

Installation#

The serial version and the parallel version on GPU can be simply installed using pip:

pip install pyfk

Or conda:

conda install -c ziyixi pyfk

It’s also easy to install the MPI enabled version:

PYFK_USE_MPI=1 pip install pyfk[mpi]

Extra packages including numba and cupy will be required to enable the GPU mode. For more details about the Installation, you can refer to the Installing part of the document.

Todo#

The current bugs to fix or features to provide are listed in TODO.

License#

PyFK is a free software: you can redistribute it and modify it under the terms of the Apache License. A copy of this license is provided in LICENSE.

Acknowledgment#

PyFK was initially my undergraduate thesis project in USTC, so I would thank Prof. Daoyuan Sun in USTC for mentoring me on this project. I would also thank my Ph.D. advisors Prof. Min Chen and Prof. Songqiao Shawn Wei for supporting my study and research in the United States, so I can have the time and energy to finish this project.