3.1. quakemigrate.core

The quakemigrate.core module provides Python bindings for the libraries of compiled C routines that form the core of QuakeMigrate and do the heavy lifting:

  • migratelib - contains routines for computing the 4-D coalescence function by continuously migrating onset functions through time and space and determining the continuous maximum coalescence amplitude in the 4-D coalescence volume.

  • onsetlib - contains routines for computing various onset functions, including the centred/overlapping STA/LTA, as well as a recursive implementation of the centred STA/LTA.

copyright

2020–2023, QuakeMigrate developers.

license

GNU General Public License, Version 3 (https://www.gnu.org/licenses/gpl-3.0.html)

3.1.1. Functions

Bindings for the QuakeMigrate C libraries.

copyright

2020–2024, QuakeMigrate developers.

license

GNU General Public License, Version 3 (https://www.gnu.org/licenses/gpl-3.0.html)

quakemigrate.core.lib.centred_sta_lta(signal: ndarray[float], nsta: int, nlta: int) ndarray[float64][source]

Compute the STA/LTA onset function with consecutive windows. The return value is allocated to the last sample of the LTA window.

Parameters
  • signal (Pre-processed waveform data to be processed into an onset function.) –

  • nsta (Number of samples in the short-term average window.) –

  • nlta (Number of samples in the long-term average window.) –

Returns

onset

Return type

Centred STA/LTA onset function.

quakemigrate.core.lib.find_max_coa(map4d: ndarray[float64], threads: int) tuple[numpy.ndarray[numpy.float64], numpy.ndarray[numpy.float64], numpy.ndarray[int]][source]

Finds time series of the maximum coalescence/normalised coalescence in the 3-D volume, and the corresponding grid indices.

Parameters
  • map4d (4-D coalescence map, shape(nx, ny, nz, nsamples).) –

  • threads (Number of threads with which to perform the scan.) –

Returns

  • max_coa (Time series of the maximum coalescence value in the 3-D volume.)

  • max_norm_coa (Times series of the maximum normalised coalescence value in the 3-D) – volume.

  • max_coa_idx (Time series of the flattened grid indices corresponding to the maximum) – coalescence value in the 3-D volume.

quakemigrate.core.lib.migrate(onsets: ndarray[float64], traveltimes: ndarray[int], first_idx: int, last_idx: int, available: int, threads: int) ndarray[float64][source]

Computes 4-D coalescence map by migrating seismic phase onset functions.

Parameters
  • onsets (Onset functions for each seismic phase, shape(nonsets, nsamples).) –

  • traveltimes (Grids of seismic phase traveltimes, converted to an integer multiple of) – the sampling rate, shape(nx, ny, nz, nonsets).

  • first_idx (Index of first sample in array from which to scan.) –

  • last_idx (Index of last sample in array up to which to scan.) –

  • available (Number of available onset functions.) –

  • threads (Number of threads with which to perform the scan.) –

Returns

map4d

Return type

4-D coalescence map, shape(nx, ny, nz, nsamples).

Raises
  • ValueError – If mismatch between number of onset functions and traveltime lookup tables. Expect both to be equal to the no. stations * no. phases.

  • ValueError – If the number of samples in the onset functions is less than the number of samples array is smaller than map4d[0, 0, 0, :].

quakemigrate.core.lib.overlapping_sta_lta(signal: ndarray[float], nsta: int, nlta: int) ndarray[float64][source]

Compute the STA/LTA onset function with overlapping windows. The return value is allocated to the last sample of the STA window.

Parameters
  • signal (Pre-processed waveform data to be processed into an onset function.) –

  • nsta (Number of samples in the short-term average window.) –

  • nlta (Number of samples in the long-term average window.) –

Returns

onset

Return type

Overlapping STA/LTA onset function.

quakemigrate.core.lib.recursive_sta_lta(signal: ndarray[float], nsta: int, nlta: int) ndarray[float64][source]

Compute the STA/LTA onset function with consecutive windows using a recursive method (minimises memory costs). Reproduces exactly the centred STA/LTA onset.

Parameters
  • signal (Pre-processed waveform data to be processed into an onset function.) –

  • nsta (Number of samples in the short-term average window.) –

  • nlta (Number of samples in the long-term average window.) –

Returns

onset

Return type

Recursive (centred) STA/LTA onset function.