Commit 25e4896c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

more documentation

parent a125d264
Pipeline #25034 passed with stages
in 6 minutes and 40 seconds
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
...@@ -21,6 +21,7 @@ from .structured_domain import StructuredDomain ...@@ -21,6 +21,7 @@ from .structured_domain import StructuredDomain
class DOFSpace(StructuredDomain): class DOFSpace(StructuredDomain):
"""Generic degree-of-freedom space."""
def __init__(self, dof_weights): def __init__(self, dof_weights):
super(DOFSpace, self).__init__() super(DOFSpace, self).__init__()
self._dvol = tuple(dof_weights) self._dvol = tuple(dof_weights)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
...@@ -24,7 +24,8 @@ from .structured_domain import StructuredDomain ...@@ -24,7 +24,8 @@ from .structured_domain import StructuredDomain
class GLSpace(StructuredDomain): class GLSpace(StructuredDomain):
"""NIFTy subclass for Gauss-Legendre pixelizations of the two-sphere. """NIFTy subclass for Gauss-Legendre pixelizations of the two-sphere.
Its harmonic partner is the :class:`LMSpace` Its harmonic partner domain is the
:class:`~nifty4.domains.lm_space.LMSpace`.
Parameters Parameters
---------- ----------
...@@ -34,11 +35,6 @@ class GLSpace(StructuredDomain): ...@@ -34,11 +35,6 @@ class GLSpace(StructuredDomain):
nlon : int, optional nlon : int, optional
Number of longitudinal bins that are used for this pixelization. Number of longitudinal bins that are used for this pixelization.
Default value is 2*nlat + 1. Default value is 2*nlat + 1.
Raises
------
ValueError
If input `nlat` or `nlon` is invalid.
""" """
def __init__(self, nlat, nlon=None): def __init__(self, nlat, nlon=None):
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
...@@ -22,31 +22,16 @@ from .structured_domain import StructuredDomain ...@@ -22,31 +22,16 @@ from .structured_domain import StructuredDomain
class HPSpace(StructuredDomain): class HPSpace(StructuredDomain):
"""NIFTy subclass for HEALPix discretizations of the two-sphere [#]_. """NIFTy subclass for HEALPix discretizations of the two-sphere.
Its harmonic partner domain is the
:class:`~nifty4.domains.lm_space.LMSpace`.
Parameters Parameters
---------- ----------
nside : int nside : int
The corresponding HEALPix Nside parameter. Must be a positive integer The corresponding HEALPix Nside parameter. Must be a positive integer
and typically is a power of 2. and typically is a power of 2.
Raises
------
ValueError
If given `nside` < 1.
See Also
--------
GLSpace, LMSpace
References
----------
.. [#] K.M. Gorski et al., 2005, "HEALPix: A Framework for
High-Resolution Discretization and Fast Analysis of Data
Distributed on the Sphere", *ApJ* 622..759G.
.. [#] M. Reinecke and D. Sverre Seljebotn, 2013, "Libsharp - spherical
harmonic transforms revisited";
`arXiv:1303.4945 <http://www.arxiv.org/abs/1303.4945>`_
""" """
def __init__(self, nside): def __init__(self, nside):
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
......
...@@ -49,7 +49,8 @@ class PowerSpace(StructuredDomain): ...@@ -49,7 +49,8 @@ class PowerSpace(StructuredDomain):
@staticmethod @staticmethod
def linear_binbounds(nbin, first_bound, last_bound): def linear_binbounds(nbin, first_bound, last_bound):
""" """Produces linearly spaced bin bounds.
This will produce a binbounds array with nbin-1 entries with This will produce a binbounds array with nbin-1 entries with
binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining
values equidistantly spaced (in linear scale) between these two. values equidistantly spaced (in linear scale) between these two.
...@@ -68,7 +69,8 @@ class PowerSpace(StructuredDomain): ...@@ -68,7 +69,8 @@ class PowerSpace(StructuredDomain):
@staticmethod @staticmethod
def logarithmic_binbounds(nbin, first_bound, last_bound): def logarithmic_binbounds(nbin, first_bound, last_bound):
""" """Produces logarithmically spaced bin bounds.
This will produce a binbounds array with nbin-1 entries with This will produce a binbounds array with nbin-1 entries with
binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining
values equidistantly spaced (in natural logarithmic scale) values equidistantly spaced (in natural logarithmic scale)
...@@ -90,6 +92,22 @@ class PowerSpace(StructuredDomain): ...@@ -90,6 +92,22 @@ class PowerSpace(StructuredDomain):
@staticmethod @staticmethod
def useful_binbounds(space, logarithmic, nbin=None): def useful_binbounds(space, logarithmic, nbin=None):
"""Produces bin bounds suitable for a given domain.
This will produce a binbounds array with `nbin-1` entries, if `nbin` is
supplied, or the maximum number of entries that does not produce empty
bins, if `nbin` is not supplied.
The first and last bin boundary are inferred from `space`.
space : StructuredDomain
the domain for which the binbounds will be computed.
logarithmic : bool
If True bins will have equal size in linear space; otherwise they
will have equali size in logarithmic space.
nbin : int, optional
the number of bins
If None, the highest possible number of bins will be used
"""
if not (isinstance(space, StructuredDomain) and space.harmonic): if not (isinstance(space, StructuredDomain) and space.harmonic):
raise ValueError("first argument must be a harmonic space.") raise ValueError("first argument must be a harmonic space.")
if logarithmic is None and nbin is None: if logarithmic is None and nbin is None:
...@@ -197,7 +215,8 @@ class PowerSpace(StructuredDomain): ...@@ -197,7 +215,8 @@ class PowerSpace(StructuredDomain):
@property @property
def binbounds(self): def binbounds(self):
"""Returns the boundaries between the power spectrum bins as a tuple. """Returns the boundaries between the power spectrum bins as a tuple.
None is used to indicate natural binning.
`None` is used to indicate natural binning.
""" """
return self._binbounds return self._binbounds
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2013-2017 Max-Planck-Society # Copyright(C) 2013-2018 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes. # and financially supported by the Studienstiftung des deutschen Volkes.
......
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