.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/03_sEIT/plot_visualize_4d_data.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_03_sEIT_plot_visualize_4d_data.py: Visualizing multi-dimensional sEIT data --------------------------------------- This is work in progress .. GENERATED FROM PYTHON SOURCE LINES 10-11 imports .. GENERATED FROM PYTHON SOURCE LINES 11-12 .. code-block:: Python import reda .. GENERATED FROM PYTHON SOURCE LINES 13-14 load the data set .. GENERATED FROM PYTHON SOURCE LINES 14-22 .. code-block:: Python seit = reda.sEIT() for nr in range(0, 4): seit.import_crtomo( directory='data_synthetic_4d/modV_0{}_noisy/'.format(nr), timestep=nr ) seit.compute_K_analytical(spacing=1) .. rst-class:: sphx-glr-script-out .. code-block:: none Summary: a b ... frequency rpha count 21090.000000 21090.000000 ... 21090.000000 21090.000000 mean 20.000000 21.000000 ... 106.285593 -0.416545 std 11.269695 11.269695 ... 257.160101 3.894778 min 1.000000 2.000000 ... 0.001000 -36.449777 25% 10.000000 11.000000 ... 0.019307 0.001337 50% 20.000000 21.000000 ... 1.000000 0.152537 75% 30.000000 31.000000 ... 51.794747 0.904502 max 39.000000 40.000000 ... 1000.000000 9.153910 [8 rows x 7 columns] Summary: a b ... frequency rpha count 21090.000000 21090.000000 ... 21090.000000 21090.000000 mean 20.000000 21.000000 ... 106.285593 -0.271940 std 11.269695 11.269695 ... 257.160101 0.695746 min 1.000000 2.000000 ... 0.001000 -4.414486 25% 10.000000 11.000000 ... 0.019307 -0.263819 50% 20.000000 21.000000 ... 1.000000 0.001008 75% 30.000000 31.000000 ... 51.794747 0.042757 max 39.000000 40.000000 ... 1000.000000 0.547236 [8 rows x 7 columns] Summary: a b ... frequency rpha count 21090.000000 21090.000000 ... 21090.000000 21090.000000 mean 20.000000 21.000000 ... 106.285593 -0.146598 std 11.269695 11.269695 ... 257.160101 0.262500 min 1.000000 2.000000 ... 0.001000 -1.449444 25% 10.000000 11.000000 ... 0.019307 -0.188202 50% 20.000000 21.000000 ... 1.000000 -0.020179 75% 30.000000 31.000000 ... 51.794747 0.002784 max 39.000000 40.000000 ... 1000.000000 0.151707 [8 rows x 7 columns] Summary: a b ... frequency rpha count 21090.000000 21090.000000 ... 21090.000000 21090.000000 mean 20.000000 21.000000 ... 106.285593 -0.073887 std 11.269695 11.269695 ... 257.160101 0.130434 min 1.000000 2.000000 ... 0.001000 -0.711277 25% 10.000000 11.000000 ... 0.019307 -0.095615 50% 20.000000 21.000000 ... 1.000000 -0.007987 75% 30.000000 31.000000 ... 51.794747 0.001270 max 39.000000 40.000000 ... 1000.000000 0.051985 [8 rows x 7 columns] .. GENERATED FROM PYTHON SOURCE LINES 23-24 Plotting pseudosections .. GENERATED FROM PYTHON SOURCE LINES 24-31 .. code-block:: Python with reda.CreateEnterDirectory('output_visualize_4d'): pass print( 'at this point the plotting routines do not honor' ' timestep dimensionality' ) .. rst-class:: sphx-glr-script-out .. code-block:: none at this point the plotting routines do not honor timestep dimensionality .. GENERATED FROM PYTHON SOURCE LINES 32-33 Plot a single spectrum .. GENERATED FROM PYTHON SOURCE LINES 33-44 .. code-block:: Python nor, rec = seit.get_spectrum(abmn=[1, 2, 4, 3]) with reda.CreateEnterDirectory('output_visualize_4d'): for timestep, spectrum in nor.items(): spectrum.plot(filename='spectrum_1-2_4-3_ts_{}.png'.format(timestep)) with reda.CreateEnterDirectory('output_visualize_4d'): nor, rec, fig = seit.get_spectrum( abmn=[1, 2, 4, 3], plot_filename='specplot.png' ) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_001.png :alt: a: 1 b: 2 m: 4: n: 3 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_001.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_002.png :alt: a: 1 b: 2 m: 4: n: 3 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_002.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_003.png :alt: a: 1 b: 2 m: 4: n: 3 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_003.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_004.png :alt: a: 1 b: 2 m: 4: n: 3 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_004.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:217: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:217: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:235: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 0].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:250: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 1].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:265: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 0].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:279: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 1].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:288: UserWarning: Data has no positive values, and therefore cannot be log-scaled. axes[1, 1].set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:217: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:235: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 0].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:250: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 1].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:265: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 0].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:279: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 1].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:288: UserWarning: Data has no positive values, and therefore cannot be log-scaled. axes[1, 1].set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:217: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:235: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 0].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:250: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 1].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:265: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 0].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:279: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 1].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:288: UserWarning: Data has no positive values, and therefore cannot be log-scaled. axes[1, 1].set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:217: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_ylim( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:235: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 0].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:250: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[0, 1].semilogx( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:265: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 0].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:279: UserWarning: linestyle is redundantly defined by the 'linestyle' keyword argument and the fmt string ".-" (-> linestyle='-'). The keyword argument will take precedence. axes[1, 1].loglog( /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:288: UserWarning: Data has no positive values, and therefore cannot be log-scaled. axes[1, 1].set_ylim( .. GENERATED FROM PYTHON SOURCE LINES 45-54 .. code-block:: Python from reda.eis.plots import multi_sip_response # important: use the obj_dict parameter to use a dict as input multi = multi_sip_response(obj_dict=nor) with reda.CreateEnterDirectory('output_visualize_4d'): multi.plot_cre('multiplot_cre.png') multi.plot_cim('multiplot_cim.png') multi.plot_rmag('multiplot_rmag.png') multi.plot_rpha('multiplot_rpha.png') .. rst-class:: sphx-glr-script-out .. code-block:: none /home/runner/.virtualenvs/reda/lib/python3.10/site-packages/reda/eis/plots.py:536: UserWarning: Data has no positive values, and therefore cannot be log-scaled. ax.set_xlim(*self.xlim) .. GENERATED FROM PYTHON SOURCE LINES 55-57 Histograms just used to close the figures to save memory .. GENERATED FROM PYTHON SOURCE LINES 57-77 .. code-block:: Python import pylab as plt with reda.CreateEnterDirectory('output_visualize_4d'): # plot frequencies in one plot name, figs = seit.plot_histograms('rho_a', 'frequency') for ts, fig in sorted(figs.items()): fig.savefig(name + '_lin_{}.jpg'.format(ts), dpi=200) plt.close(fig) # plot in log10 representation name, figs = seit.plot_histograms('rho_a', 'frequency', log10=True) for ts, fig in sorted(figs.items()): fig.savefig(name + '_log10_{}.jpg'.format(ts), dpi=200) plt.close(fig) name, figs = seit.plot_histograms('rho_a', 'timestep') # plot only each third plot for ts, fig in sorted(figs.items())[0::3]: fig.savefig(name + '_{}.jpg'.format(ts), dpi=200) plt.close(fig) .. rst-class:: sphx-glr-horizontal * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_005.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_005.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_006.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_006.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_007.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_007.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_008.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_008.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_009.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_009.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_010.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_010.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_011.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_011.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_012.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_012.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_013.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_013.png :class: sphx-glr-multi-img * .. image-sg:: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_014.png :alt: time: 0.0000 , time: 1.0000 , time: 2.0000 , time: 3.0000 :srcset: /_examples/03_sEIT/images/sphx_glr_plot_visualize_4d_data_014.png :class: sphx-glr-multi-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (1 minutes 24.953 seconds) .. _sphx_glr_download__examples_03_sEIT_plot_visualize_4d_data.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_visualize_4d_data.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_visualize_4d_data.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_