5.2.10.4. eqcorrscan.utils.plotting.freq_mag¶
- eqcorrscan.utils.plotting.freq_mag(magnitudes, completeness, max_mag, binsize=0.2, **kwargs)[source]¶
Plot a frequency-magnitude histogram and cumulative density plot.
Currently this will compute a b-value, for a given completeness. B-value is computed by linear fitting to section of curve between completeness and max_mag.
- Parameters:
magnitudes (list) – list of float of magnitudes
completeness (float) – Level to compute the b-value above
max_mag (float) – Maximum magnitude to try and fit a b-value to
binsize (float) – Width of histogram bins, defaults to 0.2
title (str) – Title of figure
show (bool) – Whether to show the figure or not (defaults to True)
save (bool) – Whether to save the figure or not (defaults to False)
savefile (str) – Filename to save figure to, if save==True (defaults to “EQcorrscan_figure.png”)
return_figure (bool) – Whether to return the figure or not (defaults to True), if False then the figure will be cleared and closed.
size (tuple of float) – Figure size as (width, height) in inches. Defaults to (10.5, 7.5)
- Returns:
Note
See
eqcorrscan.utils.mag_calc.calc_b_value()
for a least-squares method of estimating completeness and b-value. For estimating maximum curvature seeeqcorrscan.utils.mag_calc.calc_max_curv()
.Example
>>> from obspy.clients.fdsn import Client >>> from obspy import UTCDateTime >>> from eqcorrscan.utils.plotting import freq_mag >>> client = Client('IRIS') >>> t1 = UTCDateTime('2012-03-26T00:00:00') >>> t2 = t1 + (3 * 86400) >>> catalog = client.get_events(starttime=t1, endtime=t2, minmagnitude=3) >>> magnitudes = [event.preferred_magnitude().mag for event in catalog] >>> freq_mag(magnitudes, completeness=4, max_mag=7)