.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/seismology/plot_09_richter_magnitude.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_seismology_plot_09_richter_magnitude.py: Richter's magnitude scale (1935) ================================ Charles Richter ranked southern California earthquakes by the logarithm of the peak amplitude on a Wood-Anderson seismometer, corrected for distance. Magnitude 3 is a 1 mm trace at 100 km, and each unit is a tenfold amplitude. The distance correction used here is Hutton and Boore's 1987 calibration. .. GENERATED FROM PYTHON SOURCE LINES 10-28 .. image-sg:: /api/gallery/seismology/images/sphx_glr_plot_09_richter_magnitude_001.png :alt: Same magnitude, smaller trace farther away :srcset: /api/gallery/seismology/images/sphx_glr_plot_09_richter_magnitude_001.png :class: sphx-glr-single-img .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from earthsciencekit.seismology import local_magnitude distance = np.linspace(10e3, 600e3, 300) assert np.isclose(local_magnitude(1e-3, 100e3), 3) fig, ax = plt.subplots() for magnitude in [2, 3, 4, 5]: # Invert the scale for the amplitude that the same event produces at each distance. amplitude = 1e-3 * 10 ** (magnitude - local_magnitude(1e-3, distance)) np.testing.assert_allclose(local_magnitude(amplitude, distance), magnitude) ax.semilogy(distance / 1e3, amplitude * 1e3, label=f"ML {magnitude}") ax.set(xlabel="hypocentral distance [km]", ylabel="Wood-Anderson amplitude [mm]", title="Same magnitude, smaller trace farther away") ax.legend() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.187 seconds) .. _sphx_glr_download_api_gallery_seismology_plot_09_richter_magnitude.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../lite/lab/index.html?path=api/gallery/seismology/plot_09_richter_magnitude.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_09_richter_magnitude.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_09_richter_magnitude.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_09_richter_magnitude.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_