.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/01_modelling/plot_00_sensitivity.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_00_sensitivity.py: Plotting sensitivities ^^^^^^^^^^^^^^^^^^^^^^ Sensitivity distributions can be easily plotted using the tdMan class: .. GENERATED FROM PYTHON SOURCE LINES 10-11 imports .. GENERATED FROM PYTHON SOURCE LINES 11-16 .. code-block:: Python import numpy as np import crtomo # is only used for reda.CreateEnterDirectory import reda .. GENERATED FROM PYTHON SOURCE LINES 17-18 create and save a FEM-grid .. GENERATED FROM PYTHON SOURCE LINES 18-31 .. code-block:: Python grid = crtomo.crt_grid.create_surface_grid( nr_electrodes=10, spacing=1, depth=4, char_lengths=0.2, ) grid.plot_grid() with reda.CreateEnterDirectory('output_plot_00_sensitivity'): grid.save_elem_file('elem.dat') grid.save_elec_file('elec.dat') .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_001.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_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 32-33 create the measurement configuration .. GENERATED FROM PYTHON SOURCE LINES 33-38 .. code-block:: Python configs = np.array(( (1, 4, 10, 7), )) .. GENERATED FROM PYTHON SOURCE LINES 39-40 for different background, plot the sensitivities .. GENERATED FROM PYTHON SOURCE LINES 40-53 .. code-block:: Python for bg in (1, 10, 100, 1000): td = crtomo.tdMan(grid=grid) td.configs.add_to_configs(configs) td.add_homogeneous_model(bg, 0) td.model(sensitivities=True, silent=True) r = td.plot_sensitivity(0) with reda.CreateEnterDirectory('output_plot_00_sensitivity'): r[0].savefig('sensitivity_bg_{}.pdf'.format(bg), bbox_inches='tight') r = td.plot_sensitivity(0, mag_only=True) with reda.CreateEnterDirectory('output_plot_00_sensitivity'): r[0].savefig( 'sensitivity_magonly_bg_{}.pdf'.format(bg), bbox_inches='tight') .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_002.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_002.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_003.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_003.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_004.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_004.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_005.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_005.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_006.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_006.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_007.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_007.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_008.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_008.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_009.png :alt: plot 00 sensitivity :srcset: /_examples/01_modelling/images/sphx_glr_plot_00_sensitivity_009.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none reading sensitivities reading sensitivities reading sensitivities reading sensitivities .. _sphx_glr_download__examples_01_modelling_plot_00_sensitivity.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_sensitivity.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_00_sensitivity.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_00_sensitivity.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_