.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples\postprocessor\ep-postprocess-reaction-eikonal.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_postprocessor_ep-postprocess-reaction-eikonal.py: Postprocess a Reaction-Eikonal model. ------------------------------------- This example shows how to postprocess a full heart reaction eikonal model. .. GENERATED FROM PYTHON SOURCE LINES 31-40 .. warning:: When using a standalone version of the DPF Server, you must accept the `license terms `_. To accept these terms, you can set this environment variable: .. code-block:: python import os os.environ["ANSYS_DPF_ACCEPT_LA"] = "Y" .. GENERATED FROM PYTHON SOURCE LINES 42-45 Perform the required imports ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Import the required modules and set relevant paths. .. GENERATED FROM PYTHON SOURCE LINES 45-50 .. code-block:: Python from pathlib import Path from ansys.health.heart.post.dpf_utils import EPpostprocessor .. GENERATED FROM PYTHON SOURCE LINES 51-53 Create a postprocessor object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 55-58 .. note:: This example assumes that you have you ran a full heart electrophysiology simulation and that the d3plot files are located in ``data_path``. .. GENERATED FROM PYTHON SOURCE LINES 58-72 .. code-block:: Python # Import the required modules and set relevant paths. workdir = Path.home() / "pyansys-heart" / "downloads" / "Rodero2021" / "01" / "FullHeart" # Specify the path to the d3plot that contains the simulation results. data_path = workdir / "simulation-EP" / "main-ep-ReactionEikonal" / "d3plot" # Check if the file exists. if not data_path.is_file(): raise FileNotFoundError(f"File not found: {data_path}") # Initialize the postprocessor. post = EPpostprocessor(data_path) .. GENERATED FROM PYTHON SOURCE LINES 73-75 Call methods to retrieve activation time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 75-82 .. code-block:: Python # Get activation time of the full field at the last time step. activation_times = post.get_activation_times() print(activation_times.data) activation_times.plot(show_edges=False, show_scalar_bar=True) .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/postprocessor/images/sphx_glr_ep-postprocess-reaction-eikonal_001.png :alt: ep postprocess reaction eikonal :srcset: /examples/postprocessor/images/sphx_glr_ep-postprocess-reaction-eikonal_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: C:\Users\ansys\actions-runner\_work\pyansys-heart\pyansys-heart\doc\source\examples\postprocessor\images\sphx_glr_ep-postprocess-reaction-eikonal_001.vtksz .. rst-class:: sphx-glr-script-out .. code-block:: none [205. 212. 207. ... 145. 147. 148.] .. GENERATED FROM PYTHON SOURCE LINES 83-85 Create a clip view. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 85-99 .. code-block:: Python # Create a clip view of the activation time using ``pyvista``. import pyvista as pv # Retrieve the unstructured grid. grid: pv.UnstructuredGrid = post.reader.model.metadata.meshed_region.grid grid.point_data["activation_time"] = activation_times.data grid.set_active_scalars("activation_time") # Clip the model and plot. grid.clip( normal=[0.7785200198880087, -0.027403237199259987, 0.6270212446357586], origin=[88.24004990770091, 54.41149629465821, 49.1801566480857], ).plot(show_scalar_bar=True) .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/postprocessor/images/sphx_glr_ep-postprocess-reaction-eikonal_002.png :alt: ep postprocess reaction eikonal :srcset: /examples/postprocessor/images/sphx_glr_ep-postprocess-reaction-eikonal_002.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: C:\Users\ansys\actions-runner\_work\pyansys-heart\pyansys-heart\doc\source\examples\postprocessor\images\sphx_glr_ep-postprocess-reaction-eikonal_002.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.429 seconds) .. _sphx_glr_download_examples_postprocessor_ep-postprocess-reaction-eikonal.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: ep-postprocess-reaction-eikonal.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: ep-postprocess-reaction-eikonal.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: ep-postprocess-reaction-eikonal.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_