.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/matrix_plot/matrix_of_perturbation_plots.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_matrix_of_perturbation_plots.py: Matrix of Perturbation Correlation Plots ======================================== This example demonstrates how to generate a matrix plot of perturbation plots for a suite of applications and experiments. This method is detailed in the :ref:`technical manual `, and requires randomly sampling nuclear data libraries to generate a scatter plot. It is recommended that the user refers to :ref:`sphx_glr_auto_examples_correlation_plot_perturbation_correlation_plot.py` for more information on the perturbation correlation plots that compose the matrix plots shown herein before continuing with this example. .. GENERATED FROM PYTHON SOURCE LINES 12-23 Interactive Matrix Plots ------------------------ Interactive matrix plots wrap several Plotly plots in an html grid that's served by a Dash app that allows users to interact with each of the individual plots. This is useful for comparing multiple applications and experiments in a single figure. Specifically, it is useful for viewing all combinations of a given set of SDF files in a single figure **Note** that by default the the correlation plots in the off-diagonal cells are :class:`tsunami_ip_utils.viz.scatter_plot.InteractiveScatterLegend` plots, which are fully interactive, and dynamically update the calculated summary statistics and regression when points are excluded with the legend. However, this interactivity requires clientiside python to run, and so is not represented in the documentation. The off-diagonal plot types can be changed, and doing so is documented in :ref:`sphx_glr_auto_examples_matrix_plot_changing_plot_defaults.py`. .. GENERATED FROM PYTHON SOURCE LINES 23-29 .. code-block:: Python from paths import EXAMPLES application_files = [ EXAMPLES / 'data' / 'example_sdfs' / 'u235-dummy' / f'sphere_model_{i}.sdf' for i in range(1,4) ] experiment_files = application_files .. GENERATED FROM PYTHON SOURCE LINES 30-33 Generate the Points Array ------------------------- First, an array of points must be generated for each application-experiment pair (these are used to construct the perturbation plots). .. GENERATED FROM PYTHON SOURCE LINES 33-43 .. code-block:: Python from tsunami_ip_utils.perturbations import generate_points from pathlib import Path base_library = EXAMPLES / 'data' / 'dummy_56_v7.1' perturbation_factors = Path("~/codes/SCALE-6.3.1/data/perturb/56n.v7.1") num_perturbations = 100 points = generate_points(application_files, experiment_files, base_library, perturbation_factors, num_perturbations) .. rst-class:: sphx-glr-script-out .. code-block:: none Generating perturbation points: 0%| | 0/100 [00:00
.. GENERATED FROM PYTHON SOURCE LINES 71-72 The plot can be saved to an image by using the :meth:`tsunami_ip_utils.viz.matrix_plot.InteractiveMatrixPlot.to_image` method .. GENERATED FROM PYTHON SOURCE LINES 72-76 .. code-block:: Python fig = matrix_plot(plot_objects, plot_type='interactive', labels=labels) fig.to_image( EXAMPLES / '_static' / 'perturbation_matrix.png' ) # sphinx_gallery_thumbnail_path = '../../examples/_static/perturbation_matrix.png' .. raw:: html
.. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 26.175 seconds) .. _sphx_glr_download_auto_examples_matrix_plot_matrix_of_perturbation_plots.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: matrix_of_perturbation_plots.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: matrix_of_perturbation_plots.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: matrix_of_perturbation_plots.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_