5.2.8.1.7. eqcorrscan.utils.mag_calc.relative_magnitude¶
- eqcorrscan.utils.mag_calc.relative_magnitude(st1, st2, event1, event2, noise_window=(-20, -1), signal_window=(-0.5, 20), min_snr=5.0, min_cc=0.7, use_s_picks=False, correlations=None, shift=0.2, return_correlations=False, correct_mag_bias=True)[source]¶
Compute the relative magnitudes between two events.
See
eqcorrscan.utils.mag_calc.relative_amplitude()
for information on how relative amplitudes are calculated. To compute relative magnitudes from relative amplitudes this function can weight the amplitude ratios by the cross-correlation of the two events. The relation used is similar to Schaff and Richards (2014), equation 4 and is:\[\Delta m = \log{\frac{std(tr2)}{std(tr1)}} + \log{ \frac{(1+\frac{1}{snr_x^2})}{1+\frac{1}{snr_y^2}}\times CC}\]If you decide to use this function you should definitely read the paper to understand what you can use this for and cite the paper!
- Parameters:
st1 (obspy.core.stream.Stream) – Stream for event1
st2 (obspy.core.stream.Stream) – Stream for event2
event1 (obspy.core.event.Event) – Event with picks (nothing else is needed)
event2 (obspy.core.event.Event) – Event with picks (nothing else is needed)
noise_window (tuple of float) – Start and end of noise window in seconds relative to pick
signal_window (tuple of float) – Start and end of signal window in seconds relative to pick
min_snr (float) – Minimum signal-to-noise ratio allowed to make a measurement
min_cc (float) – Minimum inter-event correlation (between -1 and 1) allowed to make a measurement.
use_s_picks (bool) – Whether to allow relative amplitude estimates to be made from S-picks. Note that noise and signal windows are relative to pick-times, so using an S-pick might result in a noise window including P-energy.
correlations (dict) – Pre-computed dictionary of correlations keyed by seed-id. If None (default) then correlations will be computed for the provided data in the signal_window.
shift (float) – Shift length for correlations in seconds - maximum correlation within a window between +/- shift of the P-pick will be used to weight the magnitude.
return_correlations (bool) – If true will also return maximum correlations as a dictionary.
correct_mag_bias (bool) – Whether to correct for the magnitude-bias introduced by cc<1 and the presence of noise (i.e., SNR << ∞). Without bias-correction, the relative magnitudes are simple L2-norm-ratio relative magnitudes.
- Return type:
- Returns:
Dictionary of relative magnitudes keyed by seed-id