.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/matrix_plot/different_applications_and_experiments.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_matrix_plot_different_applications_and_experiments.py: Matrices With a Different Set of Applications and Experiments ============================================================= This example demonstrates the use of the `matrix_plot` function to visualize matrices with a different set of applications and experiments. This means that the diagonal of the matrix does not necessarily represent an application/experiment compared with itself, and so contribution plots aren't shown. .. GENERATED FROM PYTHON SOURCE LINES 10-12 The input is exactly as described in :ref:`sphx_glr_auto_examples_matrix_plot_matrix_of_contribution_plots.py`, except that the applications and experiments lists include different SDF files. .. GENERATED FROM PYTHON SOURCE LINES 12-36 .. code-block:: Python from tsunami_ip_utils.viz.viz import matrix_plot from tsunami_ip_utils.viz.plot_utils import generate_plot_objects_array_from_contributions from tsunami_ip_utils.integral_indices import get_uncertainty_contributions from paths import EXAMPLES application_files = [ EXAMPLES / 'data' / 'example_sdfs' / 'MCT' / f'MIX-COMP-THERM-001-00{i}.sdf' for i in range(1,4) ] experiment_files = [ EXAMPLES / 'data' / 'example_sdfs' / 'MCT' / f'MIX-COMP-THERM-002-00{i}S.sdf' for i in range(1,4) ] contributions_nuclide, contributions_nuclide_reaction = get_uncertainty_contributions(application_files, experiment_files, variance=True) labels = { 'applications': [ application_file.name for application_file in application_files ], 'experiments': [ experiment_file.name for experiment_file in experiment_files ], } plot_objects_array = generate_plot_objects_array_from_contributions( contributions_nuclide, integral_index_name='(Δk/k)^2' ) fig = matrix_plot(plot_objects_array, plot_type='interactive', labels=labels) fig.show() .. raw:: html
.. GENERATED FROM PYTHON SOURCE LINES 37-38 Now the plot can also be saved to an image .. GENERATED FROM PYTHON SOURCE LINES 38-42 .. code-block:: Python fig = matrix_plot(plot_objects_array, plot_type='interactive') fig.to_image( EXAMPLES / '_static' / 'different_applications_and_experiments_matrix.png' ) # sphinx_gallery_thumbnail_path = '../../examples/_static/different_applications_and_experiments_matrix.png' .. raw:: html
.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 38.510 seconds) .. _sphx_glr_download_auto_examples_matrix_plot_different_applications_and_experiments.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: different_applications_and_experiments.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: different_applications_and_experiments.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: different_applications_and_experiments.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_