.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/08_pygimli/plot_00_export_to_pygimli.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__examples_08_pygimli_plot_00_export_to_pygimli.py: Exporting to pygimli for ERT inversion ====================================== REDA can also export to pygimli (https://www.pygimli.org/) ert data containers. .. GENERATED FROM PYTHON SOURCE LINES 10-11 .. code-block:: Python # sphinx_gallery_thumbnail_number = 3 .. GENERATED FROM PYTHON SOURCE LINES 12-16 .. code-block:: Python import reda import pygimli as pg from pygimli.physics import ert .. GENERATED FROM PYTHON SOURCE LINES 17-18 import data into reda, including electrode information .. GENERATED FROM PYTHON SOURCE LINES 18-27 .. code-block:: Python data = reda.ERT() data.import_syscal_bin('../01_ERT/data_rodderberg/20140208_01.bin') data.import_electrode_positions( '../01_ERT/data_rodderberg/electrode_positions.dat', ) # plot the electrode positions data.plot_electrode_positions_2d() .. image-sg:: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_001.png :alt: plot 00 export to pygimli :srcset: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (
, None) .. GENERATED FROM PYTHON SOURCE LINES 28-29 compute geometric factors .. GENERATED FROM PYTHON SOURCE LINES 29-31 .. code-block:: Python data.compute_K_numerical(fem_code='pygimli') .. rst-class:: sphx-glr-script-out .. code-block:: none COMPUTING GEomFacs using PYGimli Computing numerical geometric factors using Pyglimi array([ -38.52402364, -153.52866075, -378.10597767, ..., -38.54919138, -171.86663742, -42.25692476], shape=(2816,)) .. GENERATED FROM PYTHON SOURCE LINES 32-33 apply some light filtering .. GENERATED FROM PYTHON SOURCE LINES 33-35 .. code-block:: Python data.filter('rho_a <= 0') .. rst-class:: sphx-glr-script-out .. code-block:: none .. GENERATED FROM PYTHON SOURCE LINES 36-37 plot histograms .. GENERATED FROM PYTHON SOURCE LINES 37-40 .. code-block:: Python with reda.CreateEnterDirectory('output_01_ertinv'): data.histogram('r', log10=True, filename='histograms_raw.jpg') .. image-sg:: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_002.png :alt: plot 00 export to pygimli :srcset: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 41-42 export the data (and electrode positions) into a pygimli data container .. GENERATED FROM PYTHON SOURCE LINES 42-44 .. code-block:: Python pg_scheme = data.export_to_pygimli_scheme() .. rst-class:: sphx-glr-script-out .. code-block:: none WARNING: Implementation and testing still in progress!!!! WARNING: Journal and log is not copied! .. GENERATED FROM PYTHON SOURCE LINES 45-46 set data errors .. GENERATED FROM PYTHON SOURCE LINES 46-50 .. code-block:: Python pg_scheme.estimateError(relativeError=0.01, absoluteUError=7e-5) mgr = ert.ERTManager(pg_scheme) .. GENERATED FROM PYTHON SOURCE LINES 51-62 .. code-block:: Python with reda.CreateEnterDirectory('output_01_ertinv'): mod = mgr.invert( pg_scheme, lam=10, verbose=True, paraDX=0.1, paraMaxCellSize=10, paraDepth=20, quality=33.0 ) .. rst-class:: sphx-glr-script-out .. code-block:: none fop: Data transformation: Logarithmic LU transform, lower bound 0.0, upper bound 0.0 Model transformation: Logarithmic transform min/max (data): 1.86/2230 min/max (error): 1%/211% min/max (start model): 96.19/96.19 -------------------------------------------------------------------------------- inv.iter 0 ... chi² = 6933.37 -------------------------------------------------------------------------------- inv.iter 1 ... chi² = 138.92 (dPhi = 97.99%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 2 ... chi² = 18.33 (dPhi = 86.71%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 3 ... chi² = 1.65 (dPhi = 89.64%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 4 ... chi² = 1.44 (dPhi = 11.70%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 5 ... chi² = 1.22 (dPhi = 13.78%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 6 ... chi² = 1.06 (dPhi = 10.34%) lam: 10.0 -------------------------------------------------------------------------------- inv.iter 7 ... chi² = 1.06 (dPhi = 0.09%) lam: 10.0 ################################################################################ # Abort criterion reached: dPhi = 0.09 (< 2.0%) # ################################################################################ .. GENERATED FROM PYTHON SOURCE LINES 63-64 plot the result .. GENERATED FROM PYTHON SOURCE LINES 64-73 .. code-block:: Python with reda.CreateEnterDirectory('output_01_ertinv'): ax, cb = mgr.showResult( cMap="Spectral_r", logScale=False, ) ax.set_title('PyGimli inversion result', loc='left') fig = ax.get_figure() fig.savefig('pygimli_inversion.jpg', dpi=300) .. image-sg:: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_003.png :alt: PyGimli inversion result :srcset: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 74-77 .. code-block:: Python with reda.CreateEnterDirectory('output_01_ertinv'): ax, _ = pg.show(mgr.mesh) ax.get_figure().savefig('mesh.jpg', dpi=1200) .. image-sg:: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_004.png :alt: plot 00 export to pygimli :srcset: /_examples/08_pygimli/images/sphx_glr_plot_00_export_to_pygimli_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (2 minutes 16.790 seconds) .. _sphx_glr_download__examples_08_pygimli_plot_00_export_to_pygimli.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_00_export_to_pygimli.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_00_export_to_pygimli.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_00_export_to_pygimli.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_