Skip to content

Commit

Permalink
[docs] Using tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus committed Dec 7, 2023
1 parent cfa4cdc commit 11ac6ae
Show file tree
Hide file tree
Showing 10 changed files with 185 additions and 176 deletions.
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
extensions = [
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx_tabs.tabs",
]

templates_path = ["_templates"]
Expand Down
58 changes: 29 additions & 29 deletions docs/cpp_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Statistics

.. note::

The functions are available directly in the ``GooseEYE`` namespace for individual images, and as member functions of the ``Ensemble``-class.
The functions are available directly in the ``GooseEYE`` namespace for individual images, and as member functions of the ``Ensemble``-class.

GooseEYE::mean
--------------
Expand All @@ -19,12 +19,12 @@ The arithmetic mean.

.. note::

An overload is available to mask certain voxels
An overload is available to mask certain voxels

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_mean.hpp <../include/GooseEYE/Ensemble_mean.hpp>`
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_mean.hpp <../include/GooseEYE/Ensemble_mean.hpp>`

GooseEYE::S2
------------
Expand All @@ -33,13 +33,13 @@ GooseEYE::S2

.. note::

An overload is available to mask certain voxels.
An overload is available to mask certain voxels.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_S2.hpp <../include/GooseEYE/Ensemble_S2.hpp>`
* :ref:`Theory & Example <theory_S2>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_S2.hpp <../include/GooseEYE/Ensemble_S2.hpp>`
* :ref:`Theory & Example <theory_S2>`.

GooseEYE::C2
------------
Expand All @@ -48,13 +48,13 @@ GooseEYE::C2

.. note::

An overload is available to mask certain voxels.
An overload is available to mask certain voxels.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_C2.hpp <../include/GooseEYE/Ensemble_C2.hpp>`
* :ref:`Theory & Example <theory_C2>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_C2.hpp <../include/GooseEYE/Ensemble_C2.hpp>`
* :ref:`Theory & Example <theory_C2>`.

GooseEYE::W2
------------
Expand All @@ -63,13 +63,13 @@ Weighted 2-point correlation.

.. note::

An overload is available to mask certain voxels.
An overload is available to mask certain voxels.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_W2.hpp <../include/GooseEYE/Ensemble_W2.hpp>`
* :ref:`Theory & Example <theory_W2>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_W2.hpp <../include/GooseEYE/Ensemble_W2.hpp>`
* :ref:`Theory & Example <theory_W2>`.

GooseEYE::W2c
-------------
Expand All @@ -78,13 +78,13 @@ Collapsed weighted 2-point correlation.

.. note::

An overload is available to mask certain voxels.
An overload is available to mask certain voxels.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_W2c.hpp <../include/GooseEYE/Ensemble_W2c.hpp>`
* :ref:`Theory & Example <theory_W2>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_W2c.hpp <../include/GooseEYE/Ensemble_W2c.hpp>`
* :ref:`Theory & Example <theory_W2>`.

GooseEYE::heightheight
----------------------
Expand All @@ -93,13 +93,13 @@ Height-height correlation.

.. note::

An overload is available to mask certain voxels.
An overload is available to mask certain voxels.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_heightheight.hpp <../include/GooseEYE/Ensemble_heightheight.hpp>`
* :ref:`Theory & Example <theory_heightheight>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`Ensemble_heightheight.hpp <../include/GooseEYE/Ensemble_heightheight.hpp>`
* :ref:`Theory & Example <theory_heightheight>`.

Information
===========
Expand All @@ -111,9 +111,9 @@ The relative distance of each pixel of the ROI.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`GooseEYE.hpp <../include/GooseEYE/GooseEYE.hpp>`
* :ref:`Example <theory_heightheight>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :download:`GooseEYE.hpp <../include/GooseEYE/GooseEYE.hpp>`
* :ref:`Example <theory_heightheight>`.

GooseEYE::clusters
------------------
Expand All @@ -122,5 +122,5 @@ Get clusters.

.. seealso::

* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :ref:`Example <theory_clusters>`.
* :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>`
* :ref:`Example <theory_clusters>`.
8 changes: 4 additions & 4 deletions docs/cpp_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ concerning optimisation.
There are additional targets available to expedite your ``CMakeLists.txt``:

* ``GooseEYE::assert``:
enable GooseEYE assertions by defining ``GOOSEEYE_ENABLE_ASSERT``.
enable GooseEYE assertions by defining ``GOOSEEYE_ENABLE_ASSERT``.

* ``GooseEYE::debug``:
enable GooseEYE assertions by defining ``GOOSEEYE_ENABLE_ASSERT`` and
xtensor assertions by defining ``XTENSOR_ENABLE_ASSERT`` (slow).
enable GooseEYE assertions by defining ``GOOSEEYE_ENABLE_ASSERT`` and
xtensor assertions by defining ``XTENSOR_ENABLE_ASSERT`` (slow).

* ``GooseEYE::compiler_warnings``:
enable compiler warnings (generic).
enable compiler warnings (generic).

