Commit 7972efb5 authored by Philipp Arras's avatar Philipp Arras

Docs

parent 5e5e9454
......@@ -24,7 +24,7 @@ from .structured_domain import StructuredDomain
class LogRGSpace(StructuredDomain):
"""Represents a logarithmic Cartesian grid.
'''Represents a logarithmic Cartesian grid.
Parameters
----------
......@@ -38,7 +38,7 @@ class LogRGSpace(StructuredDomain):
harmonic : bool, optional
Whether the space represents a grid in position or harmonic space.
Default: False.
"""
'''
_needed_for_hash = ['_shape', '_bindistances', '_t_0', '_harmonic']
def __init__(self, shape, bindistances, t_0, harmonic=False):
......@@ -76,6 +76,7 @@ class LogRGSpace(StructuredDomain):
@property
def t_0(self):
"""np.ndarray : array of coordinates of pixel ndim*(1,)."""
return np.array(self._t_0)
def __repr__(self):
......@@ -83,22 +84,32 @@ class LogRGSpace(StructuredDomain):
self.shape, self.harmonic))
def get_default_codomain(self):
"""Returns a :class:`LogRGSpace` object representing the (position or
harmonic) partner domain of `self`, depending on `self.harmonic`. The
`bindistances` are transformed and `t_0` stays the same.
Returns
-------
LogRGSpace
The parter domain
"""
codomain_bindistances = 1./(self.bindistances*self.shape)
return LogRGSpace(self.shape, codomain_bindistances, self._t_0, True)
def get_k_length_array(self):
"""Produces array of distances to origin of the space.
"""Generates array of distances to origin of the space.
Returns
-------
numpy.ndarray(numpy.float64) with shape self.shape
Distances to origin of the space.
If any index of the array is zero then the distance
is np.nan if self.harmonic True.
numpy.ndarray
Distances to origin of the space. If any index of the array is
zero then the distance is np.nan if self.harmonic True.
The dtype is float64, the shape is `self.shape`.
Raises
------
NotImplementedError: if self.harmonic is False
NotImplementedError
If `self.harmonic` is False.
"""
if not self.harmonic:
raise NotImplementedError
......@@ -106,14 +117,15 @@ class LogRGSpace(StructuredDomain):
return Field.from_global_data(self, np.linalg.norm(ks, axis=0))
def get_k_array(self):
"""Produces coordinates of the space.
"""Generates coordinates of the space.
Returns
-------
numpy.ndarray(numpy.float64) with shape (len(self.shape),) + self.shape
Coordinates of the space.
If one index of the array is zero the corresponding coordinate is
-np.inf (np.nan) if self.harmonic is False (True).
numpy.ndarray
Coordinates of the space. If one index of the array is zero the
corresponding coordinate is -np.inf (np.nan) if self.harmonic is
False (True).
The dtype is float64 and shape: `(len(self.shape),) + self.shape`.
"""
ndim = len(self.shape)
k_array = np.zeros((ndim,) + self.shape)
......
......@@ -50,7 +50,7 @@ class StructuredDomain(Domain):
@property
def total_volume(self):
"""float : Total domain volume
"""float : Total domain volume.
Returns the sum over all the domain's pixel volumes.
"""
......@@ -63,7 +63,7 @@ class StructuredDomain(Domain):
raise NotImplementedError
def get_k_length_array(self):
"""k vector lengths, if applicable,
"""k vector lengths, if applicable.
Returns the length of the k vector for every pixel.
This method is only implemented for harmonic domains.
......
......@@ -147,7 +147,7 @@ def dynamic_operator(domain,
Parameters
----------
domain : RGSpace
The position space in which the Green's function should be constructed.
The position space in which the Green's function shall be constructed.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
field is not padded at all.
......@@ -158,9 +158,9 @@ def dynamic_operator(domain,
key : String
key for dynamics encoding parameter.
causal : boolean
Whether or not the Green's function should be causal in time.
Whether or not the Green's function shall be causal in time.
minimum_phase: boolean
Whether or not the Green's function should be a minimum phase filter.
Whether or not the Green's function shall be a minimum phase filter.
Returns
-------
......@@ -203,8 +203,8 @@ def dynamic_lightcone_operator(domain,
Parameters
----------
domain : RGSpace
The position space in which the Green's function should be constructed.
Dim > 1 required.
The position space in which the Green's function shall be constructed.
It needs to have at least two dimensions.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
field is not padded at all.
......@@ -221,9 +221,9 @@ def dynamic_lightcone_operator(domain,
quant : float
Quantization of the light cone in pixels.
causal : boolean
Whether or not the Green's function should be causal in time.
Whether or not the Green's function shall be causal in time.
minimum_phase: boolean
Whether or not the Green's function should be a minimum phase filter.
Whether or not the Green's function shall be a minimum phase filter.
Returns
-------
......
......@@ -51,13 +51,13 @@ def CepstrumOperator(target, a, k0):
that the sqrt-cepstrum is essentially proportional to 1/k**2).
- A field which is symmetric around the pixel in the middle of the space.
This is result of the :class:`SymmetrizingOperator` and needed in order to
decouple the degrees of freedom at the beginning and the end of the
This is result of the :class:`SymmetrizingOperator` and needed in order
to decouple the degrees of freedom at the beginning and the end of the
amplitude whenever :class:`CepstrumOperator` is used as in
:class:`SLAmplitude`.
The prior on the zero mode, or zero subspaces in the case of dim > 1,
is the integral of the prior of all other modes along the corresponding
The prior on the zero mode (or zero subspaces for more than one dimensions)
is the integral of the prior over all other modes along the corresponding
axis.
Parameters
......@@ -79,9 +79,11 @@ def CepstrumOperator(target, a, k0):
raise ValueError
if len(target) > 1 or target[0].harmonic:
raise TypeError
if isinstance(k0, float):
k0 = (k0, )*len(target.shape)
elif len(k0) != len(target.shape):
if isinstance(k0, (float, int)):
k0 = np.array([k0]*len(target.shape))
else:
k0 = np.array(k0)
if len(k0) != len(target.shape):
raise ValueError
if np.any(np.array(k0) <= 0):
raise ValueError
......@@ -98,7 +100,7 @@ def CepstrumOperator(target, a, k0):
no_zero_modes = (slice(1, None),)*dim
ks = q_array[(slice(None),) + no_zero_modes]
cepstrum_field = np.zeros(shape)
cepstrum_field[no_zero_modes] = _ceps_kernel(dom, ks, a, k0)
cepstrum_field[no_zero_modes] = _ceps_kernel(ks, a, k0)
# Fill zero-mode subspaces
for i in range(dim):
fst_dims = (slice(None),)*i
......
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