Use nbsphinx for rendering Jupyter notebooks in documentation

This commit is contained in:
Paul Romano 2020-10-14 07:57:52 -05:00
parent c5f66a3af5
commit 7228bba307
52 changed files with 101 additions and 568 deletions

View file

@ -20,13 +20,12 @@ on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
# ImportErrors when building documentation
from unittest.mock import MagicMock
MOCK_MODULES = [
'numpy', 'numpy.polynomial', 'numpy.polynomial.polynomial',
'numpy.ctypeslib', 'scipy', 'scipy.sparse', 'scipy.sparse.linalg',
'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.special',
'scipy.stats', 'scipy.spatial', 'h5py', 'pandas', 'uncertainties',
'matplotlib', 'matplotlib.pyplot', 'openmoc',
'scipy.interpolate', 'scipy.integrate', 'scipy.optimize', 'scipy.signal',
'scipy.special', 'scipy.stats', 'scipy.spatial', 'h5py', 'pandas',
'uncertainties', 'matplotlib', 'matplotlib.pyplot', 'openmoc',
'openmc.data.reconstruct', 'openmc.checkvalue'
]
sys.modules.update((mod_name, MagicMock()) for mod_name in MOCK_MODULES)
@ -39,7 +38,6 @@ np.polynomial.Polynomial = MagicMock
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../sphinxext'))
sys.path.insert(0, os.path.abspath('../..'))
@ -47,14 +45,16 @@ sys.path.insert(0, os.path.abspath('../..'))
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.katex',
'sphinx_numfig',
'notebook_sphinxext']
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.napoleon',
'sphinx.ext.autosummary',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.katex',
'sphinx_numfig',
'nbsphinx'
]
if not on_rtd:
extensions.append('sphinxcontrib.rsvgconverter')

View file

@ -1,13 +0,0 @@
.. _notebook_cad-geom:
==========================
Using CAD-Based Geometries
==========================
.. only:: html
.. notebook:: ../../../examples/jupyter/cad-based-geometry.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_candu:
=======================
Modeling a CANDU Bundle
=======================
.. only:: html
.. notebook:: ../../../examples/jupyter/candu.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_expansion:
=====================
Functional Expansions
=====================
.. only:: html
.. notebook:: ../../../examples/jupyter/expansion-filters.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_hexagonal:
===========================
Modeling Hexagonal Lattices
===========================
.. only:: html
.. notebook:: ../../../examples/jupyter/hexagonal-lattice.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -23,7 +23,7 @@ General Usage
search
nuclear-data
nuclear-data-resonance-covariance
pincell-depletion
pincell_depletion
--------
Geometry
@ -32,14 +32,14 @@ Geometry
.. toctree::
:maxdepth: 1
hexagonal
hexagonal-lattice
triso
candu
cad-geom
cad-based-geometry
------------------------------------
Multi-Group Cross Section Generation
------------------------------------
-----------------------------------
Multigroup Cross Section Generation
-----------------------------------
.. toctree::
:maxdepth: 1
@ -50,9 +50,9 @@ Multi-Group Cross Section Generation
mdgxs-part-i
mdgxs-part-ii
----------------
Multi-Group Mode
----------------
---------------
Multigroup Mode
---------------
.. toctree::
:maxdepth: 1

View file

@ -1,13 +0,0 @@
.. _notebook_mdgxs_part_i:
===================================================================
Multi-Group (Delayed) Cross Section Generation Part I: Introduction
===================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mdgxs-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mdgxs_part_ii:
=========================================================================
Multi-Group (Delayed) Cross Section Generation Part II: Advanced Features
=========================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mdgxs-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_i:
=====================================
Multi-Group Mode Part I: Introduction
=====================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_ii:
=============================================================
Multi-Group Mode Part II: MGXS Library Generation With OpenMC
=============================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mg_mode_part_iii:
====================================================
Multi-Group Mode Part III: Advanced Feature Showcase
====================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/mg-mode-part-iii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_i:
=========================
MGXS Part I: Introduction
=========================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_ii:
===============================
MGXS Part II: Advanced Features
===============================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_mgxs_part_iii:
========================
MGXS Part III: Libraries
========================
.. only:: html
.. notebook:: ../../../examples/jupyter/mgxs-part-iii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_nuclear_data_resonance_covariance:
==================================
Nuclear Data: Resonance Covariance
==================================
.. only:: html
.. notebook:: ../../../examples/jupyter/nuclear-data-resonance-covariance.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_nuclear_data:
============
Nuclear Data
============
.. only:: html
.. notebook:: ../../../examples/jupyter/nuclear-data.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _examples_pandas:
=================
Pandas Dataframes
=================
.. only:: html
.. notebook:: ../../../examples/jupyter/pandas-dataframes.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,14 +0,0 @@
.. _notebook_depletion:
=================
Pincell Depletion
=================
.. only:: html
.. notebook:: ../../../examples/jupyter/pincell_depletion.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_pincell:
===================
Modeling a Pin-Cell
===================
.. only:: html
.. notebook:: ../../../examples/jupyter/pincell.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_post_processing:
===============
Post Processing
===============
.. only:: html
.. notebook:: ../../../examples/jupyter/post-processing.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_search:
==================
Criticality Search
==================
.. only:: html
.. notebook:: ../../../examples/jupyter/search.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,11 +0,0 @@
================
Tally Arithmetic
================
.. only:: html
.. notebook:: ../../../examples/jupyter/tally-arithmetic.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_triso:
========================
Modeling TRISO Particles
========================
.. only:: html
.. notebook:: ../../../examples/jupyter/triso.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_unstructured_mesh_part_i:
===============================
Unstructured Mesh: Introduction
===============================
.. only:: html
.. notebook:: ../../../examples/jupyter/unstructured-mesh-part-i.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.

View file

@ -1,13 +0,0 @@
.. _notebook_unstructured_mesh_part_ii:
===================================================================================
Unstructured Mesh: Unstructured Mesh Tallies with CAD and Point Cloud Visualization
===================================================================================
.. only:: html
.. notebook:: ../../../examples/jupyter/unstructured-mesh-part-ii.ipynb
.. only:: latex
IPython notebooks must be viewed in the online HTML documentation.