By hand
^^^^^^^
Expand Down
37 changes: 19 additions & 18 deletions docs/theory_C2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,39 @@ If an image consists of isolated clusters ('islands' of connected pixels with th

.. math::
C_2 (\Delta x) =
P \big\{ \mathcal{C}(\vec{x}) = \mathcal{C}(\vec{x}+\Delta\vec{x}) \neq 0 \big\}
C_2 (\Delta x) =
P \big\{ \mathcal{C}(\vec{x}) = \mathcal{C}(\vec{x}+\Delta\vec{x}) \neq 0 \big\}
whereby :math:`\mathcal{C}` is an indicator with a unique non-zero index for each cluster.

.. seealso::

S. Torquato (2002). Random Heterogeneous Materials (1st ed.). Springer, New York, USA. `doi:10.1007/978-1-4757-6355-3 <http://doi.org/10.1007/978-1-4757-6355-3>`_
S. Torquato (2002). Random Heterogeneous Materials (1st ed.). Springer, New York, USA. `doi:10.1007/978-1-4757-6355-3 <http://doi.org/10.1007/978-1-4757-6355-3>`_

Example
-------

| :download:`C2.py <examples/C2.py>`
| :download:`C2.cpp <examples/C2.cpp>`
.. image:: examples/C2.svg
:width: 700px
:width: 700px

.. note::

Like for the :ref:`2-point correlation <theory_S2>`, a :ref:`mask <theory_S2_masked>` can be used. Similarly, the average can be extended to that of an :ref:`ensemble <theory_S2_ensemble>` of images.
Like for the :ref:`2-point correlation <theory_S2>`, a :ref:`mask <theory_S2_masked>` can be used. Similarly, the average can be extended to that of an :ref:`ensemble <theory_S2_ensemble>` of images.

.. tabs::

.. tab:: Python

:download:`C2.py <examples/C2.py>`

Python
^^^^^^
.. literalinclude:: examples/C2.py
:language: python
:start-after: <snippet>
:end-before: </snippet>

.. literalinclude:: examples/C2.py
:language: python
:start-after: <snippet>
:end-before: </snippet>
.. tab:: C++

C++
^^^
:download:`C2.cpp <examples/C2.cpp>`

.. literalinclude:: examples/C2.cpp
:language: cpp
.. literalinclude:: examples/C2.cpp
:language: cpp
27 changes: 14 additions & 13 deletions docs/theory_L.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ The paths can be computed using different algorithms, illustrated below:
Example
-------

| :download:`L.py <examples/L.py>`
| :download:`L.cpp <examples/L.cpp>`
.. image:: examples/L.svg
:width: 700px

Expand All @@ -72,16 +69,20 @@ Example
the average can be extended to that of an
:ref:`ensemble <theory_S2_ensemble>` of images.

Python
^^^^^^
.. tabs::

.. tab:: Python

:download:`L.py <examples/L.py>`

.. literalinclude:: examples/L.py
:language: python
:start-after: <snippet>
:end-before: </snippet>

.. literalinclude:: examples/L.py
:language: python
:start-after: <snippet>
:end-before: </snippet>
.. tab:: C++

C++
^^^
:download:`L.cpp <examples/L.cpp>`

.. literalinclude:: examples/L.cpp
:language: cpp
.. literalinclude:: examples/L.cpp
:language: cpp
47 changes: 24 additions & 23 deletions docs/theory_S2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ the 2-point probability :math:`S_2` in two dimensions,
and a cross-section of this result in the middle of the region-of-interest
along the horizontal axis.

| :download:`S2.py <examples/S2.py>`
| :download:`S2.cpp <examples/S2.cpp>`
.. image:: examples/S2.svg
:width: 700px

Expand All @@ -87,19 +84,23 @@ along the horizontal axis.
If this assumption is not reasonable be sure to specify the
``periodic`` option (that defaults True).

Python
^^^^^^
.. tabs::

.. tab:: Python

:download:`S2.py <examples/S2.py>`

.. literalinclude:: examples/S2.py
:language: python
:start-after: <snippet>
:end-before: </snippet>
.. literalinclude:: examples/S2.py
:language: python
:start-after: <snippet>
:end-before: </snippet>

C++
^^^
.. tab:: C++

.. literalinclude:: examples/S2.cpp
:language: cpp
:download:`S2.cpp <examples/S2.cpp>`

.. literalinclude:: examples/S2.cpp
:language: cpp

.. _theory_S2_masked:

Expand Down Expand Up @@ -137,19 +138,19 @@ and then adds the result per image to it. Consider the following example.
relative small measurements. See
`Wikipedia <https://en.wikipedia.org/wiki/Ensemble_average_(statistical_mechanics)>`__.

Python
^^^^^^
.. tabs::

.. tab:: Python

.. literalinclude:: examples/S2_ensemble.py
:language: python
:start-after: <snippet>
:end-before: </snippet>
.. literalinclude:: examples/S2_ensemble.py
:language: python
:start-after: <snippet>
:end-before: </snippet>

C++
^^^
.. tab:: C++

.. literalinclude:: examples/S2_ensemble.cpp
:language: cpp
.. literalinclude:: examples/S2_ensemble.cpp
:language: cpp

Auto-correlation
----------------
Expand Down
Loading

0 comments on commit 11ac6ae

Please sign in to comment.