5.10. synth_seis

Early development functions to do very basic simulations of seismograms to be used as general matched-filter templates and see how well a simple model would fit with real data.

This file is part of EQcorrscan.

EQcorrscan is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EQcorrscan is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with EQcorrscan. If not, see <http://www.gnu.org/licenses/>.

All copyright and ownership of this module belongs to Calum Chamberlain, 2015 & 2016

synth_seis.SVD_sim(SP, lowcut, highcut, samp_rate, amp_range=<mock.Mock object at 0x4401d50>)[source]

Function to generate a basis vectors of a set of simulated seismograms with a range of S-P amplitude ratios.

Parameters:
  • SP (int) – S-P time in seconds - will be converted to samples according to samp_rate.
  • lowcut (float) – Low-cut for bandpass filter in Hz
  • highcut (float) – High-cut for bandpass filter in Hz
  • samp_rate (float) – Sampling rate in Hz
  • amp_range (np.ndarray) – Amplitude ratio range to generate synthetics for.
Returns:

nd.ndarray, set of output basis vectors

synth_seis.generate_synth_data(nsta=5, ntemplates=3, nseeds=100, samp_rate=20.0, t_length=3.0, max_amp=10.0, debug=0)[source]

Function to generate a synthetic dataset to be used for testing. This will generate both templates and data to scan through. Templates will be generated using the utils.synth_seis functions. The day of data will be random noise, with random signal-to-noise ratio copies of the templates randomly seeded throughout the day. It also returns the seed times and signal-to-noise ratios used.

Parameters:
  • nsta (int) – Number of stations to generate data for < 15.
  • ntemplates (int) – Number of templates to generate, will be generated with random arrival times.
  • nseeds (int) – Number of copies of the template to seed within the day of noisy data for each template.
  • samp_rate (float) – Sampling rate to use in Hz
  • t_length (float) – Length of templates in seconds.
  • max_amp (float) – Maximum signal-to-noise ratio of seeds.
  • debug (int) – Debug level, bigger the number, the more plotting/output.
Returns:

Templates: List of obspy.Stream, Data: obspy.Stream of seeded noisy data, Seeds: dictionary of seed SNR and time with time in samples.

synth_seis.seis_sim(SP, amp_ratio=1.5, flength=False, phaseout=u'all')[source]

Function to generate a simulated seismogram from a given S-P time. Will generate spikes separated by a given S-P time, which are then convolved with a decaying sine function. The P-phase is simulated by a positive spike of value 1, the S-arrival is simulated by a decaying boxcar of maximum amplitude 1.5. These ampitude ratios can be altered by changing the amp_ratio, which is the ratio S amplitude:P amplitude.

Note

In testing this can achieve 0.3 or greater cross-correlations with data.

Parameters:
  • SP (int) – S-P time in samples
  • amp_ratio (float) – S:P amplitude ratio
  • flength (int) – Fixed length in samples, defaults to False
  • phaseout (str) – Either ‘P’, ‘S’ or ‘all’, controls which phases to cut around, defaults to ‘all’. Can only be used with ‘P’ or ‘S’ options if flength is set.
Returns:

np.ndarray

synth_seis.template_grid(stations, nodes, travel_times, phase, PS_ratio=1.68, samp_rate=100, flength=False, phaseout=u'all')[source]

Function to generate a group of synthetic seismograms to simulate phase arrivals from a grid of known sources in a three-dimensional model. Lags must be known and supplied, these can be generated from the bright_lights function: read_tt, and resampled to fit the desired grid dimensions and spacing using other functions therein. These synthetic seismograms are very simple models of seismograms using the seis_sim function herein. These approximate body-wave P and S first arrivals as spikes convolved with damped sine waves.

Parameters:
  • stations (list) – List of the station names
  • nodes (list of tuple) – List of node locations in (lon,lat,depth)
  • travel_times (np.ndarray) – Array of travel times where travel_times[i][:] refers to the travel times for station=stations[i], and travel_times[i][j] refers to stations[i] for nodes[j]
  • phase (str) – Can be either ‘P’ or ‘S’
  • PS_ratio (float) – P/S velocity ratio, defaults to 1.68
  • samp_rate (float) – Desired sample rate in Hz, defaults to 100.0
  • flength (int) – Length of template in samples, defaults to False
  • phaseout (str) – Either ‘S’, ‘P’, ‘all’ or ‘both’, determines which phases to clip around. ‘all’ Encompasses both phases in one channel, but will return nothing if the flength is not long enough, ‘both’ will return two channels for each stations, one SYN_Z with the synthetic P-phase, and one SYN_H with the synthetic S-phase.
Returns:

List of :class:obspy.Stream