diff --git a/docs/conf.py b/docs/conf.py index 10ffb5c..9621230 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,6 +5,7 @@ extensions = [ "sphinx.ext.mathjax", "sphinx.ext.todo", + "sphinx_tabs.tabs", ] templates_path = ["_templates"] diff --git a/docs/cpp_functions.rst b/docs/cpp_functions.rst index 13531b8..7ebd2d0 100644 --- a/docs/cpp_functions.rst +++ b/docs/cpp_functions.rst @@ -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 -------------- @@ -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 ------------ @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`Ensemble_S2.hpp <../include/GooseEYE/Ensemble_S2.hpp>` + * :ref:`Theory & Example `. GooseEYE::C2 ------------ @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`Ensemble_C2.hpp <../include/GooseEYE/Ensemble_C2.hpp>` + * :ref:`Theory & Example `. GooseEYE::W2 ------------ @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`Ensemble_W2.hpp <../include/GooseEYE/Ensemble_W2.hpp>` + * :ref:`Theory & Example `. GooseEYE::W2c ------------- @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`Ensemble_W2c.hpp <../include/GooseEYE/Ensemble_W2c.hpp>` + * :ref:`Theory & Example `. GooseEYE::heightheight ---------------------- @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`Ensemble_heightheight.hpp <../include/GooseEYE/Ensemble_heightheight.hpp>` + * :ref:`Theory & Example `. Information =========== @@ -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 `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :download:`GooseEYE.hpp <../include/GooseEYE/GooseEYE.hpp>` + * :ref:`Example `. GooseEYE::clusters ------------------ @@ -122,5 +122,5 @@ Get clusters. .. seealso:: - * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` - * :ref:`Example `. + * :download:`GooseEYE.h <../include/GooseEYE/GooseEYE.h>` + * :ref:`Example `. diff --git a/docs/cpp_install.rst b/docs/cpp_install.rst index d41bbf9..8a2d771 100644 --- a/docs/cpp_install.rst +++ b/docs/cpp_install.rst @@ -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 ^^^^^^^ diff --git a/docs/theory_C2.rst b/docs/theory_C2.rst index 999a62e..b909798 100644 --- a/docs/theory_C2.rst +++ b/docs/theory_C2.rst @@ -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 `_ + S. Torquato (2002). Random Heterogeneous Materials (1st ed.). Springer, New York, USA. `doi:10.1007/978-1-4757-6355-3 `_ Example ------- -| :download:`C2.py ` -| :download:`C2.cpp ` - .. image:: examples/C2.svg - :width: 700px + :width: 700px .. note:: - Like for the :ref:`2-point correlation `, a :ref:`mask ` can be used. Similarly, the average can be extended to that of an :ref:`ensemble ` of images. + Like for the :ref:`2-point correlation `, a :ref:`mask ` can be used. Similarly, the average can be extended to that of an :ref:`ensemble ` of images. + +.. tabs:: + + .. tab:: Python + + :download:`C2.py ` -Python -^^^^^^ + .. literalinclude:: examples/C2.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/C2.py - :language: python - :start-after: - :end-before: + .. tab:: C++ -C++ -^^^ + :download:`C2.cpp ` -.. literalinclude:: examples/C2.cpp - :language: cpp + .. literalinclude:: examples/C2.cpp + :language: cpp diff --git a/docs/theory_L.rst b/docs/theory_L.rst index e8425e1..1c1e306 100644 --- a/docs/theory_L.rst +++ b/docs/theory_L.rst @@ -60,9 +60,6 @@ The paths can be computed using different algorithms, illustrated below: Example ------- -| :download:`L.py ` -| :download:`L.cpp ` - .. image:: examples/L.svg :width: 700px @@ -72,16 +69,20 @@ Example the average can be extended to that of an :ref:`ensemble ` of images. -Python -^^^^^^ +.. tabs:: + + .. tab:: Python + + :download:`L.py ` + + .. literalinclude:: examples/L.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/L.py - :language: python - :start-after: - :end-before: + .. tab:: C++ -C++ -^^^ + :download:`L.cpp ` -.. literalinclude:: examples/L.cpp - :language: cpp + .. literalinclude:: examples/L.cpp + :language: cpp diff --git a/docs/theory_S2.rst b/docs/theory_S2.rst index 3d64052..3518fdd 100644 --- a/docs/theory_S2.rst +++ b/docs/theory_S2.rst @@ -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 ` -| :download:`S2.cpp ` - .. image:: examples/S2.svg :width: 700px @@ -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 ` -.. literalinclude:: examples/S2.py - :language: python - :start-after: - :end-before: + .. literalinclude:: examples/S2.py + :language: python + :start-after: + :end-before: -C++ -^^^ + .. tab:: C++ -.. literalinclude:: examples/S2.cpp - :language: cpp + :download:`S2.cpp ` + + .. literalinclude:: examples/S2.cpp + :language: cpp .. _theory_S2_masked: @@ -137,19 +138,19 @@ and then adds the result per image to it. Consider the following example. relative small measurements. See `Wikipedia `__. -Python -^^^^^^ +.. tabs:: + + .. tab:: Python -.. literalinclude:: examples/S2_ensemble.py - :language: python - :start-after: - :end-before: + .. literalinclude:: examples/S2_ensemble.py + :language: python + :start-after: + :end-before: -C++ -^^^ + .. tab:: C++ -.. literalinclude:: examples/S2_ensemble.cpp - :language: cpp + .. literalinclude:: examples/S2_ensemble.cpp + :language: cpp Auto-correlation ---------------- diff --git a/docs/theory_W2.rst b/docs/theory_W2.rst index 04a617c..614941d 100644 --- a/docs/theory_W2.rst +++ b/docs/theory_W2.rst @@ -80,9 +80,6 @@ all pixels for which :math:`\mathcal{M}(\vec{x}_i) = 0` are considered as normal Example ------- -| :download:`W2.py ` -| :download:`W2.cpp ` - .. image:: examples/W2.svg :width: 700px @@ -93,19 +90,23 @@ Example Similarly, the average can be extended to that of an :ref:`ensemble ` of images. -Python -^^^^^^ +.. tabs:: + + .. tab:: Python + + :download:`W2.py ` + + .. literalinclude:: examples/W2.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/W2.py - :language: python - :start-after: - :end-before: + .. tab:: C++ -C++ -^^^ + :download:`W2.cpp ` -.. literalinclude:: examples/W2.cpp - :language: cpp + .. literalinclude:: examples/W2.cpp + :language: cpp Collapse to single point ------------------------ @@ -153,8 +154,6 @@ Similarly to the above, a mask may be introduced as follows: Example ^^^^^^^ -| :download:`W2c.py ` - .. image:: examples/W2c.svg :width: 700px @@ -165,10 +164,13 @@ Example Similarly, the average can be extended to that of an :ref:`ensemble ` of images. -Python -^^^^^^ +.. tabs:: + + .. tab:: Python + + :download:`W2c.py ` -.. literalinclude:: examples/W2c.py - :language: python - :start-after: - :end-before: + .. literalinclude:: examples/W2c.py + :language: python + :start-after: + :end-before: diff --git a/docs/theory_clusters.rst b/docs/theory_clusters.rst index edf7a5c..3a9969f 100644 --- a/docs/theory_clusters.rst +++ b/docs/theory_clusters.rst @@ -4,83 +4,84 @@ Obtain clusters =============== .. raw:: html - :file: examples/clusters_algorithm.html + :file: examples/clusters_algorithm.html Calculate clusters ------------------ Extract clusters ('islands' of connected pixels with the same value). -| :download:`clusters.py ` -| :download:`clusters.cpp ` - .. image:: examples/clusters.svg - :width: 700px + :width: 700px + +.. tabs:: + + .. tab:: Python -Python -^^^^^^ + :download:`clusters.py ` -.. literalinclude:: examples/clusters.py - :language: python - :start-after: - :end-before: + .. literalinclude:: examples/clusters.py + :language: python + :start-after: + :end-before: -C++ -^^^ + .. tab:: C++ -.. literalinclude:: examples/clusters.cpp - :language: cpp + :download:`clusters.cpp ` + + .. literalinclude:: examples/clusters.cpp + :language: cpp Calculate clusters and centers ------------------------------ -| :download:`clusters_centers.py ` -| :download:`clusters_centers.cpp ` - .. image:: examples/clusters_centers.svg - :width: 700px + :width: 700px + +.. tabs:: -Python -^^^^^^ + .. tab:: Python -.. literalinclude:: examples/clusters_centers.py - :language: python - :start-after: - :end-before: + :download:`clusters_centers.py ` -C++ -^^^ + .. literalinclude:: examples/clusters_centers.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/clusters_centers.cpp - :language: cpp + .. tab:: C++ + + :download:`clusters_centers.cpp ` + + .. literalinclude:: examples/clusters_centers.cpp + :language: cpp Dilate clusters (differently) ----------------------------- -| :download:`clusters_dilate.py ` -| :download:`clusters_dilate.cpp ` - .. image:: examples/clusters_dilate.svg - :width: 700px + :width: 700px + +.. tabs:: + + .. tab:: Python -Python -^^^^^^ + :download:`clusters_dilate.py ` -:download:`clusters_dilate.py ` + .. literalinclude:: examples/clusters_dilate.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/clusters_dilate.py - :language: python - :start-after: - :end-before: + .. note:: -.. note:: + There is an additional example to show the effect of periodicity: + :download:`clusters_dilate_periodic.py ` + :download:`clusters_dilate_periodic.svg ` - There is an additional example to show the effect of periodicity: - :download:`clusters_dilate_periodic.py ` - :download:`clusters_dilate_periodic.svg ` + .. tab:: C++ -C++ -^^^ + :download:`clusters_dilate.cpp ` -.. literalinclude:: examples/clusters_dilate.cpp - :language: cpp + .. literalinclude:: examples/clusters_dilate.cpp + :language: cpp diff --git a/docs/theory_heightheight.rst b/docs/theory_heightheight.rst index f2fa6e3..ee7e3dc 100644 --- a/docs/theory_heightheight.rst +++ b/docs/theory_heightheight.rst @@ -7,35 +7,36 @@ The height-height correlation corresponds to the following: .. math:: - \mathcal{P} (\Delta \vec{x}) = - \sqrt{ \sum_{i} \; \left( - z (\vec{x}_i + \Delta \vec{x}) - - z (\vec{x}_i) - \right)^2 } + \mathcal{P} (\Delta \vec{x}) = + \sqrt{ \sum_{i} \; \left( + z (\vec{x}_i + \Delta \vec{x}) - + z (\vec{x}_i) + \right)^2 } Example ------- -| :download:`heightheight.py ` -| :download:`heightheight.cpp ` - .. image:: examples/heightheight.svg - :width: 700px + :width: 700px .. note:: - Like for the :ref:`2-point correlation `, a :ref:`mask ` can be used. Similarly, the average can be extended to that of an :ref:`ensemble ` of images. + Like for the :ref:`2-point correlation `, a :ref:`mask ` can be used. Similarly, the average can be extended to that of an :ref:`ensemble ` of images. + +.. tabs:: + + .. tab:: Python + + :download:`heightheight.py ` -Python -^^^^^^ + .. literalinclude:: examples/heightheight.py + :language: python + :start-after: + :end-before: -.. literalinclude:: examples/heightheight.py - :language: python - :start-after: - :end-before: + .. tab:: C++ -C++ -^^^ + :download:`heightheight.cpp ` -.. literalinclude:: examples/heightheight.cpp - :language: cpp + .. literalinclude:: examples/heightheight.cpp + :language: cpp diff --git a/environment.yaml b/environment.yaml index 77f894f..3206717 100644 --- a/environment.yaml +++ b/environment.yaml @@ -19,6 +19,7 @@ dependencies: - scikit-build - scipy - setuptools_scm +- sphinx-tabs - xsimd - xtensor - xtensor-python