5.10.1.4. eqcorrscan.utils.plotting.freq_mag¶
-
eqcorrscan.utils.plotting.
freq_mag
(magnitudes, completeness, max_mag, binsize=0.2, save=False, savefile=None)[source]¶ Plot a frequency-magnitude histogram and cumulative density plot.
This can compute a b-value, but not a completeness at the moment. 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
- save (bool) False will plot to screen, true will save plot and not show to screen.
- savefile (str) Filename to save to, required for save=True
Returns: class: matplotlib.figure Note
See eqcorrscan.utils.mag_calc.calc_b_value for a least-squares method of estimating completeness and b-value.
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)
(Source code, png, hires.png)