Commit c326b049 authored by Theo Steininger's avatar Theo Steininger
Browse files

Style fixes and replaced `logarithmic`, `nbin` and `binbounds` properties in PowerSpace by `config`

parent 388334ea
Pipeline #12347 failed with stage
in 5 minutes
......@@ -25,18 +25,20 @@ from keepers import Loggable,\
class DomainObject(Versionable, Loggable, object):
"""The abstract class that can be used as a domain for a field.
This holds all the information and functionality a field needs to know about
its domain and how the data of the field are stored.
This holds all the information and functionality a field needs to know
about its domain and how the data of the field are stored.
Attributes
----------
dim : int
number of pixel-dimensions of the underlying data object.
Number of pixel-dimensions of the underlying data object.
shape : tuple
shape of the array that stores the degrees of freedom for any field with
this domain.
Shape of the array that stores the degrees of freedom for any field
on this domain.
"""
__metaclass__ = NiftyMeta
def __init__(self):
......
......@@ -38,7 +38,15 @@ class GLSpace(Space):
.. /______/
NIFTY subclass for Gauss-Legendre pixelizations [#]_ of the two-sphere.
Parameters
----------
nlat : int
Number of latitudinal bins (or rings) that are used for this
pixelization.
nlon : int, *optional*
Number of longditudinal bins that are used for this pixelization.
Attributes
----------
dim : np.int
......@@ -48,7 +56,7 @@ class GLSpace(Space):
nlat : int
Number of latitudinal bins (or rings) that are used for this
pixelization.
nlon : int, *optional*
nlon : int
Number of longditudinal bins that are used for this pixelization.
total_volume : np.float
The total volume of the space.
......
......@@ -32,7 +32,13 @@ class HPSpace(Space):
.. /__/
NIFTY subclass for HEALPix discretizations of the two-sphere [#]_.
Parameters
----------
nside : int
The corresponding HEALPix pixelization. The total number of pixels
is 12*nside**2.
Attributes
----------
dim : np.int
......@@ -40,7 +46,7 @@ class HPSpace(Space):
harmonic : bool
Specifies whether the space is a signal or harmonic space.
nside : int
The corresponding HEALPix pixelization. The total number of pixels
The corresponding HEALPix pixelization. The total number of pixels
is 12*nside**2.
total_volume : np.float
The total volume of the space.
......
......@@ -37,6 +37,12 @@ class LMSpace(Space):
NIFTY subclass for spherical harmonics components, for representations
of fields on the two-sphere.
Parameters
----------
lmax : int
The maximal :math:`l` value of any spherical harmonics
:math:`Y_{lm}` that is represented in this Space.
Attributes
----------
lmax : int
......
......@@ -26,21 +26,20 @@ from d2o.config import configuration as d2o_config
class PowerIndices(object):
"""Computes helpful quantities to deal with power spectra.
Given the shape and the density of a underlying rectangular grid this
Given the shape and the density of a underlying rectangular grid this
class provides the user
with the pindex, kindex, rho and pundex. The indices are binned
according to the supplied parameter scheme. If wanted, computed
results are stored for future reuse.
Attributes
Parameters
----------
shape : tuple, list, ndarray
Array-like object which specifies the shape of the underlying
rectangular grid
dgrid : tuple, list, ndarray
Array-like object which specifies the step-width of the
underlying grid
domain : NIFTy harmonic space
The space for which the power indices get computed
distribution_strategy : str
The distribution_strategy that will be used for the k_array and pindex
distributed_data_object.
logarithmic : bool *optional*
Flag specifying if the binning of the default indices is
performed on logarithmic scale.
......
......@@ -59,7 +59,7 @@ class PowerSpace(Space):
kindex : numpy.ndarray
Sorted array of all k-modes.
pundex : numpy.ndarray
Flat index of the first occurence of a k-vector with length==kindex[n]
Flat index of the first occurence of a k-vector with length==kindex[n]
in the k_array.
rho : numpy.ndarray
The amount of k-modes that get mapped to one power bin is given by
......@@ -105,10 +105,7 @@ class PowerSpace(Space):
nbin=nbin,
binbounds=binbounds)
config = power_index['config']
self._logarithmic = config['logarithmic']
self._nbin = config['nbin']
self._binbounds = config['binbounds']
self._config = power_index['config']
self._pindex = power_index['pindex']
self._kindex = power_index['kindex']
......@@ -207,22 +204,11 @@ class PowerSpace(Space):
return self._harmonic_partner
@property
def logarithmic(self):
""" Returns True if logarithmic binning is used.
def config(self):
""" Returns the configuration which was used for `logarithmic`, `nbin`
and `binbounds` during initialization.
"""
return self._logarithmic
@property
def nbin(self):
""" Returns the number of power bins if specfied during initialization.
"""
return self._nbin
@property
def binbounds(self):
""" Inner boundaries of the used bins if specfied during initialization.
"""
return self._binbounds
return self._config
@property
def pindex(self):
......
......@@ -48,6 +48,26 @@ class RGSpace(Space):
NIFTY subclass for spaces of regular Cartesian grids.
Parameters
----------
shape : {int, numpy.ndarray}
Number of grid points or numbers of gridpoints along each axis.
zerocenter : {bool, numpy.ndarray}, *optional*
Whether x==0 (or k==0, respectively) is located in the center of
the grid (or the center of each axis speparately) or not.
(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 grid in position or harmonic space.
(default: False).
Attributes
----------
harmonic : bool
......
......@@ -95,9 +95,7 @@ def get_weight_configs():
class PowerSpaceInterfaceTest(unittest.TestCase):
@expand([
['harmonic_partner', Space],
['logarithmic', bool],
['nbin', (int, NoneType)],
['binbounds', (list, NoneType)],
['config', dict]
['pindex', distributed_data_object],
['kindex', np.ndarray],
['rho', np.ndarray],
......
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