.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_02_smooth_inversion.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_02_smooth_inversion.py: Smooth inversion and depth of investigation =========================================== Invert a sounding without choosing the number of layers, and find the depth below which the model no longer reflects the data. .. GENERATED FROM PYTHON SOURCE LINES 10-14 Data over a weathered crystalline basement ------------------------------------------ Topsoil, a clay-rich weathered layer and fresh basement: a common setting for groundwater in Nigeria's basement complex. .. GENERATED FROM PYTHON SOURCE LINES 14-24 .. code-block:: Python import numpy as np import ertkit from ertkit import plot, ves truth = ves.LayeredModel(resistivity=[200.0, 30.0, 2000.0], thickness=[1.5, 12.0]) survey = ves.Survey.schlumberger(ab2=np.geomspace(2.5, 150.0, 24), mn2=0.5) data = ves.Sounding.synthetic(truth, survey, ertkit.ErrorModel(relative=0.03), rng=4) .. GENERATED FROM PYTHON SOURCE LINES 25-29 Occam inversion --------------- Thirty layers whose thicknesses grow with depth. The regularization weight is the largest that still fits the data to their errors. .. GENERATED FROM PYTHON SOURCE LINES 29-34 .. code-block:: Python smooth = ves.invert_smooth(data) print(f"chi2 = {smooth.chi2:.1f} for {smooth.n_data} data ({smooth.stop_reason})") print(f"depth of investigation: {smooth.doi:.1f} m") .. rst-class:: sphx-glr-script-out .. code-block:: none chi2 = 24.0 for 24 data (target misfit reached and the model is stable) depth of investigation: 36.5 m .. GENERATED FROM PYTHON SOURCE LINES 35-39 The shaded region lies below the depth of investigation: two further inversions, pulled towards very different reference models, disagree there, so the data do not determine the resistivity at those depths. The depth axis is logarithmic, which suits layers that thicken with depth. .. GENERATED FROM PYTHON SOURCE LINES 39-44 .. code-block:: Python ax = plot.layered_model( truth, smooth, labels=["true model", "smooth model"], log_depth=True ) .. image-sg:: /auto_examples/images/sphx_glr_plot_02_smooth_inversion_001.png :alt: plot 02 smooth inversion :srcset: /auto_examples/images/sphx_glr_plot_02_smooth_inversion_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 45-47 The depth of investigation index itself, layer by layer. It is near 0 where the data control the model and near 1 where the reference model does. .. GENERATED FROM PYTHON SOURCE LINES 47-66 .. code-block:: Python import matplotlib.pyplot as plt tops = np.concatenate([[0.0], smooth.model.depths]) bottoms = np.concatenate([smooth.model.depths, [2.0 * smooth.model.depths[-1]]]) fig, ax = plt.subplots(figsize=(4.5, 4.5), layout="constrained") # One vertical segment per layer, spanning its depth range. ax.plot( np.repeat(smooth.doi_index, 2), np.ravel(np.column_stack([np.maximum(tops, 0.5 * tops[1]), bottoms])), ) ax.axvline(ves.DOI_THRESHOLD, color="gray", linestyle="--", label="threshold") ax.axhline(smooth.doi, color="black", linewidth=0.8, label="depth of investigation") ax.set_yscale("log") ax.set_ylim(bottoms[-1], 0.5 * tops[1]) ax.set_xlabel("depth-of-investigation index") ax.set_ylabel("depth (m)") ax.legend() .. image-sg:: /auto_examples/images/sphx_glr_plot_02_smooth_inversion_002.png :alt: plot 02 smooth inversion :srcset: /auto_examples/images/sphx_glr_plot_02_smooth_inversion_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 67-74 The depth of investigation is about a quarter of the largest AB/2. For a homogeneous earth, half of the Schlumberger signal comes from above about 0.38 AB/2 (the median depth of investigation; Edwards 1977); here the conductive weathered layer channels the current and the basement below it is seen less deeply. A longer spread looks deeper: .. GENERATED FROM PYTHON SOURCE LINES 74-83 .. code-block:: Python for ab2_max in (50.0, 150.0, 500.0): longer = ves.Survey.schlumberger(ab2=np.geomspace(2.5, ab2_max, 24), mn2=0.5) sounding = ves.Sounding.synthetic( truth, longer, ertkit.ErrorModel(relative=0.03), rng=4 ) print( f"AB/2 up to {ab2_max:5.0f} m: depth of investigation {ves.invert_smooth(sounding).doi:6.1f} m" ) .. rst-class:: sphx-glr-script-out .. code-block:: none AB/2 up to 50 m: depth of investigation 18.7 m AB/2 up to 150 m: depth of investigation 36.5 m AB/2 up to 500 m: depth of investigation 130.3 m .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.235 seconds) .. _sphx_glr_download_auto_examples_plot_02_smooth_inversion.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_smooth_inversion.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_smooth_inversion.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_smooth_inversion.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_