Sourcespec Readthedocs Io en Latest
Sourcespec Readthedocs Io en Latest
Release 1.8+100.g047d4e9
Claudio Satriano
1 Theoretical Background 3
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Spectral model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Building spectra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Inverted parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Other computed parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.6 Station Residuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Signal Processing 9
2.1 Trace Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.2 Spectral Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Clipping Detection 11
3.1 “Clipping Score” algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.2 “Clipping Peaks” algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4 Getting Started 13
4.1 For the impatient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Command line arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.3 Configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5 Configuration File 15
6 File Formats 31
6.1 Trace formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.2 Event formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.3 Phase pick formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.4 Station metadata formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.5 Output files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
9 Installation 45
9.1 Installing the latest release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9.2 Installing a developer snapshot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
i
10 Sample Runs 47
11 Getting Help 49
11.1 I need help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
11.2 I found a bug . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
12 Contributing 51
13 How to Cite 53
14 SourceSpec API 55
14.1 Main modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
14.2 Other modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
15 SourceSpec Changelog 85
15.1 unreleased . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
15.2 v1.8 - 2024-04-07 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
15.3 v1.7 - 2023-03-31 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
15.4 v1.6 - 2022-08-02 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
15.5 v1.5 - 2022-05-22 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
15.6 v1.4 - 2021-10-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.7 v1.3.1 - 2021-09-13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.8 v1.3 - 2021-08-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.9 v1.2 - 2021-05-20 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.10 v1.1 - 2021-04-07 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
15.11 v1.0 - 2021-03-03 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
15.12 v0.9 - 2020-04-24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
15.13 v0.8 - 2014-07-11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
15.14 v0.7 - 2014-04-07 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
15.15 v0.6 - 2013-06-05 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
15.16 v0.5 - 2013-02-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
15.17 v0.4 - 2012-04-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
15.18 v0.3 - 2012-02-10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
15.19 v0.2 - 2012-02-06 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
15.20 v0.1 - 2012-01-17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
15.21 Journal papers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
15.22 Conference papers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Bibliography 107
Index 111
ii
SourceSpec Documentation, Release 1.8+100.g047d4e9
CONTENTS 1
SourceSpec Documentation, Release 1.8+100.g047d4e9
2 CONTENTS
CHAPTER
ONE
THEORETICAL BACKGROUND
1.1 Overview
source_spec inverts the P- or S-wave displacement amplitude spectra from station recordings of a single event.
For each station, the code computes P- or S-wave displacement amplitude spectra for each component 𝑥 (e.g., Z, N, E),
within a predefined time window.
⃒∫︁ 𝑝|𝑠 ⃒
⃒ 𝑡1 ⃒
𝑝|𝑠 −𝑖2𝜋𝑓 𝑡 ⃒
𝑆𝑥 (𝑓 ) = ⃒ 𝑠𝑥 (𝑡)𝑒 𝑑𝑡⃒
⃒
⃒ 𝑡𝑝|𝑠
0
⃒
𝑝|𝑠 𝑝|𝑠
where the exponent 𝑝|𝑠 means that we are considering either P- or S-waves, 𝑡0 and 𝑡1 are the start and end times of
the P- or S-wave time window, 𝑠𝑥 (𝑡) is the displacement time series for component 𝑥, and 𝑓 is the frequency.
Note that the Fourier amplitude spectrum of ground displacement has the dimensions of displacement (𝑠𝑥 (𝑡)) multiplied
by time (𝑑𝑡).
The same thing is done for a noise time window: noise spectrum is used to compute spectral signal-to-noise ratio (and
possibly reject low SNR spectra) and, optionally, to weight the spectral inversion.
Fig. 1: Example three-component trace plot (in velocity), showing noise and S-wave windows.
The component spectra are combined through the root sum of squares (e.g., Z, N, E):
√︂(︁ )︁ (︁2 )︁ (︁ 2 )︁ 2
𝑝|𝑠 𝑝|𝑠 𝑝|𝑠
𝑆 𝑝|𝑠 (𝑓 ) = 𝑆𝑧 (𝑓 ) + 𝑆𝑛 (𝑓 ) + 𝑆𝑒 (𝑓 )
(This is actually done later in the code, after converting the spectra to magnitude units, see below.)
Fig. 2: Example displacement spectrum for noise and S-wave, including inversion results.
where:
3
SourceSpec Documentation, Release 1.8+100.g047d4e9
• 𝒢(𝑟) is the geometrical spreading coefficient (see below) and 𝑟 is the hypocentral distance;
• 𝐹 is the free surface amplification factor (generally assumed to be 2);
• 𝑅ΘΦ is the radiation pattern coefficient for P- or S-waves (average or computed from focal mechanism, if avail-
able);
• 𝜌ℎ and 𝜌𝑟 are the medium densities at the hypocenter and at the receiver, respectively;
• 𝑐ℎ and 𝑐𝑟 are the P- or S-wave velocities at the hypocenter and at the receiver, respectively;
• 𝑀𝑂 is the seismic moment;
• 𝑓 is the frequency;
𝑝|𝑠
• 𝑓𝑐 is the corner frequency for P- or S-waves;
• 𝑡 is an attenuation parameter which includes anelastic path attenuation (quality factor) and station-specific ef-
*
fects.
Note that here we use the square root of eq. 8 in Boatwright et al. [2002], since we correct the spectral amplitude and
not the energy.
For teleseismic distances (see the option geom_spread_min_teleseismic_distance in Configuration File), the
geometrical spreading coefficient is defined as in Okal [1992] (eq. 4):
𝑎
𝒢(∆) =
𝑔(∆)
where ∆ is the great circle distance between the source and the receiver, 𝑎 is the Earth radius and 𝑔(∆) is defined as:
(︂ ⃒ ⃒)︂1/2
𝜌ℎ 𝑐ℎ sin 𝑖ℎ 1 ⃒⃒ 𝑑𝑖ℎ ⃒⃒
𝑔(∆) =
𝜌𝑟 𝑐𝑟 sin ∆ cos 𝑖𝑟 ⃒ 𝑑∆ ⃒
where 𝜌ℎ and 𝜌𝑟 are the medium densities at the hypocenter and at the receiver, respectively, 𝑐ℎ and 𝑐𝑟 are the P- or
S-wave velocities at the hypocenter and at the receiver, respectively, 𝑖ℎ and 𝑖𝑟 are the takeoff angle (hypocenter) and
𝑑Δ is the variation of the takeoff angle within a ray tube of width ∆
the incidence angle (receiver), respectively, and 𝑑𝑖ℎ
𝑝|𝑠
The data vector is compared to the theoretical model 𝑀𝑡ℎ𝑒𝑜 (𝑓 ) which incorporates the Brune’s spectrum of the seismic
moment and the inelastic attenuation. This model is also converted in magnitude units:
⎡ ⎛ ⎞ ⎤
2 [︁ (︁
𝑝|𝑠
)︁ ]︁ 2⎢ 1 −𝜋𝑓 𝑡* ⎟
𝑌 𝑝|𝑠 (𝑓 ) = log10 𝑀𝑡ℎ𝑒𝑜 (𝑓 ) − 9.1 = ⎣log10 ⎝𝑀𝑂 × )︁2 × 𝑒 ⎠ − 9.1⎦ =
⎜ ⎥
3 3
(︁
𝑓
1 + 𝑝|𝑠
𝑓𝑐
⎡ ⎛ ⎞ ⎤
2 2⎢ 1 (︁ )︁
−𝜋𝑓 𝑡* ⎥
= (log10 𝑀0 − 9.1) + ⎣log10 ⎝ )︁2 ⎠ + log10 𝑒
⎜ ⎟
3 3
(︁ ⎦
𝑓
1 + 𝑝|𝑠
𝑓𝑐
Kaneko and Shearer [2014] compiled a table including their own values for 𝑘 𝑝 and 𝑘 𝑠 as well as values obtained from
other authors. The values are given as a function of the rupture velocity 𝑉𝑟 of a dynamic circular crack (or a static
crack, when 𝑉𝑟 is infinite):
Where “K&S” stands for Kaneko and Shearer [2014], “Mada” for Madariaga [1976], and “S&H” for Sato and Hirasawa
[1973].
where 𝑀0 is the seismic moment (in 𝑁 · 𝑚) and 𝑎 is the source radius (in 𝑚).
where 𝒢 (𝑟) is the squared geometrical spreading coefficient (see above), 𝐶 is a constant discussed below, 𝜌𝑟 and 𝑐𝑟
2
are, respectively, the density and P- or S-wave velocity at the receiver (their product is the seismic impedance), 𝑓𝑚𝑖𝑛
and 𝑓𝑚𝑎𝑥 are the minimum and maximum frequency used to compute the energy (see Configuration File for details
on the Er_freq_range parameter), and the exponential term in the integrand is the squared correction for anelastic
attenuation. The double tilde on top of 𝐸˜
˜𝑟𝑝|𝑠 means that the radiated energy needs to be further corrected for noise and
finite bandwidth (see below).
The constant 𝐶 is defined in Boatwright et al. [2002] (equation 2) as:
⟨𝑅ΘΦ ⟩
𝐶=
𝑅ΘΦ 𝐹
where ⟨𝑅ΘΦ ⟩ is the root mean square P- or S-wave radiation pattern computed on the focal sphere, 𝑅ΘΦ is the radiation
pattern coefficient for the given station, and 𝐹 is the free surface amplification factor. If a focal mechanism is not
available, then it is assumed 𝑅ΘΦ = ⟨𝑅ΘΦ ⟩ and, hence, 𝐶 = 1/𝐹 . This assumption means that we rely on the
averaging between measurements of radiated energy at different stations, instead of precise measurements at a single
station.
Noise correction
To account for low frequency noise, below the corner frequency, under the hypothesis that energy is additive and that
noise is stationary, we compute a noise-corrected energy as:
˜𝑟𝑝|𝑠 = 𝐸
𝐸 ˜˜ 𝑛𝑜𝑖𝑠𝑒
˜˜ 𝑝|𝑠 − 𝐸
𝑟 𝑟
where the first term is the radiated energy computed from the P- or S-wave spectrum and the second term is the radiated
energy computed from the noise spectrum. If the above difference is negative, then the measure is rejected, since the
noise is too large compared to the signal.
Energy partition
The final step is to account for the partition of energy between P and S waves. Following Boatwright and Choy [1986]
(equations 8 and 15) the ratio between the radiated energy measured from S-waves and the radiated energy measured
from P-waves is:
𝐸𝑟𝑠
= 15.6
𝐸𝑟𝑝
The final estimate of the radiated energy is then:
𝐸𝑟 = (1 + 15.6) 𝐸𝑟𝑝
or
(︂ )︂
1
𝐸𝑟 = 1+ 𝐸𝑟𝑠
15.6
𝐸𝑟
𝜎𝑎 = 𝜇ℎ
𝑀0
where 𝜇ℎ is the shear modulus (or rigidity, in 𝑃 𝑎) near the hypocenter, 𝐸𝑟 is the radiated energy (in 𝑁 · 𝑚), and 𝑀0
is the seismic moment (in 𝑁 · 𝑚).
The value of 𝜇ℎ is computed from the shear wave velocity (𝛽ℎ ) and the density (𝜌ℎ ) at the hypocenter, using the
following expression:
𝜇ℎ = 𝜌ℎ 𝛽ℎ2
TWO
SIGNAL PROCESSING
The following documentation explains, in chronological order, all the steps performed to construct the amplitude spectra
used for the inversion.
9
SourceSpec Documentation, Release 1.8+100.g047d4e9
THREE
CLIPPING DETECTION
SourceSpec can optionally check for clipping in the traces. Two algorithms are available for this purpose:
1. “Clipping Score” algorithm (default): compute a trace clipping score based on the shape of the kernel density
estimation.
2. “Clipping Peaks” algorithm: check if trace is clipped, based on the number of peaks in the kernel density
estimation;
Both algorithms are based on the kernel density estimation of the trace amplitude values, using the scipy.stats.
gaussian_kde class. See the documentation of this class for more details on the kernel density.
The clipping detection algorithm is selected through the clipping_detection_algorithm parameter in the Config-
uration File. The algorithm options are set via the configuration file.
Debug plots cand be activated by setting the clipping_debug_plot parameter in the Configuration File to True.
A command line script (clipping_detection) is available to test the clipping detection algorithm on a set of traces.
Run:
$ clipping_detection --help
11
SourceSpec Documentation, Release 1.8+100.g047d4e9
4. The score, ranging from 0 to 100, is the sum of the squared weighted kernel density without the central peak,
normalized by the sum of the squared full weighted kernel density. The score is 0 if there is no additional peak
beyond the central peak.
5. The trace is considered clipped if the score is above the clipping_score_threshold config parameter.
See the clipping_detection.clipping_score() function for more details.
Fig. 1: Example debug plot for the “Clipping Score” algorithm. The score is the sum of the squared weighted kernel
density without the central peak (shaded area), normalized by the sum of the squared full weighted kernel density
(green curve). The largest the peaks far from the central peak, the higher the score.
Fig. 2: Example debug plot for the “Clipping Peaks” algorithm. If there is at least one peak in the amplitude range
corresponding to the clipping_peaks_percentile (yellow areas), the trace is considered clipped.
FOUR
GETTING STARTED
á Note
Note that the default config parameters are suited for a M<5 earthquake recorded within ~100 km. Adjust
win_length, noise_pre_time, the frequency bands (bp_freqmin_*, bp_freqmax_*, freq1_*, freq2_*) and
the bounds on fc and t_star, according to your problem.
source_spec -h
13
SourceSpec Documentation, Release 1.8+100.g047d4e9
source_spec -S
Take your time to go through the generated configuration file (named source_spec.conf): the comments within the
file will guide you on how to set up the different parameters.
More details are in section Configuration File.
FIVE
CONFIGURATION FILE
Configuration file (default name: source_spec.conf) is a plain text file with keys and values in the form key =
value. Comment lines start with #.
Here is the default config file, generated through source_spec -S:
# Option to specify non standard instrument codes (e.g., "L" for accelerometer)
instrument_code_acceleration = None
instrument_code_velocity = None
15
SourceSpec Documentation, Release 1.8+100.g047d4e9
# Trace units.
# Leave it to 'auto' to let the code decide, based on instrument type.
# Manually set it to 'disp', 'vel' or 'acc' if you have already preprocessed
# the traces.
trace_units = auto
# -------- TRACE AND METADATA PARAMETERS
# Start time (in seconds) of the noise window, respect to the P window
(continues on next page)
17
SourceSpec Documentation, Release 1.8+100.g047d4e9
# Start time (in seconds) of the signal window, respect to the P or S arrival
# times (see "wave_type" below)
signal_pre_time = 1.0
# Remove the signal baseline after instrument correction and before filtering
remove_baseline = False
19
SourceSpec Documentation, Release 1.8+100.g047d4e9
# Minimum average spectral S/N ratio, below which a spectrum will be skipped
# This parameter should be preferred to the time domain S/N ratio
# ("sn_min", above) since it better handles band-limited noise.
spectral_sn_min = 0
# Frequency range (Hz) to compute the average spectral S/N ratio
# (comment out or use None to indicate the whole frequency range)
# Example:
# spectral_sn_freq_range = 0.1, 2
spectral_sn_freq_range = None
# -------- SIGNAL/NOISE PARAMETERS
21
SourceSpec Documentation, Release 1.8+100.g047d4e9
23
SourceSpec Documentation, Release 1.8+100.g047d4e9
# Inversion algorithm:
# TNC: truncated Newton algorithm (with bounds)
# LM: Levenberg-Marquardt algorithm
# (warning: Trust Region Reflective algorithm will be used instead if
# bounds are provided)
# BH: basin-hopping algorithm
# GS: grid search
# IS: importance sampling of misfit grid, using k-d tree
inv_algorithm = TNC
25
SourceSpec Documentation, Release 1.8+100.g047d4e9
27
SourceSpec Documentation, Release 1.8+100.g047d4e9
29
SourceSpec Documentation, Release 1.8+100.g047d4e9
SIX
FILE FORMATS
31
SourceSpec Documentation, Release 1.8+100.g047d4e9
"Sn"). Picks with labels that cannot be parsed by SourceSpec will be ignored. If no label is specified, then SourceSpec
will assume that A is the P-pick and T0 is the S-pick.
SEVEN
The SourceSpec Event File format is a custom format, based on YAML, which allows specifying the source properties
for one ore more given events. The following properties can be specified:
• event_id (mandatory): the event ID.
á Note
á Note
If a scalar moment or a moment tensor is given, a Mw magnitude will be (re)computed from it.
• scalar moment (optional): event scalar moment (used when Mw_0_from_event_file in the Configuration
File is set to True)
á Note
If a moment tensor is given, the scalar moment will be (re)computed from it.
• focal_mechanism (optional): event focal mechanism (used for computing radiation pattern when the option
rp_from_focal_mechanism in the Configuration File is set to True).
á Note
If a moment tensor is given, the focal mechanism will be (re)computed from it.
• moment_tensor (optional): event moment tensor (used for computing focal planes and radiation pattern when
the option rp_from_focal_mechanism in the Configuration File is set to True; also used for computing mo-
ment magnitude, to be used when Mw_0_from_event_file is set to True)
See the sample SourceSpec Event File below for more details on the format.
35
SourceSpec Documentation, Release 1.8+100.g047d4e9
or
source_spec -y
# You can specify as many events as you want, as long as they have unique
# event_id's
# - event_id: <EVENT_ID2>
# hypocenter:
# longitude:
# value: <LONGITUDE2>
# units: deg
# latitude:
# value: <LATITUDE2>
# units: deg
# depth:
# value: <DEPTH2>
# units: km
# origin_time: <ORIGIN_TIME2>
# etc...
EIGHT
Spectra produced by SourceSpec can be optionally saved in a HDF5 file named EVID.spectra.hdf5 (where EVID is
the event ID; see the save_spectra option in Configuration File).
Additionally, spectral residuals are always saved to a file named EVID.residuals.hdf5, and average residuals pro-
duced by source_residuals are saved to a file named residual_mean.hdf5.
All these files use an HDF5 based format, detailed in the following section. They can be read using the func-
tion spectrum.read_spectra(), which returns a spectrum.SpectrumStream object, consisting of spectrum.
Spectrum objects.
Example code:
...
>>> print(specst[0])
Spectrum CI.CCA..HHE | 200 samples, 0.2-39.9 Hz | 0.2 Hz sample interval | 59 samples␣
˓→logspaced, 0.20-41.70 Hz | 0.04 log10([Hz]) sample interval logspaced
>>> print(specst[0].stats)
{'delta': 0.1996007984031936,
'npts': 200,
'delta_logspaced': 0.040000000000000036,
'npts_logspaced': 59,
'station': 'CCA',
'network': 'CI',
'location': '',
(continues on next page)
39
SourceSpec Documentation, Release 1.8+100.g047d4e9
Additionally, spectrum.SpectrumStream and spectrum.Spectrum objects can be saved to a text file format, with
one Spectrum per file. The details of this format are explained below.
Here is an example of how to read an HDF5 file and save it to a text file:
>>> from sourcespec.spectrum import read_spectra
>>> specst = read_spectra('38471103.spectra.hdf5')
>>> specst.write('38471103.spectra.txt', format='TEXT')
>>> from os import listdir
>>> print('\n'.join(sorted(listdir('.'))))
...
38471103.spectra_0000.txt
38471103.spectra_0001.txt
38471103.spectra_0002.txt
38471103.spectra_0003.txt
38471103.spectra_0004.txt
38471103.spectra_0005.txt
38471103.spectra_0006.txt
38471103.spectra_0007.txt
38471103.spectra_0008.txt
38471103.spectra_0009.txt
38471103.spectra_0010.txt
...
>>> specst0 = read_spectra('38471103.spectra_0000.txt', format='TEXT')
>>> print(specst0)
SpectrumStream with 1 Spectrum objects:
CI.CCA..HHE | 200 samples, 0.2-39.9 Hz | 0.2 Hz sample interval | 59 samples logspaced,␣
˓→0.20-41.70 Hz | 0.04 log10([Hz]) sample interval logspaced
NINE
INSTALLATION
SourceSpec requires at least Python 3.7. All the required dependencies will be downloaded and installed during the
setup process.
45
SourceSpec Documentation, Release 1.8+100.g047d4e9
or
Where, X.Y is the version number (e.g., 1.2). You don’t need to uncompress the release files yourself.
Run this command again, from times to times, to keep SourceSpec updated with the development version.
(avoid using the “Download ZIP” option from the green “Code” button, since version number is lost).
Then, go into the sourcespec main directory and install the code in “editable mode” by running:
pip install -e .
You can keep your local SourceSpec repository updated by running git pull from times to times. Thanks to pip’s
“editable mode”, you don’t need to reinstall SourceSpec after each update.
46 Chapter 9. Installation
CHAPTER
TEN
SAMPLE RUNS
47
SourceSpec Documentation, Release 1.8+100.g047d4e9
ELEVEN
GETTING HELP
49
SourceSpec Documentation, Release 1.8+100.g047d4e9
TWELVE
CONTRIBUTING
51
SourceSpec Documentation, Release 1.8+100.g047d4e9
THIRTEEN
HOW TO CITE
53
SourceSpec Documentation, Release 1.8+100.g047d4e9
FOURTEEN
SOURCESPEC API
SourceSpec has a modular structure. Each module corresponds to a specific function or class of functions.
14.1.1 source_spec.py
Earthquake source parameters from inversion of P- or S-wave spectra.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>, Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
source_spec.main()
Main routine for source_spec.
14.1.2 ssp_parse_arguments
Argument parser for sourcespec.
copyright
2021-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_parse_arguments.parse_args(progname)
Parse command line arguments.
14.1.3 ssp_setup
Setup functions for sourcespec.
copyright
2012 Claudio Satriano <[email protected]>
55
SourceSpec Documentation, Release 1.8+100.g047d4e9
14.1.4 ssp_read_traces
Read traces in multiple formats of data and metadata.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>
2015-2025 Claudio Satriano <[email protected]>,
Sophie Lambotte <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_read_traces.read_traces(config)
Read traces, store waveforms and metadata.
14.1.5 ssp_process_traces
Trace processing for sourcespec.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_process_traces.filter_trace(config, trace)
Filter trace.
ssp_process_traces.process_traces(config, st)
Remove mean, deconvolve and ignore unwanted components.
14.1.6 ssp_build_spectra
Build spectral objects.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>, Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
exception ssp_build_spectra.SpectrumIgnored(message, reason)
Spectrum ignored exception
ssp_build_spectra.build_spectra(config, st)
Build spectra and the spec_st object.
Computes P- or S-wave (displacement) spectra from accelerometers and velocimeters, uncorrected for anelastic
attenuation, corrected for instrumental constants, normalized by geometrical spreading.
14.1.7 ssp_plot_traces
Trace plotting routine.
copyright
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_plot_traces.ScalarFormatter(*args: Any, **kwargs: Any)
A ScalarFormatter with a custom format.
ssp_plot_traces.plot_traces(config, st, ncols=None, block=True, suffix=None)
Plot raw (counts) or processed traces (instrument units and filtered).
Display to screen and/or save to file.
14.1.8 ssp_inversion
Spectral inversion routines for sourcespec.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>, Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_inversion.spectral_inversion(config, spec_st, weight_st)
Inversion of displacement spectra.
14.1.9 ssp_radiated_energy
Compute radiated energy from spectral integration.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>, Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_radiated_energy.radiated_energy_and_apparent_stress(config, spec_st, specnoise_st,
sspec_output)
Compute radiated energy (in N.m) and apparent stress (in MPa).
Parameters
• config – Config object
• type (sspec_output) – sourcespec.config.Config
• spec_st – Stream of spectra
• type – obspy.core.stream.Stream
• specnoise_st – Stream of noise spectra
• type – obspy.core.stream.Stream
• sspec_output – Output of spectral inversion
• type – sourcespec.ssp_data_types.SourceSpecOutput
14.1.10 ssp_local_magnitude
Local magnitude calculation for sourcespec.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>
14.1.11 ssp_summary_statistics
Post processing of station source parameters.
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_summary_statistics.compute_summary_statistics(config, sspec_output)
Compute summary statistics from station spectral parameters.
14.1.12 ssp_output
Output functions for source_spec.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_output.save_spectra(config, spec_st)
Save spectra to file.
ssp_output.write_output(config, sspec_output)
Write results into different formats.
14.1.13 ssp_residuals
Spectral residual routine for sourcespec.
copyright
2013-2014 Claudio Satriano <[email protected]>,
Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_residuals.spectral_residuals(config, spec_st, sspec_output)
Compute spectral residuals with respect to an average spectral model. Saves a stream of residuals to disk in
HDF5 format.
Parameters
14.1.14 ssp_plot_spectra
Spectral plotting routine.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_plot_spectra.PlotParams
Parameters for plotting spectra.
set_plot_params(config, spec_st, specnoise_st)
Determine the number of plots and axes min and max.
ssp_plot_spectra.plot_spectra(config, spec_st, specnoise_st=None, ncols=None, stack_plots=False,
plot_type='regular')
Plot spectra for signal and noise.
Display to screen and/or save to file.
14.1.15 ssp_plot_stacked_spectra
Plot stacked spectra, along with summary inverted spectrum.
copyright
2023-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_plot_stacked_spectra.plot_stacked_spectra(config, spec_st, weight_st, sspec_output)
Plot stacked spectra, along with summary inverted spectrum.
14.1.16 ssp_plot_params_stats
Plot parameter statistics.
copyright
2022-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_plot_params_stats.PlotParam(name, unit, color)
A plot parameter.
ssp_plot_params_stats.box_plots(config, sspec_output)
Show parameter statistics through box plots.
14.1.17 ssp_plot_stations
14.1.18 ssp_html_report
Generate an HTML report for source_spec.
copyright
2021-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_html_report.HTMLtemplates
Class to hold paths to HTML templates.
ssp_html_report.html_report(config, sspec_output)
Generate an HTML report.
14.2.1 ssp_correction
Spectral station correction calculated from ssp_residuals.
copyright
2013-2014 Claudio Satriano <[email protected]>,
Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_correction.station_correction(spec_st, config)
Correct spectra using station-average residuals.
Residuals are obtained from a previous run.
14.2.2 ssp_data_types
Classes for spectral inversion routines.
copyright
2017-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_data_types.Bounds(config, spec, initial_values)
Bounds for bounded spectral inversion.
property bounds
Get bounds for minimize() as sequence of (min, max) pairs.
get_bounds_curve_fit()
Get bounds for curve-fit().
If n is None, then the above check is skipped. Nan and inf values are also marked as outliers.
mean_nobs()
Return a dictionary of number of observations used for computing mean.
mean_uncertainties()
Return a dictionary of mean uncertainties.
mean_values()
Return a dictionary of mean values.
outlier_array(key)
Return an array of outliers for the given key.
percentiles_nobs()
Return a dictionary of number of observations used for computing percentiles.
percentiles_uncertainties()
Return a dictionary of percentile uncertainties.
percentiles_values()
Return a dictionary of percentile values.
reference_summary_parameters()
Return a dictionary of reference summary parameters, each being a SummaryStatistics() object.
reference_uncertainties()
Return a dictionary of reference uncertainties.
reference_values()
Return a dictionary of reference values.
value_array(key, filter_outliers=False)
Return an array of values for the given key.
weighted_mean_nobs()
Return a dictionary of number of observations used for computing weighted mean.
weighted_mean_uncertainties()
Return a dictionary of weighted mean uncertainties.
weighted_mean_values()
Return a dictionary of weighted mean values.
class ssp_data_types.SpectralParameter(param_id, name=None, units=None, value=None,
uncertainty=None, lower_uncertainty=None,
upper_uncertainty=None, confidence_level=None,
format_spec=None)
A spectral parameter measured at one station.
compact_uncertainty()
Return uncertainty in a compact form.
class ssp_data_types.StationParameters(station_id, instrument_type=None, latitude=None,
longitude=None, hypo_dist_in_km=None, epi_dist_in_km=None,
azimuth=None)
The parameters describing a given station (e.g., its id and location) and the spectral parameters measured at that
station.
Spectral parameters are provided as attributes, using SpectralParameter() objects.
get_spectral_parameters()
Return a dictionary of spectral parameters.
class ssp_data_types.SummarySpectralParameter(param_id, name=None, units=None,
format_spec=None)
A summary spectral parameter comprising one ore more summary statistics.
class ssp_data_types.SummaryStatistics(stat_type, value=None, uncertainty=None,
lower_uncertainty=None, upper_uncertainty=None,
confidence_level=None, lower_percentage=None,
mid_percentage=None, upper_percentage=None, nobs=None,
message=None, format_spec=None)
A summary statistics (e.g., mean, weighted_mean, percentile), along with its uncertainty.
compact_uncertainty()
Return uncertainty in a compact form.
14.2.3 ssp_event
SourceSpec event class and supporting classes.
copyright
2023-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
14.2.4 ssp_geom_spreading
Functions to compute geometrical spreading coefficients.
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_geom_spreading.geom_spread_boatwright(hypo_dist_in_km, cutoff_dist_in_km, freqs)
” Geometrical spreading coefficient from Boatwright et al. (2002), eq. 8.
Except that we take the square root of eq. 8, since we correct amplitude and not energy.
Parameters
• hypo_dist_in_km (float) – Hypocentral distance (km).
• cutoff_dist_in_km (float) – Cutoff distance (km).
• freqs (numpy.ndarray) – Frequencies (Hz).
Returns
Geometrical spreading correction (in m)
Return type
numpy.ndarray
ssp_geom_spreading.geom_spread_r_power_n(hypo_dist_in_km, exponent)
r geometrical spreading coefficient.
Parameters
• hypo_dist_in_km (float) – Hypocentral distance (km).
• exponent (float) – Exponent.
Returns
Geometrical spreading correction (in m)
Return type
float
ssp_geom_spreading.geom_spread_r_power_n_segmented(hypo_dist_in_km, exponents, hinge_distances)
Geometrical spreading function defined as piecewise continuous powerlaw, as defined in Boore (2003), eq. 9
Parameters
• hypo_dist_in_km (float) – Hypocentral distance (km).
• exponents (numpy.ndarray) – Exponents for different powerlaw segments
• hinge_distances (numpy.ndarray) – Distances defining start of powerlaw segments
Returns
Geometrical spreading correction (for distance in m)
Return type
float
ssp_geom_spreading.geom_spread_teleseismic(angular_distance, source_depth_in_km,
station_depth_in_km, phase)
Calculate geometrical spreading coefficient for teleseismic body waves.
Implements eq (4) in Okal (1992) for a spherically symmetric Earth. This equations is derived from the conser-
vation of the kinetic energy flux along a ray tube between the source and the receiver.
Parameters
• angular_distance (float) – Angular distance (degrees).
• source_depth_in_km (float) – Source depth (km).
• station_depth_in_km (float) – Station depth (km).
• phase (str) – Phase type ('P' or 'S').
Returns
Geometrical spreading correction (in m)
Return type
float
ssp_geom_spreading.plot_geom_spread_models(source_depth, epi_dists, models=None, plottype='linlog',
xaxis='epi_dist', return_fig=False)
Plot geometrical spreading coefficients for different models.
Parameters
• source_depth (float) – Source depth (km).
• epi_dists (numpy.ndarray) – Epicentral distances (km).
• models (list[tuple[str, dict or None]]) – List of tuples where each tuple contains:
– The model name.
– A dictionary of model parameters (or None if the model has no parameters or to use de-
faults).
Valid model names are:
– 'r_power_n': r geometrical spreading.
– 'r_power_n_segmented': Piecewise continuous power law, as defined in Boore (2003),
eq. 9.
– 'boatwright': Boatwright et al. (2002).
– 'teleseismic': Teleseismic (Okal, 1992).
If None, defaults to [('r_power_n', {'exponent': 1})].
• plottype (str) – Type of plot scaling. Options:
– 'linlin'
– 'linlog'
– 'loglin'
– 'loglog'
• xaxis (str) – X-axis type. Options:
– 'epi_dist': Epicentral distance.
– 'hypo_dist': Hypocentral distance.
• return_fig (bool) – If True, return the figure instead of showing it.
Returns
Matplotlib figure, if return_fig is True.
Return type
matplotlib.figure.Figure
Examples
14.2.5 ssp_grid_sampling
A class for sampling a parameter space over a grid.
Sampling can be performed by several approaches. The class provides optimal solutions, uncertainties and plotting
methods.
copyright
2022-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_grid_sampling.GridSampling(misfit_func, bounds, nsteps, sampling_mode, params_name,
params_unit)
A class for sampling a parameter space over a grid.
Sampling can be performed by several approaches. The class provides optimal solutions, uncertainties and plot-
ting methods.
property conditional_misfit
Compute conditional misfit along each dimension.
Conditional misfit is computed by fixing the other parameters to their optimal value.
property conditional_peak_widths
Find width of conditional misfit around its minimum.
grid_search()
Sample the misfit function by simple grid search.
kdtree_search()
Sample the misfit function using kdtree search.
property min_idx
Find the index of the minimum of the misfit function.
property params_err
Return optimal parameters uncertainties.
property params_opt
Return optimal parameters.
plot_conditional_misfit(config, label)
Plot conditional misfit for each parameter.
plot_misfit_2d(config, plot_par_idx, label)
Plot a 2D conditional misfit map.
property values
Return a meshgrid of parameter values.
property values_1d
Extract a 1D array of parameter values along one dimension.
ssp_grid_sampling.find_peak_width(x, peak_idx, rel_height, negative=False)
Find width of a single peak at a given relative height.
rel_height: float parameter between 0 and 1
0 means the base of the curve and 1 the peak value (Note: this is the opposite of scipy.peak_widths)
14.2.6 ssp_pick
SourceSpec pick class.
copyright
2023-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_pick.SSPPick
A pick object.
14.2.7 ssp_spectral_model
Spectral model and objective function.
copyright
2012 Claudio Satriano <[email protected]>
2013-2014 Claudio Satriano <[email protected]>,
Emanuela Matrullo <[email protected]>, Agnes Chounet <[email protected]>
2015-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_spectral_model.callback(_)
Empty callback function for bounded inversion.
ssp_spectral_model.objective_func(xdata, ydata, weight)
Objective function generator for bounded inversion.
ssp_spectral_model.spectral_model(freq, Mw, fc, t_star, alpha=1.0)
Spectral model.
[︃ (︃ (︂ )︂2 )︃ ]︃
2 𝑓 *
𝑌𝑑𝑎𝑡𝑎 = 𝑀𝑤 + − log10 1 + − 𝜋 𝑓 𝑡 log10 𝑒
3 𝑓𝑐
14.2.8 ssp_qml_output
QuakeML output for source_spec.
copyright
2016-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement, Version 2.1 (http://www.cecill.info/index.en.html)
class ssp_qml_output.SSPContainerTag(*args: Any, **kwargs: Any)
Container for nested custom tags.
class ssp_qml_output.SSPExtra(*args: Any, **kwargs: Any)
Container for custom tags.
class ssp_qml_output.SSPTag(*args: Any, **kwargs: Any)
Custom tag object.
ssp_qml_output.write_qml(config, sspec_output)
Write QuakeML output.
14.2.9 ssp_radiation_pattern
Compute radiation pattern.
copyright
2021-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_radiation_pattern.get_radiation_pattern_coefficient(stats, config)
Get radiation pattern coefficient.
ssp_radiation_pattern.radiation_pattern(strike, dip, rake, takeoff_angle, azimuth, wave)
Body wave radiation pattern.
From Lay-Wallace, page 340.
ssp_radiation_pattern.toRad(angle)
Convert angle from degrees to radians.
14.2.10 ssp_read_sac_header
Read metadata from SAC file headers.
copyright
2023-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_read_sac_header.compute_sensitivity_from_SAC(trace, config)
Compute sensitivity from SAC header fields.
ssp_read_sac_header.get_event_from_SAC(trace)
Get event information from SAC header.
ssp_read_sac_header.get_instrument_from_SAC(trace)
Get instrument information from SAC header.
ssp_read_sac_header.get_picks_from_SAC(trace)
Get picks from SAC header.
ssp_read_sac_header.get_station_coordinates_from_SAC(trace)
Get station coordinates from SAC header.
14.2.11 ssp_read_station_metadata
Read station metadata in StationXML, dataless SEED, SEED RESP, PAZ (SAC polezero format).
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_read_station_metadata.PAZ(file=None)
Instrument response defined through poles and zeros.
property seedID
Return the seedID.
to_inventory()
Convert PAZ object to an Inventory object.
ssp_read_station_metadata.read_station_metadata(path)
Read station metadata into an ObsPy Inventory object.
Parameters
path (str) – path to the station metadata file or directory
Returns
inventory
Return type
Inventory
14.2.12 ssp_sqlite_output
SQLite output for source_spec.
copyright
2013-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_sqlite_output.write_sqlite(config, sspec_output)
Write SSP output to SQLite database.
Parameters
• config (config.Config) – SSP configuration object
• sspec_output (ssp_data_types.SourceSpecOutput) – SSP output object
14.2.13 ssp_update_db
Update an existing SourceSpec database from a previous version.
copyright
2013-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_update_db.update_db_file(db_file)
Update an existing SourceSpec database from a previous version.
Parameters
db_file (str) – SQLite database file
14.2.14 ssp_util
Utility functions for sourcespec.
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class ssp_util.MediumProperties(lon, lat, depth_in_km, config)
Class to retrieve medium properties from config.
Parameters
• lon (float) – Longitude (degrees).
• lat (float) – Latitude (degrees).
• depth_in_km (float) – Depth (km).
• config (Config) – Configuration object.
get(mproperty, where)
Get medium property (P- or S-wave velocity, density) at a given point from NLL grid, config or taup model.
Parameters
• mproperty (str) – Property to be retrieved ('vp', 'vs' or 'rho').
ssp_util.toRad(degrees)
Convert degrees to radians.
14.2.15 ssp_wave_arrival
Arrival time calculation for sourcespec.
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
ssp_wave_arrival.add_arrival_to_trace(trace, phase, config)
Add arrival time, travel time and takeoff angle to trace for the given phase.
Uses the theoretical arrival time if no pick is available or if the pick is too different from the theoretical arrival.
14.2.16 config
Config class for sourcespec.
copyright
2013-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class config.Config
Config class for sourcespec.
14.2.17 kdtree
Grid importance sampling using a k-d tree.
copyright
2022-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class kdtree.KDTCell(extent, calc_pdf , min_cell_prob=0, ndiv=None, maxdiv=None)
A cell of a k-d tree.
divide(parts)
Divide the cell in parts parts along every dimension.
class kdtree.KDTree(extent, init_parts, calc_pdf , min_cell_prob=0.0, maxdiv=None)
A k-d tree.
divide()
Find the cell with highest probability and divide it in 2 parts along every dimension
get_pdf(deltas)
Calculate the probability density function (PDF) on a grid defined by deltas.
14.2.18 savefig
Save Matplotlib figure. Optimize PNG format using PIL.
copyright
2022-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
savefig.savefig(fig, figfile, fmt, quantize_colors=True, use_threading=True, **kwargs)
Save Matplotlib figure. Optimize PNG format using PIL.
Parameters
• fig (matplotlib.figure.Figure) – Matplotlib figure to save.
• figfile (str) – Output file name.
• fmt (str) – Output format (e.g., ‘png’, ‘pdf’, ‘svg’).
• quantize_colors (bool, optional) – If True (default), reduce the number of colors in the
PNG image.
• use_threading (bool, optional) – If True (default), save the figure in a separate thread.
• **kwargs – Additional keyword arguments for fig.savefig.
14.2.19 spectrum
Define Spectrum and SpectrumStream classes, similar to ObsPy’s Trace and Stream.
Provides the high-level function read_spectra() to read SpectrumStream objects from HDF5 or TEXT files.
copyright
2012-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class spectrum.AttributeDict(*args, **kwargs)
A dictionary that allows attribute-style access.
class spectrum.Spectrum(obspy_trace=None)
A class to handle amplitude spectra.
Parameters
obspy_trace – An ObsPy Trace object to compute the spectrum from.
copy()
Return a copy of the spectrum.
property data
Return the array containing the amplitude spectrum.
property data_logspaced
Return the array containing the amplitude spectrum in logspaced frequencies.
property data_mag
Return the array containing the amplitude spectrum in mangitude units.
property data_mag_logspaced
Return the array containing the amplitude spectrum in logspaced frequencies in magnitude units.
property freq
Return the frequency axis of the spectrum.
property freq_logspaced
Return the logspaced frequency axis of the spectrum.
from_obspy_trace(trace)
Compute the spectrum from an ObsPy Trace object.
get_id()
Return the id of the spectrum.
property id
Return the id of the spectrum.
plot(**kwargs)
Plot the amplitude spectrum.
slice(fmin, fmax, nearest_sample=True, pad=False, fill_value=None)
Slice the spectrum between fmin and fmax.
Parameters
• fmin – Minimum frequency.
• fmax – Maximum frequency.
• nearest_sample – If True, the slice will include the nearest frequency to fmin and fmax.
• pad – If True, the slice will be padded with the value of fill_value until fmin and fmax are
included.
• fill_value – The value to use for padding.
Note
Only the linear spaced frequencies, data and data_mag are sliced. If the original spectrum
contains logspaced frequencies, data, and data_mag, those are not preserved in the sliced
spectrum.
write(filename, format='HDF5', append=False)
Write the spectrum to a file.
Parameters
• filename – The name of the file to write to.
• format – The format to use. One of ‘HDF5’ or ‘TEXT’. Default is ‘HDF5’.
• append – If True, append the spectrum to an existing file. Only valid for HDF5 format.
class spectrum.SpectrumStream(iterable=(), / )
A class to handle a collection of amplitude spectra.
append(spectrum)
Append a spectrum to the collection.
select(**kwargs)
Select a subset of the SpectrumStream.
sort(reverse=False)
Sort the SpectrumStream in place.
write(filename, format='HDF5')
Write the SpectrumStream to a file.
Parameters
• filename – The name of the file to write to.
• format – The format to use. One of ‘HDF5’ or ‘TEXT’.
spectrum.read_spectra(pathname, format='HDF5')
Read a SpectrumStream from one ore more files.
Parameters
• pathname – The pathname of the files to read. Can contain wildcards.
• format – The format to use. One of ‘HDF5’ or ‘TEXT’. Default is ‘HDF5’.
Returns
The SpectrumStream object.
spectrum.signal_fft(signal, delta)
Compute the complex Fourier transform of a signal.
Parameters
• signal – The signal to transform.
• delta – The sampling interval.
Returns
The Fourier transform and the frequency axis.
14.2.20 clipping_detection
Check trace for clipping using kernel density estimation of the trace= amplitude values.
Two methods are available:
1. clipping_score(): compute a trace clipping score based on the shape of the kernel density estimation.
2. clipping_peaks(): check if trace is clipped, based on the number of peaks in the kernel density estima-
tion;
copyright
2023-2025 Claudio Satriano <[email protected]>,
Kris Vanneste <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
clipping_detection.check_min_amplitude(trace, min_amplitude_ratio)
Check if trace amplitude is above a minimum threshold computed from the instrument sensitivity.
Parameters
• trace (Trace) – Trace to check. Must have an attached inventory.
• min_amplitude_fraction (float) – Minimum trace amplitude, as a fraction of the over-
all sensitivity of the instrument, to check for clipping. Valid values are between 0 and 1.
Returns
• bool – True if trace amplitude is above the minimum threshold, False otherwise.
Parameters
• trace (obspy.core.trace.Trace) – Trace to check.
• sensitivity (int) – Sensitivity level, from 1 (least sensitive) to 5 (most sensitive). (de-
fault: 3). The sensitivity level controls the minimum prominence threshold used for peak
detection in the kernel density estimation. See the scipy.signal.find_peaks() docu-
mentation for more details.
• clipping_percentile (float, between 0 and 100) – Percentile of trace amplitude range
(expressed as percentage) to check for clipping. Default is 10, which means that the 10%
highest and lowest values of the trace amplitude will be checked for clipping. A value of 0
means that no clipping check will be performed.
• debug (bool) – If True, plot trace, samples histogram and kernel density.
Returns
• trace_clipped (bool) – True if trace is clipped, False otherwise.
• properties (dict) – Dictionary with the properties used for the clipping detection. The
dictionary contains the following keys:
– npeaks (int): number of peaks found in the kernel density
– npeaks_clipped (int): number of peaks found in the kernel density that are considered
clipped
– peaks (numpy.ndarray): list of peaks found in the kernel density
– prominences (numpy.ndarray): list of prominences of the peaks found in the kernel den-
sity
Parameters
• trace (Trace) – Trace to check for clipping.
• remove_baseline (bool, optional) – If set, remove the trace baseline before computing
the score.
• debug (bool, optional) – If set, plot the trace, the samples histogram, the kernel density
(unweighted and weighted), the kernel baseline model, and the misfit. Default is False.
Returns
clipping_score – Clipping score, in percentage.
Return type
float
á Note
Distorted traces (e.g., signals with strong baselines) can also get a high clipping score. To avoid this, the
trace baseline can be removed.
A debug mode is available to plot the trace, the samples histogram, the kernel density (unweighted and
weighted), the kernel baseline model, and the misfit.
clipping_detection.main()
Main function
14.2.21 plot_sourcepars
plot_sourcepars.py
1D or 2D plot of source parameters from a sqlite parameter file.
copyright
2023-2025 Claudio Satriano <[email protected]>
license
CeCILL Free Software License Agreement v2.1 (http://www.cecill.info/licences.en.html)
class plot_sourcepars.Annot(xdata, ydata, labels, yformat, xformat=None)
Annotate the plot with the evid, Mw and the value of the parameter.
class plot_sourcepars.Params(args)
Class to handle the parameters from a sqlite file.
plot_mw_time(colorby=None, colormap=None)
Plot the moment magnitude vs time.
Parameters
• colorby (str) – Color the data points by the given parameter.
• colormap (str) – Use this colormap for the colorby parameter instead of the default.
plot_ssd_depth(hist=False, fit=False, nbins=None, colorby=None, colormap=None)
Plot the logarithm of static stress drop vs depth.
Parameters
• hist (bool) – If True, plot a 2D histogram instead of a scatter plot.
• fit (bool) – If True, plot a linear regression of ssd vs depth.
• nbins (int) – Number of bins for the 2D histogram.
• colorby (str) – Color the data points by the given parameter.
• colormap (str) – Use this colormap for the colorby parameter instead of the default.
plot_ssd_mw(hist=False, fit=False, nbins=None, colorby=None, colormap=None)
Plot the logarithm of static stress drop vs moment magnitude.
Parameters
• hist (bool) – If True, plot a 2D histogram instead of a scatter plot.
• fit (bool) – If True, plot a linear regression of ssd vs mw.
• nbins (int) – Number of bins for the 2D histogram.
• colorby (str) – Color the data points by the given parameter.
• colormap (str) – Use this colormap for the colorby parameter instead of the default.
skip_events(idx)
Skip events with index idx.
plot_sourcepars.apparent_stress_curve_Er_mw(sigma_a, mu, mw)
Constant apparent stress curve in Er vs Mw.
Madariaga (2009), doi:10.1007/978-1-4419-7695-6_22, eq. 33., page 374.
plot_sourcepars.calc_r2(x, y, yerr, a, b)
Coefficient of determination.
plot_sourcepars.compute_mc(magnitudes, magn_bin, vector_compl, pval)
Compute the magnitude of completeness of a seismic catalog using the method in Taroni 2023 - TSR, https:
//doi.org/10.1785/0320230017.
This code is translated from the original MATLAB code provided by Matteo Taroni.
Parameters:
magnitudes
[np.ndarray] Vector of magnitudes.
magn_bin
[float] Binning of the magnitudes (e.g., 0.01 or 0.1).
vector_compl
[np.ndarray] Vector of completeness values to analyze.
pval
[float] P-value threshold for the complete part of the catalog (e.g., 0.1).
Returns:
mc
[float] The magnitude of completeness of the catalog.
plot_sourcepars.fc_mw_function(mw, a, b)
Function to fit fc vs Mw.
plot_sourcepars.fit_gutenberg_richter(bin_centers, cum_nevs, mc)
Fit the Gutenberg-Richter law to the data points.
Parameters:
bin_centers
[np.ndarray] Bin centers.
cum_nevs
[np.ndarray] Cumulative number of events.
mc
[float] Magnitude of completeness.
Returns:
a, b
[float] G-R law parameters.
plot_sourcepars.get_colormap(parameter)
Get a colormap for the parameter.
plot_sourcepars.get_param_label(parameter)
Get the label for the parameter.
plot_sourcepars.mag_to_moment(mag, b=0.5)
Convert magnitude to moment.
The parameter b is used to change the slope of the fc-Mw stress drop curve.
The standard value of b is 0.5, which corresponds to a self-similar model.
plot_sourcepars.main()
Main function.
plot_sourcepars.moment_to_mag(moment, b=0.5)
Convert moment to magnitude.
The parameter b is used to change the slope of the fc-Mw stress drop curve.
The standard value of b is 0.5, which corresponds to a self-similar model.
plot_sourcepars.parse_args()
Parse command line arguments.
FIFTEEN
SOURCESPEC CHANGELOG
15.1 unreleased
15.1.1 Input/output
• Fix np.float64 being printed in logs and YAML output when using NumPy>=2
• HTML report improvements:
– Link to supplementary files and plots in the HTML report
– Display configuration, log and output files in a modal window with syntax highlighting (only when the
HTML report is served by a web server)
15.1.2 Processing
• New option r_power_n_segmented for the geom_spread_model config parameter to use a segmented geo-
metrical spreading model with different powers for different distance ranges
• New config parameter refine_theoretical_arrivals to refine the theoretical P and S arrival times using a
simple autopicker based on the smoothed envelope of the trace
• New config parameter clipping_min_amplitude_ratio to set a threshold for trace amplitude below which
the trace is not checked for clipping
• Use spectral interpolation to compute and apply station residuals
15.1.3 Post-Inversion
• New option for source_residuals: --runid to select a specific run when multiple runs exist for the same
event
15.1.4 Plotting
• New plot: raw traces
• Stacked spectra: color spectral curves according to the weighting function
• Spectral plots: show information on the reason why a fit failed
• plot_sourcepars: possibility of selecting the latest runid for each event
• plot_sourcepars: new plot type: static stress drop vs. depth
85
SourceSpec Documentation, Release 1.8+100.g047d4e9
15.1.6 Bugfixes
• Fix for rejected spectra still being plotted in the stacked spectra plot
• Fix for corner case where all the inversion errors are zero
• Fix I/O error when reading PAZ files
• Fix for event ids in SourceSpec event file being only numbers: they are now correctly interpreted as strings
• Fix for ignored picks for certain kind of QuakeML files (like the ones from USGS) where the phase name is
not in the <phase_hint> attribute of the <pick> element but in the <phase> attribute of the corresponding
<arrival> element
• Stabilize the computation of derivatives in the Okal geometrical spreading model, thus avoiding numerical in-
stabilities.
• Speed up map plotting when using coastlines
• Gently skip building spectra for station with very short data windows (less than 10 samples)
• Fix for sensitivity config parameter always requiring a SAC file. Now, if sensitivity is a numerical value,
any file format is accepted.
• New command line option (-R or --run_id_subdir) to use run_id (if defined) as a subdirectory of the event
directory
• Print event info to console and to log file
• HTML report improvements:
– Event name in the summary table, if available
– Author, agency and run completion date in the summary table
– SourceSpec version in the inversion information table
– Link to input files
– Information on the type of wave used for the inversion (P, S, SV or SH)
• For parameters with no station-level uncertainty defined (currently, radiated energy and local magnitude), use
simple mean when computing summary weighted averages (the previous behavior was to not compute weighted
averages for these parameters)
A new plot is introduced, “stacked spectra” which allows to compare all the spectra at once (and easily detect problem-
atic stations ). Also, a new command line tool, plot_sourcepars, allows making aggregate plots of source parameters
for many events (starting from the SQLite database).
New config file parameters have been added, while some have been removed. Please run source_spec -U
CONFIG_FILE_NAME to update your old config file.
As always, many bugfixes and improvements have been made in this release. Thanks to all the users who took time to
write and ask questions (by mail or using the official SourceSpec Discussions).
Big kudos to Kris Vanneste @krisvanneste who helped all along the development with code review and testing and
submitted pull requests on noise windows and clipping detection.
Below is the detailed Changelog
– Constrain signal_pre_time for S-phase to half the S-P interval, if this interval is shorter than
signal_pre_time (i.e., for short-distance records with short S-P interval)
• Extract source and station P and S velocities from global ‘iasp91’ velocity model, if both v(p,s)_source and
v(p,s)_stations are set to None (see #20)
• Magnitude limits for inversion are now autoset between 90% of the minimum of the spectral plateau and 110%
of its maximum (see #22)
• Station table in HTML report is now sortable (and its header remains fixed)!
• Reduce PNG figures file size, while improving their resolution
• Removed option to read event information and traces from a pickle file (rarely used)
The following is a list, probably incomplete, of journal and conference papers that have used SourceSpec and that I’m
aware of. If you have used SourceSpec in a publication and would like to have it listed here, please let me know.
SIXTEEN
• genindex
• modindex
• search
105
SourceSpec Documentation, Release 1.8+100.g047d4e9
[1] Raul Madariaga. Earthquake scaling laws. In Extreme Environmental Events, pages 364–383. Springer New
York, New York, NY, 2011. URL: https://www.researchgate.net/publication/226065848_Earthquake_Scaling_
Laws, doi:10.1007/978-1-4419-7695-6_22.
[2] James N. Brune. Tectonic stress and the spectra of seismic shear waves from earthquakes. Journal of Geophysical
Research (1896-1977), 75(26):4997–5009, 1970. doi:10.1029/JB075i026p04997.
[3] John Boatwright, George L. Choy, and Linda C. Seekins. Regional Estimates of Radiated Seismic Energy. Bul-
letin of the Seismological Society of America, 92(4):1241–1255, 05 2002. doi:10.1785/0120000932.
[4] Emile A. Okal. A student's guide to teleseismic body wave amplitudes. Seismological Research Letters,
63(2):169–180, April 1992. doi:10.1785/gssrl.63.2.169.
[5] Maria Lancieri, Raul Madariaga, and Fabian Bonilla. Spectral scaling of the aftershocks of the Tocopilla 2007
earthquake in northern Chile. Geophysical Journal International, 189(1):469–480, 04 2012. doi:10.1111/j.1365-
246X.2011.05327.x.
[6] Yoshihiro Kaneko and Peter M. Shearer. Seismic source spectra and estimated stress drop derived from cohesive-
zone models of circular subshear rupture. Geophysical Journal International, 197(2):1002–1015, March 2014.
doi:10.1093/gji/ggu030.
[7] Raul Madariaga. Dynamics of an expanding circular fault. Bulletin of the Seismological Society of America,
66(3):639–666, June 1976. doi:10.1785/bssa0660030639.
[8] Tamao Sato and Tomowo Hirasawa. Body wave spectra from propagating shear cracks. Journal of Physics of the
Earth, 21(4):415–431, 1973. doi:10.4294/jpe1952.21.415.
[9] Massimo Di Bona and Antonio Rovelli. Effects of the bandwidth limitation of stress drops estimated from inte-
grals of the ground motion. Bulletin of the Seismological Society of America, 78(5):1818–1825, 10 1988. URL:
http://bssa.geoscienceworld.org/cgi/doi/10.1785/BSSA0780051818, doi:10.1785/BSSA0780051818.
[10] John Boatwright and George L. Choy. Teleseismic estimates of the energy radiated by shallow earthquakes.
Journal of Geophysical Research, 91(B2):2095, 1986. doi:10.1029/jb091ib02p02095.
[J1] C Duverger, S Lambotte, P Bernard, H Lyon-Caen, A Deschamps, and A Nercessian. Dynamics of microseis-
micity and its relationship with the active structures in the western Corinth Rift (Greece). Geophysical Journal
International, 215(1):196–221, June 2018. doi:10.1093/gji/ggy264.
[J2] M Laporte, L Bollinger, H Lyon-Caen, R Hoste-Colomer, C Duverger, J Letort, M Riesner, B P Koirala,
M Bhattarai, T Kandel, C Timsina, and L B Adhikari. Seismicity in far western Nepal reveals flats and
ramps along the Main Himalayan Thrust. Geophysical Journal International, 226(3):1747–1763, April 2021.
doi:10.1093/gji/ggab159.
[J3] Frédéric Masson, Samuel Auclair, Didier Bertil, Marc Grunberg, Bruno Hernandez, Sophie Lambotte, Gilles
Mazet-Roux, Ludmila Provost, Jean-Marie Saurel, Antoine Schlupp, and Christophe Sira. The Transversal Seis-
107
SourceSpec Documentation, Release 1.8+100.g047d4e9
micity Action RESIF: A Tool to Improve the Distribution of the French Seismicity Products. Seismological
Research Letters, 92(3):1623–1641, March 2021. doi:10.1785/0220200353.
[J4] Elif Oral and Claudio Satriano. Future magnitude 7.5 earthquake offshore Martinique: spotlight on the main
source features controlling ground motion prediction. Geophysical Journal International, 227(2):1076–1093,
June 2021. URL: http://dx.doi.org/10.1093/gji/ggab245, doi:10.1093/gji/ggab245.
[J5] M. Craiu, A. Craiu, M. Mihai, and A. Marmureanu. An automatic procedure for earthquake analysis using real-
time data. Acta Geodaetica et Geophysica, 58(1):1–18, February 2023. doi:10.1007/s40328-023-00402-1.
[J6] Valentine Lefils, Alexis Rigo, and Efthimios Sokos. MADAM: A temporary seismological survey experiment
in Aetolia-Akarnanian region (Western Greece). Bulletin of the Geological Society of Greece, 59(1):158–174,
January 2023. doi:10.12681/bgsg.31714.
[J7] O Lengliné, J Schmittbuhl, K Drif, S Lambotte, M Grunberg, J Kinscher, C Sira, A Schlupp, M Scham-
ing, H Jund, and F Masson. The largest induced earthquakes during the GEOVEN deep geothermal project,
Strasbourg, 2018–2022: from source parameters to intensity maps. Geophysical Journal International,
234(3):2445–2457, April 2023. doi:10.1093/gji/ggad255.
[J8] S. Panebianco, V. Serlenga, C. Satriano, F. Cavalcante, and T. A. Stabile. Semi-automated template matching
and machine-learning based analysis of the August 2020 Castelsaraceno microearthquake sequence (southern
Italy). Geomatics, Natural Hazards and Risk, May 2023. doi:10.1080/19475705.2023.2207715.
[J9] T C Sunilkumar, Vineet K Gahalaut, D Srinagesh, and B Naresh. Seismotectonic significance of the December
1, 2020 Haridwar, India earthquake (M 4.3), a lower crust event near the Himalayan topographic front. Journal
of Earth System Science, March 2023. doi:10.1007/s12040-023-02072-7.
[J10] Zibo Wang, Ruifeng Liu, and Wei Liu. Source characteristics of the aftershocks of the Wenchuan and
Lushan earthquake sequences in the Longmen-Shan fault zone. Frontiers in Earth Science, January 2023.
doi:10.3389/feart.2022.1061754.
[J11] Pierre Gehl, Pascal Dominique, Hideo Aochi, Mickael Delatre, Jannes Kinscher, and Isabelle Contrucci. De-
velopment of an empirical ground-motion model for post-mining induced seismicity near Gardanne, France.
Journal of Sustainable Mining, 23(2):98–117, February 2024. doi:10.46873/2300-3960.1408.
[J12] Peter M. Shearer, Ian Vandevert, Wenyuan Fan, Rachel E. Abercrombie, Dino Bindi, Giovanna Calderoni, Xi-
aowei Chen, William Ellsworth, Rebecca Harrington, Yihe Huang, Trey Knudson, Meggy Roßbach, Claudio
Satriano, Mariano Supino, Daniel T. Trugman, Hongfeng Yang, and Jiewen Zhang. Earthquake source spectra
estimates vary widely for two ridgecrest aftershocks because of differences in attenuation corrections. Bulletin
of the Seismological Society of America, December 2024. doi:10.1785/0120240134.
[C1] A. Ade Surya Putra, B. Andri Dian Nugraha, C. Nanang T. Puspito, and D. David P. Sahara. Preliminary re-
sult: source parameters for small-moderate earthquakes in Aceh segment, Sumatran fault zone (Northern Suma-
tra). In 18th Annual Meeting of the Asia Oceania Geosciences Society. WORLD SCIENTIFIC, April 2022.
doi:10.1142/9789811260100_0076.
[C2] Ganzorig Davaasuren and Oyun-Erdene Monkhor. Scaling relations of moment magnitude (Mw) and local mag-
nitude (ML) for large earthquakes in northern Mongolia. 2023. doi:10.13140/RG.2.2.15069.59362.
[C3] Audrey Chouli, Lucile Costes, David Marsan, Jannes Münchmeyer, Sophie Giffard-Roisin, and Anne Socquet.
Search for repeaters in the central part of the Chilean subduction zone. March 2024. doi:10.5194/egusphere-
egu24-17042.
[C4] Marc Grunberg and Sophie Lambotte. A new workflow for revising the seismicity catalog for mainland France,
covering the period 2010-2018. March 2024. doi:10.5194/egusphere-egu24-5100.
[C5] Roberto Cabieces, Thiago C. Junqueira, and Jesús Relinque. SurfQuake (SQ): A new Python toolbox for the
workflow process of seismic sources. March 2024. doi:10.5194/egusphere-egu24-2816.
108 Bibliography
PYTHON MODULE INDEX
c ssp_update_db, 71
clipping_detection, 77 ssp_util, 71
config, 74 ssp_wave_arrival, 74
k
kdtree, 74
p
plot_sourcepars, 79
s
savefig, 75
source_spec, 55
spectrum, 75
ssp_build_spectra, 57
ssp_correction, 61
ssp_data_types, 61
ssp_event, 63
ssp_geom_spreading, 65
ssp_grid_sampling, 67
ssp_html_report, 61
ssp_inversion, 58
ssp_local_magnitude, 58
ssp_output, 59
ssp_parse_arguments, 55
ssp_pick, 68
ssp_plot_params_stats, 60
ssp_plot_spectra, 60
ssp_plot_stacked_spectra, 60
ssp_plot_traces, 57
ssp_process_traces, 57
ssp_qml_output, 69
ssp_radiated_energy, 58
ssp_radiation_pattern, 69
ssp_read_sac_header, 70
ssp_read_station_metadata, 70
ssp_read_traces, 56
ssp_residuals, 59
ssp_setup, 55
ssp_spectral_model, 68
ssp_sqlite_output, 71
ssp_summary_statistics, 59
109
SourceSpec Documentation, Release 1.8+100.g047d4e9
A module, 74
add_arrival_to_trace() (in module Config (class in config), 74
ssp_wave_arrival), 74 configure() (in module ssp_setup), 56
Annot (class in plot_sourcepars), 79 copy() (spectrum.Spectrum method), 75
apparent_stress_curve_Er_mw() (in module cosine_taper() (in module ssp_util), 73
plot_sourcepars), 81
append() (spectrum.SpectrumStream method), 76 D
AttributeDict (class in spectrum), 75 data (spectrum.Spectrum property), 75
data_logspaced (spectrum.Spectrum property), 75
B data_mag (spectrum.Spectrum property), 75
Bounds (class in ssp_data_types), 61 data_mag_logspaced (spectrum.Spectrum property),
bounds (ssp_data_types.Bounds property), 61 75
box_plots() (in module ssp_plot_params_stats), 60 divide() (kdtree.KDTCell method), 74
build_spectra() (in module ssp_build_spectra), 57 divide() (kdtree.KDTree method), 74
C E
calc_r2() (in module plot_sourcepars), 81 error_array() (ssp_data_types.SourceSpecOutput
callback() (in module ssp_spectral_model), 69 method), 62
check_min_amplitude() (in module clip-
ping_detection), 77 F
clipping_detection fc_mw_function() (in module plot_sourcepars), 82
module, 77 filter() (plot_sourcepars.Params method), 79
clipping_peaks() (in module clipping_detection), 78 filter_trace() (in module ssp_process_traces), 57
compact_uncertainty() find_outliers() (ssp_data_types.SourceSpecOutput
(ssp_data_types.SpectralParameter method), method), 62
63 find_peak_width() (in module ssp_grid_sampling), 68
compact_uncertainty() fit_gutenberg_richter() (in module
(ssp_data_types.SummaryStatistics method), plot_sourcepars), 82
63 freq (spectrum.Spectrum property), 75
compute_clipping_score() (in module clip- freq_logspaced (spectrum.Spectrum property), 76
ping_detection), 78 from_event_dict() (ssp_event.SSPEvent method), 64
compute_mc() (in module plot_sourcepars), 81 from_moment_tensor()
compute_sensitivity_from_SAC() (in module (ssp_event.SSPFocalMechanism method),
ssp_read_sac_header), 70 64
compute_summary_statistics() (in module from_moment_tensor() (ssp_event.SSPScalarMoment
ssp_summary_statistics), 59 method), 64
conditional_misfit (ssp_grid_sampling.GridSampling from_obspy_trace() (spectrum.Spectrum method), 76
property), 67 from_scalar_moment() (ssp_event.SSPMagnitude
conditional_peak_widths method), 64
(ssp_grid_sampling.GridSampling property),
67 G
config geom_spread_boatwright() (in module
111
SourceSpec Documentation, Release 1.8+100.g047d4e9
112 Index
SourceSpec Documentation, Release 1.8+100.g047d4e9
O R
objective_func() (in module ssp_spectral_model), 69 radiated_energy_and_apparent_stress() (in mod-
OrderedAttribDict (class in ssp_data_types), 62 ule ssp_radiated_energy), 58
outlier_array() (ssp_data_types.SourceSpecOutput radiation_pattern() (in module
method), 62 ssp_radiation_pattern), 69
read_spectra() (in module spectrum), 77
P read_station_metadata() (in module
Params (class in plot_sourcepars), 79 ssp_read_station_metadata), 70
params_err (ssp_grid_sampling.GridSampling prop- read_traces() (in module ssp_read_traces), 56
erty), 68 reference_summary_parameters()
params_opt (ssp_grid_sampling.GridSampling prop- (ssp_data_types.SourceSpecOutput method),
erty), 68 62
parse_args() (in module plot_sourcepars), 82 reference_uncertainties()
parse_args() (in module ssp_parse_arguments), 55 (ssp_data_types.SourceSpecOutput method),
PAZ (class in ssp_read_station_metadata), 70 62
percentiles_nobs() (ssp_data_types.SourceSpecOutput reference_values() (ssp_data_types.SourceSpecOutput
method), 62 method), 62
percentiles_uncertainties() remove_instr_response() (in module ssp_util), 73
(ssp_data_types.SourceSpecOutput method), remove_old_outdir() (in module ssp_setup), 56
62 run() (in module plot_sourcepars), 83
percentiles_values()
(ssp_data_types.SourceSpecOutput method), S
62 save_config() (in module ssp_setup), 56
plot() (spectrum.Spectrum method), 76 save_spectra() (in module ssp_output), 59
plot_conditional_misfit() savefig
(ssp_grid_sampling.GridSampling method), 68 module, 75
plot_Er_mw() (plot_sourcepars.Params method), 80 savefig() (in module savefig), 75
plot_fc_mw() (plot_sourcepars.Params method), 80 ScalarFormatter (class in ssp_plot_traces), 57
plot_geom_spread_models() (in module seedID (ssp_read_station_metadata.PAZ property), 70
ssp_geom_spreading), 66 select() (spectrum.SpectrumStream method), 76
plot_gutenberg_richter() (plot_sourcepars.Params select_trace() (in module ssp_util), 73
method), 80 set_plot_params() (ssp_plot_spectra.PlotParams
plot_hist() (plot_sourcepars.Params method), 80 method), 60
plot_misfit_2d() (ssp_grid_sampling.GridSampling setup_logging() (in module ssp_setup), 56
method), 68 sigint_handler() (in module ssp_setup), 56
plot_mw_time() (plot_sourcepars.Params method), 80 signal_fft() (in module spectrum), 77
plot_sourcepars skip_events() (plot_sourcepars.Params method), 81
module, 79 slice() (spectrum.Spectrum method), 76
plot_spectra() (in module ssp_plot_spectra), 60 smooth() (in module ssp_util), 73
plot_ssd_depth() (plot_sourcepars.Params method), sort() (spectrum.SpectrumStream method), 76
81
Index 113
SourceSpec Documentation, Release 1.8+100.g047d4e9
114 Index
SourceSpec Documentation, Release 1.8+100.g047d4e9
U
update_db_file() (in module ssp_update_db), 71
V
value_array() (ssp_data_types.SourceSpecOutput
method), 62
value_in_km (ssp_event.SSPDepth property), 64
value_in_m (ssp_event.SSPDepth property), 64
values (ssp_grid_sampling.GridSampling property), 68
values_1d (ssp_grid_sampling.GridSampling property),
68
W
weighted_mean_nobs()
(ssp_data_types.SourceSpecOutput method),
63
weighted_mean_uncertainties()
(ssp_data_types.SourceSpecOutput method),
63
weighted_mean_values()
(ssp_data_types.SourceSpecOutput method),
63
write() (spectrum.Spectrum method), 76
write() (spectrum.SpectrumStream method), 76
write_output() (in module ssp_output), 59
write_qml() (in module ssp_qml_output), 69
write_sqlite() (in module ssp_sqlite_output), 71
Index 115