.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/01_modelling/plot_04_gen_seit_model.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_01_modelling_plot_04_gen_seit_model.py: Generating sEIT forward models ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The eit manager can be used to easily create forward models using different parameterizations. .. GENERATED FROM PYTHON SOURCE LINES 11-12 imports .. GENERATED FROM PYTHON SOURCE LINES 12-16 .. code-block:: Python import numpy as np import crtomo import reda .. GENERATED FROM PYTHON SOURCE LINES 17-18 we need a FE grid .. GENERATED FROM PYTHON SOURCE LINES 18-21 .. code-block:: Python grid = crtomo.crt_grid.create_surface_grid(nr_electrodes=15, spacing=1) grid.plot_grid() .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_001.png :alt: plot 04 gen seit model :srcset: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none This grid was sorted using CutMcK. The nodes were resorted! Triangular grid found .. GENERATED FROM PYTHON SOURCE LINES 22-23 define frequencies .. GENERATED FROM PYTHON SOURCE LINES 23-28 .. code-block:: Python frequencies = np.logspace(-3, 3, 2) # create the eit manager eitman = crtomo.eitMan(frequencies=frequencies, grid=grid) .. GENERATED FROM PYTHON SOURCE LINES 29-30 start with a homogeneous complex resistivity distribution .. GENERATED FROM PYTHON SOURCE LINES 30-41 .. code-block:: Python eitman.add_homogeneous_model(magnitude=100, phase=0) r = eitman.plot_forward_models(maglim=[90, 110]) # r['rmag']['fig'].show() # save to files # with reda.CreateEnterDirectory('output_gen_seit_model'): # # magnitude # r['rmag']['fig'].savefig('fwd_model_hom_rmag.png', dpi=300) # r['rmag']['fig'].show() .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_002.png :alt: 0.001 Hz, 1000.000 Hz :srcset: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_002.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_003.png :alt: 0.001 Hz, 1000.000 Hz :srcset: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_003.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 42-45 with reda.CreateEnterDirectory('output_gen_seit_model'): # phase r['rpha']['fig'].savefig('fwd_model_hom_rpha.png', dpi=300) .. GENERATED FROM PYTHON SOURCE LINES 47-48 now we can start parameterizing the subsurface .. GENERATED FROM PYTHON SOURCE LINES 48-60 .. code-block:: Python eitman.set_area_to_single_colecole( 0, 5, -2, 0, [100, 0.1, 0.04, 0.8] ) r = eitman.plot_forward_models(maglim=[90, 110], phalim=[-30, 0]) # save to files with reda.CreateEnterDirectory('output_gen_seit_model'): r['rmag']['fig'].savefig('fwd_model_par_rmag.png', dpi=300) r['rpha']['fig'].savefig('fwd_model_par_rpha.png', dpi=300) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_004.png :alt: 0.001 Hz, 1000.000 Hz :srcset: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_004.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_005.png :alt: 0.001 Hz, 1000.000 Hz :srcset: /_examples/01_modelling/images/sphx_glr_plot_04_gen_seit_model_005.png :class: sphx-glr-multi-img .. GENERATED FROM PYTHON SOURCE LINES 61-62 add configurations .. GENERATED FROM PYTHON SOURCE LINES 62-68 .. code-block:: Python configs = np.array(( (1, 3, 5, 4), (5, 7, 10, 8), )) eitman.add_to_configs(configs) .. GENERATED FROM PYTHON SOURCE LINES 69-70 conduct forward modeling .. GENERATED FROM PYTHON SOURCE LINES 70-73 .. code-block:: Python eitman.model() measurements = eitman.measurements(silent=True) .. rst-class:: sphx-glr-script-out .. code-block:: none attempting modeling b' ######### CMod ############\nLicence:\nCopyright \xc2\xa9 1990-2020 Andreas Kemna \nCopyright \xc2\xa9 2008-2020 CRTomo development team (see AUTHORS file)\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \xe2\x80\x9cSoftware\xe2\x80\x9d), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \xe2\x80\x9cAS IS\xe2\x80\x9d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n \n \n CRMod Process_ID :: 4848\n OpenMP max threads: 4\n Git-Branch master\n Commit-ID cb89ccd2c4341b9b08bbe7bb08f5aea0d60916ee\n Created Mon-Mar-25-14:34:56-2024\n Compiler \n OS GNU/Linux\n\n Reading Input-Files\n++ check 1\r++ check 2 done!\n\rGetting voltage 1\rGetting voltage 2 No electrode cap file\n \n Rescheduling..\n less nodes than wavenumbers\n OpenMP threads: 3( 4)\n\n\r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 4 \r Calculating Potentials : Wavenumber 5 \r Calculating Potentials : Wavenumber 6 \r Calculating Potentials : Wavenumber 7 \r Calculating Potentials : Wavenumber 8 done, now processing\n solution time 0d/ 0h/ 0m/ 0s/ 146ms\n\n Modelling completedSTOP 0\n' reading voltages attempting modeling b' ######### CMod ############\nLicence:\nCopyright \xc2\xa9 1990-2020 Andreas Kemna \nCopyright \xc2\xa9 2008-2020 CRTomo development team (see AUTHORS file)\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \xe2\x80\x9cSoftware\xe2\x80\x9d), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \xe2\x80\x9cAS IS\xe2\x80\x9d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n \n \n CRMod Process_ID :: 4852\n OpenMP max threads: 4\n Git-Branch master\n Commit-ID cb89ccd2c4341b9b08bbe7bb08f5aea0d60916ee\n Created Mon-Mar-25-14:34:56-2024\n Compiler \n OS GNU/Linux\n\n Reading Input-Files\n++ check 1\r++ check 2 done!\n\rGetting voltage 1\rGetting voltage 2 No electrode cap file\n \n Rescheduling..\n less nodes than wavenumbers\n OpenMP threads: 3( 4)\n\n\r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 3 \r Calculating Potentials : Wavenumber 4 \r Calculating Potentials : Wavenumber 5 \r Calculating Potentials : Wavenumber 6 \r Calculating Potentials : Wavenumber 7 \r Calculating Potentials : Wavenumber 8 done, now processing\n solution time 0d/ 0h/ 0m/ 0s/ 146ms\n\n Modelling completedSTOP 0\n' reading voltages .. GENERATED FROM PYTHON SOURCE LINES 74-75 modeled SIP signatures can be retrieved as a dict: .. GENERATED FROM PYTHON SOURCE LINES 75-78 .. code-block:: Python sip_sigs = eitman.get_measurement_responses() print(sip_sigs) .. rst-class:: sphx-glr-script-out .. code-block:: none {(1, 3, 5, 4): , (5, 7, 10, 8): } .. GENERATED FROM PYTHON SOURCE LINES 79-80 plot modeled SIP signatures .. GENERATED FROM PYTHON SOURCE LINES 80-85 .. code-block:: Python with reda.CreateEnterDirectory('output_gen_seit_model'): for key, obj in eitman.get_measurement_responses().items(): obj.plot(filename='mod_sip_{}.png'.format(key), dtype='r') .. GENERATED FROM PYTHON SOURCE LINES 86-87 Extract SIP signature at one point from the forward model .. GENERATED FROM PYTHON SOURCE LINES 87-94 .. code-block:: Python sip_one_p = eitman.extract_points( ['forward_rmag', 'forward_rpha'], np.atleast_2d(np.array((1, -1))) ) # import IPython # IPython.embed() .. _sphx_glr_download__examples_01_modelling_plot_04_gen_seit_model.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_04_gen_seit_model.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_04_gen_seit_model.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_04_gen_seit_model.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_