From d5ec415a3890071b73e4e719138d2bdc8979f1ff Mon Sep 17 00:00:00 2001
From: Cristian C Lalescu <Cristian.Lalescu@ds.mpg.de>
Date: Fri, 22 Jan 2016 09:55:13 +0100
Subject: [PATCH] add API chapter

at the moment, it generates stuff for the installed version of the
module.
---
 bfps/tools.py                 | 23 +++++++++++++++++++++--
 documentation/_static/api.rst | 30 ++++++++++++++++++++++++++++++
 documentation/index.rst       |  1 +
 3 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 documentation/_static/api.rst

diff --git a/bfps/tools.py b/bfps/tools.py
index 91440be2..4b226427 100644
--- a/bfps/tools.py
+++ b/bfps/tools.py
@@ -32,8 +32,27 @@ def generate_data_3D(
         dtype = np.complex128,
         p = 1.5,
         amplitude = 0.5):
-    """
-    generate something that has the proper shape
+    """returns the Fourier representation of a Gaussian random field.
+
+    The generated field is scalar (single component), in practice a
+    3D `numpy` complex-valued array.
+    The field will use the FFTW representation, with the slowest
+    direction corresponding to :math:`y`, the intermediate to :math:`z`
+    and the fastest direction to :math:`x`.
+
+    :param n0: number of :math:`z` nodes on real-space grid
+    :param n1: number of :math:`y` nodes on real-space grid
+    :param n2: number of :math:`x` nodes on real-space grid
+    :param dtype: data type to use, (default=numpy.complex128)
+    :param p: exponent for powerlaw to use in spectrum
+    :param amplitude: prefactor that field is multiplied with
+    :type n0: int
+    :type n1: int
+    :type n2: int
+    :type dtype: numpy.dtype
+    :type p: float
+    :type amplitude: float
+
     """
     assert(n0 % 2 == 0 and n1 % 2 == 0 and n2 % 2 == 0)
     a = np.zeros((n1, n0, n2/2+1), dtype = dtype)
diff --git a/documentation/_static/api.rst b/documentation/_static/api.rst
new file mode 100644
index 00000000..0ccc0a91
--- /dev/null
+++ b/documentation/_static/api.rst
@@ -0,0 +1,30 @@
+API
+===
+
+bfps
+----
+
+.. automodule:: bfps
+    :members:
+    :undoc-members:
+    :inherited-members:
+    :show-inheritance:
+
+bfps.NavierStokes
+-----------------
+
+.. automodule:: bfps.NavierStokes
+    :members:
+    :undoc-members:
+    :inherited-members:
+    :show-inheritance:
+
+bfps.tools
+----------
+
+.. automodule:: bfps.tools
+    :members:
+    :undoc-members:
+    :inherited-members:
+    :show-inheritance:
+
diff --git a/documentation/index.rst b/documentation/index.rst
index dc9c5865..d36fac35 100644
--- a/documentation/index.rst
+++ b/documentation/index.rst
@@ -13,6 +13,7 @@ Welcome to bfps's documentation!
    /_static/README
    /_static/overview
    /_static/development
+   /_static/api
 
 
 Indices and tables
-- 
GitLab