Skip to content

Commit

Permalink
Update doc generation with sphinx.
Browse files Browse the repository at this point in the history
Add makefile targets for cleaning doc and transfer Ford pages to sphinx.
  • Loading branch information
MilanSkocic committed Jan 28, 2025
1 parent b2687d5 commit 0fc8d69
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 23 deletions.
6 changes: 5 additions & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: ford html
.PHONY: ford html clean copy

all: ford html copy

Expand All @@ -11,3 +11,7 @@ ford:
copy:
mkdir -p sphinx/build/html/ford/
cp -rf ford/build/* sphinx/build/html/ford/

clean:
make -C ford clean
make -C sphinx clean
4 changes: 4 additions & 0 deletions doc/ford/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.PHONY: clean

all:
mkdir -p build
ford ./sources/conf.md

clean:
rm -rf build/
2 changes: 1 addition & 1 deletion doc/ford/sources/conf.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
project: ciaaw
summary: Fortran library providing the standard atomic weights according to CIAAW.
summary: Standard atomic weights, isotopic compositions and nuclide's atomic weights.
project_github: https://github.com/MilanSkocic/ciaaw
project_download: https://github.com/MilanSkocic/ciaaw/releases
project_website: https://milanskocic.github.io/ciaaw/index.html
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/source/api/c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
C API
*****

.. literalinclude:: ../../../include/ciaaw.h
.. literalinclude:: ../../../../include/ciaaw.h
:language: C
12 changes: 12 additions & 0 deletions doc/sphinx/source/api/fortran.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ Fortran

The Fortran documentation is generated with `FORD <../ford/index.html>`_.

The modules [[ciaaw__saw(module)]], [[ciaaw__ice(module)]], [[ciaaw__naw(module)]] and [[ciaaw__pte(module)]] are
automatically generated with a simple script written in Python.

The API defines convenient getters are available for accessing the desired data for an elements
without having to access to whole periodic table [[ciaaw__pte(module):pt]]

* [[ciaaw__api(module):get_saw(function)]]
* [[ciaaw__api(module):get_ice(function)]]
* [[ciaaw__api(module):get_nice(function)]]
* [[ciaaw__api(module):get_naw(function)]]
* [[ciaaw__api(module):get_nnaw(function)]]

.. .. autofortran:: ../src/ciaaw.f90
.. .. autofortran:: ../src/ciaaw_api.f90
5 changes: 3 additions & 2 deletions doc/sphinx/source/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ APIs


.. toctree::
:caption: API
:hidden:
:maxdepth: 1

fortran.rst
c.rst
python.rst


4 changes: 2 additions & 2 deletions doc/sphinx/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys
sys.path.insert(0, os.path.abspath('../py/src/'))
sys.path.insert(0, os.path.abspath('../../../py/src/'))
import pyciaaw
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
Expand All @@ -13,7 +13,7 @@

project = 'ciaaw'
copyright = '2025, M. Skocic'
author = 'M. Skocic'
author = 'Milan Skocic'
release = pyciaaw.__version__

# -- General configuration ---------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions doc/sphinx/source/getting_started/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ Examples
Fortran
=======

.. literalinclude:: ../../../example/example.f90
.. literalinclude:: ../../../../example/example.f90
:language: Fortran


C
==

.. literalinclude:: ../../../example/example.c
.. literalinclude:: ../../../../example/example.c
:language: C


Python
======

.. literalinclude:: ../../../example/example.py
.. literalinclude:: ../../../../example/example.py
:language: python
3 changes: 1 addition & 2 deletions doc/sphinx/source/getting_started/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Getting Started


.. toctree::
:caption: Contents
:hidden:
:maxdepth: 1

readme.rst
examples.rst
Expand Down
2 changes: 1 addition & 1 deletion doc/sphinx/source/getting_started/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ Readme
******


.. include:: ../../../README.md
.. include:: ../../../../README.md
:parser: myst_parser.sphinx_
51 changes: 43 additions & 8 deletions doc/sphinx/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,52 @@
CIAAW
=====

.. image:: ../../media/logo.png
.. toctree::
:maxdepth: 1

getting_started/index
api/index
references/index.rst

.. image:: ../../../media/logo.png
:width: 400
:alt: Alternative text

Standard atomic weights, isotopic compositions and nuclide's atomic weights.
Standard and abridged atomic weights, isotopic abundances and
nuclides' standard atomic weights according to `CIAAW <https://www.ciaaw.org>`_.

SAW: Standard Atomic Weights
----------------------------

.. toctree::
:maxdepth: 2
:caption: Contents:
The latest standard atomic weights were released in 2021 by the [ciaaw](https://www.ciaaw.org).
All the values for the atomic weights are provided as double precision reals in a derived type
[[ciaaw__types(module):saw_type(type)]].

getting_started/index
api/index
references/index.rst
The standard atomic weights (or realtive atomic mass),:math:`A_r(E)`,
are extracted from table 1 :cite:p:`prohaska2022-1`. For the elements
that feature an interval for the standard atomic weight, the mean value and the uncertainty are computed
using formulas defined in [Van der Veen et al. 2021](../references.html).

$$ A_r(E) = \frac{a+b}{2} $$

$$ u(A_r(E)) = \frac{b-a}{2\sqrt{3}} $$

The standard atomic weights are a dimensionless quantity and thus they need to be multiplied by
the molar mass constant \(M_u=1.00000000105 \pm 0.00000000031 g.mol^{-1}\)
in order to get the value in \(g.mol^{-1}\).
See [codata](https://milanskocic.github.io/codata/) for physical constants.


## ICE: Isotopic Compositions of the Element

The latest isotopic compositions were released in 2013 by the [ciaaw](https://www.ciaaw.org).
All the values for the compositions are provided as double precision reals in a derived type
[[ciaaw__types(module):ice_type(type)]].
The isotopic compositions of the element, are extracted from table 1 [Meija et al. 2013](../references.html).

## NAW: Nuclide Atomic Weights

The latest atomic weights for nuclides were released in 2020 by [ciaaw](https://www.ciaaw.org)
from [Huang et al. 2021](../references.html).
All the values for the nuclide atomic weights are provided as double precision reals in derived type
[[ciaaw__types(module):naw_type(type)]].
3 changes: 1 addition & 2 deletions doc/sphinx/source/references/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Bibliography


.. toctree::
:caption: Contents
:hidden:
:maxdepth: 1

references.rst

0 comments on commit 0fc8d69

Please sign in to comment.