Commit e5d5cd39 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

improve the docstrings of the Space-related classes

parent e5f51246
Pipeline #12107 passed with stage
in 4 minutes and 42 seconds
......@@ -43,8 +43,8 @@ class GLSpace(Space):
----------
nlat : int
Number of latitudinal bins, or rings.
nlon : int, *optional*
Number of longitudinal bins (default: ``2*nlat - 1``).
nlon : int
Number of longitudinal bins.
See Also
--------
......@@ -83,6 +83,8 @@ class GLSpace(Space):
------
ValueError
If input `nlat` is invalid.
ImportError
If the pyHealpix module is not available
"""
if 'pyHealpix' not in gdi:
......
......@@ -60,7 +60,7 @@ class HPSpace(Space):
def __init__(self, nside):
"""
Sets the attributes for a hp_space class instance.
Sets the attributes for a HPSpace class instance.
Parameters
----------
......
......@@ -43,19 +43,17 @@ class LMSpace(Space):
Maximum :math:`\ell`-value up to which the spherical harmonics
coefficients are to be used.
Notes:
------
This implementation implicitly sets the mmax parameter to lmax.
See Also
--------
hp_space : A class for the HEALPix discretization of the sphere [#]_.
gl_space : A class for the Gauss-Legendre discretization of the
sphere [#]_.
Notes
-----
Hermitian symmetry, i.e. :math:`a_{\ell -m} = \overline{a}_{\ell m}` is
always assumed for the spherical harmonics components, i.e. only fields
on the two-sphere with real-valued representations in position space
can be handled.
References
----------
.. [#] K.M. Gorski et al., 2005, "HEALPix: A Framework for
......
......@@ -52,31 +52,37 @@ class RGSpace(Space):
----------
harmonic : bool
Whether or not the grid represents a Fourier basis.
zerocenter : {bool, numpy.ndarray}, *optional*
zerocenter : {bool, numpy.ndarray}
Whether the Fourier zero-mode is located in the center of the grid
(or the center of each axis speparately) or not (default: True).
distances : {float, numpy.ndarray}, *optional*
(or the center of each axis speparately) or not.
MR FIXME: this also does something if the space is not harmonic!
distances : {float, numpy.ndarray}
Distance between two grid points along each axis (default: None).
"""
# ---Overwritten properties and methods---
def __init__(self, shape=(1,), zerocenter=False, distances=None,
def __init__(self, shape, zerocenter=False, distances=None,
harmonic=False):
"""
Sets the attributes for an rg_space class instance.
Sets the attributes for an RGSpace class instance.
Parameters
----------
shape : {int, numpy.ndarray}
Number of gridpoints or numbers of gridpoints along each axis.
Number of grid points or numbers of gridpoints along each axis.
zerocenter : {bool, numpy.ndarray}, *optional*
Whether the Fourier zero-mode is located in the center of the
grid (or the center of each axis speparately) or not
MR FIXME: this also does something if the space is not harmonic!
(default: False).
distances : {float, numpy.ndarray}, *optional*
Distance between two grid points along each axis
(default: None).
If distances==None:
if harmonic==True, all distances will be set to 1
if harmonic==False, the distance along each axis will be
set to the inverse of the number of points along that axis
harmonic : bool, *optional*
Whether the space represents a Fourier or a position grid
(default: False).
......@@ -202,6 +208,8 @@ class RGSpace(Space):
"""
Calculates an n-dimensional array with its entries being the
lengths of the k-vectors from the zero point of the grid.
MR FIXME: Since this is about k-vectors, it might make sense to
throw NotImplementedError if harmonic==False.
Parameters
----------
......
......@@ -16,127 +16,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
.. __ ____ __
.. /__/ / _/ / /_
.. __ ___ __ / /_ / _/ __ __
.. / _ | / / / _/ / / / / / /
.. / / / / / / / / / /_ / /_/ /
.. /__/ /__/ /__/ /__/ \___/ \___ / core
.. /______/
.. The NIFTY project homepage is http://www.mpa-garching.mpg.de/ift/nifty/
NIFTY [#]_, "Numerical Information Field Theory", is a versatile
library designed to enable the development of signal inference algorithms
that operate regardless of the underlying spatial grid and its resolution.
Its object-oriented framework is written in Python, although it accesses
libraries written in Cython, C++, and C for efficiency.
NIFTY offers a toolkit that abstracts discretized representations of
continuous spaces, fields in these spaces, and operators acting on fields
into classes. Thereby, the correct normalization of operations on fields is
taken care of automatically without concerning the user. This allows for an
abstract formulation and programming of inference algorithms, including
those derived within information field theory. Thus, NIFTY permits its user
to rapidly prototype algorithms in 1D and then apply the developed code in
higher-dimensional settings of real world problems. The set of spaces on
which NIFTY operates comprises point sets, n-dimensional regular grids,
spherical spaces, their harmonic counterparts, and product spaces
constructed as combinations of those.
References
----------
.. [#] Selig et al., "NIFTY -- Numerical Information Field Theory --
a versatile Python library for signal inference",
`A&A, vol. 554, id. A26 <http://dx.doi.org/10.1051/0004-6361/201321236>`_,
2013; `arXiv:1301.4499 <http://www.arxiv.org/abs/1301.4499>`_
Class & Feature Overview
------------------------
The NIFTY library features three main classes: **spaces** that represent
certain grids, **fields** that are defined on spaces, and **operators**
that apply to fields.
.. Overview of all (core) classes:
..
.. - switch
.. - notification
.. - _about
.. - random
.. - space
.. - point_space
.. - rg_space
.. - lm_space
.. - gl_space
.. - hp_space
.. - nested_space
.. - field
.. - operator
.. - diagonal_operator
.. - power_operator
.. - projection_operator
.. - vecvec_operator
.. - response_operator
.. - probing
.. - trace_probing
.. - diagonal_probing
Overview of the main classes and functions:
.. automodule:: nifty
- :py:class:`space`
- :py:class:`point_space`
- :py:class:`rg_space`
- :py:class:`lm_space`
- :py:class:`gl_space`
- :py:class:`hp_space`
- :py:class:`nested_space`
- :py:class:`field`
- :py:class:`operator`
- :py:class:`diagonal_operator`
- :py:class:`power_operator`
- :py:class:`projection_operator`
- :py:class:`vecvec_operator`
- :py:class:`response_operator`
.. currentmodule:: nifty.nifty_tools
- :py:class:`invertible_operator`
- :py:class:`propagator_operator`
.. currentmodule:: nifty.nifty_explicit
- :py:class:`explicit_operator`
.. automodule:: nifty
- :py:class:`probing`
- :py:class:`trace_probing`
- :py:class:`diagonal_probing`
.. currentmodule:: nifty.nifty_explicit
- :py:class:`explicit_probing`
.. currentmodule:: nifty.nifty_tools
- :py:class:`conjugate_gradient`
- :py:class:`steepest_descent`
.. currentmodule:: nifty.nifty_explicit
- :py:func:`explicify`
.. currentmodule:: nifty.nifty_power
- :py:func:`weight_power`,
:py:func:`smooth_power`,
:py:func:`infer_power`,
:py:func:`interpolate_power`
"""
from __future__ import division
import abc
......
......@@ -216,7 +216,7 @@ class RGSpaceInterfaceTests(unittest.TestCase):
@expand([['distances', tuple],
['zerocenter', tuple]])
def test_property_ret_type(self, attribute, expected_type):
x = RGSpace()
x = RGSpace(1)
assert_(isinstance(getattr(x, attribute), expected_type))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment