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

more doc work

parent 9ea84e2e
Pipeline #24941 passed with stages
in 6 minutes and 39 seconds
...@@ -24,14 +24,14 @@ from .. import dobj ...@@ -24,14 +24,14 @@ from .. import dobj
class PowerSpace(StructuredDomain): class PowerSpace(StructuredDomain):
"""NIFTy class for spaces of power spectra. """NIFTy class for spaces of power spectra.
A power space is the result of a projection of a harmonic space where A power space is the result of a projection of a harmonic domain where
k-modes of equal length get mapped to one power index. k-modes of equal length get mapped to one power index.
Parameters Parameters
---------- ----------
harmonic_partner : Space harmonic_partner : StructuredDomain
The harmonic Space of which this is the power space. The harmonic dmain of which this is the power space.
binbounds: None, or tuple/array/list of float binbounds : None, or tuple of float
if None: if None:
There will be as many bins as there are distinct k-vector lengths There will be as many bins as there are distinct k-vector lengths
in the harmonic partner space. in the harmonic partner space.
...@@ -54,9 +54,9 @@ class PowerSpace(StructuredDomain): ...@@ -54,9 +54,9 @@ class PowerSpace(StructuredDomain):
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.
nbin: integer nbin : int
the number of bins the number of bins
first_bound, last_bound: float first_bound, last_bound : float
the k values for the right boundary of the first bin and the left the k values for the right boundary of the first bin and the left
boundary of the last bin, respectively. They are given in length boundary of the last bin, respectively. They are given in length
units of the harmonic partner space. units of the harmonic partner space.
...@@ -74,9 +74,9 @@ class PowerSpace(StructuredDomain): ...@@ -74,9 +74,9 @@ class PowerSpace(StructuredDomain):
values equidistantly spaced (in natural logarithmic scale) values equidistantly spaced (in natural logarithmic scale)
between these two. between these two.
nbin: integer nbin : int
the number of bins the number of bins
first_bound, last_bound: float first_bound, last_bound : float
the k values for the right boundary of the first bin and the left the k values for the right boundary of the first bin and the left
boundary of the last bin, respectively. They are given in length boundary of the last bin, respectively. They are given in length
units of the harmonic partner space. units of the harmonic partner space.
......
...@@ -34,33 +34,34 @@ class CriticalPowerEnergy(Energy): ...@@ -34,33 +34,34 @@ class CriticalPowerEnergy(Energy):
Parameters Parameters
---------- ----------
position : Field, position : Field
The current position of this energy. (Logarithm of power spectrum) The current position of this energy. (Logarithm of power spectrum)
m : Field, m : Field
The map whose power spectrum is inferred. Needs to live in harmonic The map whose power spectrum is inferred. Needs to live in harmonic
signal space. signal space.
D : EndomorphicOperator, D : EndomorphicOperator, optional
The curvature of the Gaussian encoding the posterior covariance. The curvature of the Gaussian encoding the posterior covariance.
If not specified, the map is assumed to be no reconstruction. If not specified, the map is assumed to be no reconstruction.
default : None default : None
alpha : float alpha : float, optional
The spectral prior of the inverse gamma distribution. 1.0 corresponds The spectral prior of the inverse gamma distribution. 1.0 corresponds
to non-informative. to non-informative.
default : 1.0 default : 1.0
q : float q : float, optional
The cutoff parameter of the inverse gamma distribution. 0.0 corresponds The cutoff parameter of the inverse gamma distribution. 0.0 corresponds
to non-informative. to non-informative.
default : 0.0 default : 0.0
smoothness_prior : float smoothness_prior : float, optional
Controls the strength of the smoothness prior Controls the strength of the smoothness prior
default : 0.0 default : 0.0
logarithmic : boolean logarithmic : bool, optional
Whether smoothness acts on linear or logarithmic scale. Whether smoothness acts on linear or logarithmic scale.
samples : integer default : True
samples : int, optional
Number of samples used for the estimation of the uncertainty Number of samples used for the estimation of the uncertainty
corrections. corrections.
default : 3 default : 3
w : Field w : Field, optional
The contribution from the map with or without uncertainty. It is used The contribution from the map with or without uncertainty. It is used
to pass on the result of the costly sampling during the minimization. to pass on the result of the costly sampling during the minimization.
default : None default : None
......
...@@ -34,18 +34,18 @@ class NonlinearPowerEnergy(Energy): ...@@ -34,18 +34,18 @@ class NonlinearPowerEnergy(Energy):
Parameters Parameters
---------- ----------
position : Field, position : Field
The current position of this energy. The current position of this energy.
m : Field, m : Field
The map whichs power spectrum has to be inferred The map whichs power spectrum has to be inferred
D : EndomorphicOperator, D : EndomorphicOperator
The curvature of the Gaussian encoding the posterior covariance. The curvature of the Gaussian encoding the posterior covariance.
If not specified, the map is assumed to be no reconstruction. If not specified, the map is assumed to be no reconstruction.
default : None default : None
sigma : float sigma : float
The parameter of the smoothness prior. The parameter of the smoothness prior.
default : ??? None? ??????? default : ??? None? ???????
samples : integer samples : int
Number of samples used for the estimation of the uncertainty Number of samples used for the estimation of the uncertainty
corrections. corrections.
default : 3 default : 3
......
...@@ -56,9 +56,9 @@ class ConjugateGradient(Minimizer): ...@@ -56,9 +56,9 @@ class ConjugateGradient(Minimizer):
Returns Returns
------- -------
energy : QuadraticEnergy QuadraticEnergy
state at last point of the iteration state at last point of the iteration
status : integer int
Can be controller.CONVERGED or controller.ERROR Can be controller.CONVERGED or controller.ERROR
""" """
controller = self._controller controller = self._controller
......
...@@ -50,15 +50,15 @@ class DescentMinimizer(Minimizer): ...@@ -50,15 +50,15 @@ class DescentMinimizer(Minimizer):
Parameters Parameters
---------- ----------
energy : Energy object nergy : Energy
Energy object which provides value, gradient and curvature at a Energy object which provides value, gradient and curvature at a
specific position in parameter space. specific position in parameter space.
Returns Returns
------- -------
energy : Energy object Energy
Latest `energy` of the minimization. Latest `energy` of the minimization.
status : integer int
Can be controller.CONVERGED or controller.ERROR Can be controller.CONVERGED or controller.ERROR
Notes Notes
......
...@@ -41,13 +41,13 @@ class LineSearchStrongWolfe(LineSearch): ...@@ -41,13 +41,13 @@ class LineSearchStrongWolfe(LineSearch):
Parameter for curvature condition rule. (Default: 0.9) Parameter for curvature condition rule. (Default: 0.9)
max_step_size : float max_step_size : float
Maximum step allowed in to be made in the descent direction. Maximum step allowed in to be made in the descent direction.
(Default: 50) (Default: 1000000000)
max_iterations : integer max_iterations : int, optional
Maximum number of iterations performed by the line search algorithm. Maximum number of iterations performed by the line search algorithm.
(Default: 10) (Default: 100)
max_zoom_iterations : integer max_zoom_iterations : int, optional
Maximum number of iterations performed by the zoom algorithm. Maximum number of iterations performed by the zoom algorithm.
(Default: 10) (Default: 100)
""" """
def __init__(self, c1=1e-4, c2=0.9, def __init__(self, c1=1e-4, c2=0.9,
...@@ -71,18 +71,18 @@ class LineSearchStrongWolfe(LineSearch): ...@@ -71,18 +71,18 @@ class LineSearchStrongWolfe(LineSearch):
Parameters Parameters
---------- ----------
energy : Energy object energy : Energy
Energy object from which we will calculate the energy and the Energy object from which we will calculate the energy and the
gradient at a specific point. gradient at a specific point.
pk : Field pk : Field
Vector pointing into the search direction. Vector pointing into the search direction.
f_k_minus_1 : float f_k_minus_1 : float, optional
Value of the fuction (which is being minimized) at the k-1 Value of the fuction (which is being minimized) at the k-1
iteration of the line search procedure. (Default: None) iteration of the line search procedure. (Default: None)
Returns Returns
------- -------
energy_star : Energy object Energy
The new Energy object on the new position. The new Energy object on the new position.
""" """
le_0 = LineEnergy(0., energy, pk, 0.) le_0 = LineEnergy(0., energy, pk, 0.)
...@@ -188,7 +188,7 @@ class LineSearchStrongWolfe(LineSearch): ...@@ -188,7 +188,7 @@ class LineSearchStrongWolfe(LineSearch):
Returns Returns
------- -------
energy_star : Energy object Energy
The new Energy object on the new position. The new Energy object on the new position.
""" """
cubic_delta = 0.2 # cubic interpolant checks cubic_delta = 0.2 # cubic interpolant checks
......
...@@ -39,8 +39,9 @@ class Minimizer(with_metaclass(NiftyMeta, type('NewBase', (object,), {}))): ...@@ -39,8 +39,9 @@ class Minimizer(with_metaclass(NiftyMeta, type('NewBase', (object,), {}))):
Returns Returns
------- -------
energy : Energy object Energy
Latest `energy` of the minimization. Latest `energy` of the minimization.
status : integer int
exit status of the minimization
""" """
raise NotImplementedError raise NotImplementedError
...@@ -51,9 +51,9 @@ class NonlinearCG(Minimizer): ...@@ -51,9 +51,9 @@ class NonlinearCG(Minimizer):
Returns Returns
------- -------
energy : Energy
state at last point of the iteration state at last point of the iteration
status : integer int
Can be controller.CONVERGED or controller.ERROR Can be controller.CONVERGED or controller.ERROR
""" """
controller = self._controller controller = self._controller
......
...@@ -87,7 +87,7 @@ class InformationStore(object): ...@@ -87,7 +87,7 @@ class InformationStore(object):
Parameters Parameters
---------- ----------
max_history_length : integer max_history_length : int
Maximum number of stored past updates. Maximum number of stored past updates.
x0 : Field x0 : Field
Initial position in variable space. Initial position in variable space.
...@@ -96,7 +96,7 @@ class InformationStore(object): ...@@ -96,7 +96,7 @@ class InformationStore(object):
Attributes Attributes
---------- ----------
max_history_length : integer max_history_length : int
Maximum number of stored past updates. Maximum number of stored past updates.
s : List s : List
Circular buffer of past position differences, which are Fields. Circular buffer of past position differences, which are Fields.
...@@ -106,7 +106,7 @@ class InformationStore(object): ...@@ -106,7 +106,7 @@ class InformationStore(object):
Latest position in variable space. Latest position in variable space.
last_gradient : Field last_gradient : Field
Gradient at latest position. Gradient at latest position.
k : integer k : int
Number of updates that have taken place Number of updates that have taken place
ss : numpy.ndarray ss : numpy.ndarray
2D circular buffer of scalar products between different elements of s. 2D circular buffer of scalar products between different elements of s.
...@@ -139,7 +139,7 @@ class InformationStore(object): ...@@ -139,7 +139,7 @@ class InformationStore(object):
Returns Returns
------- -------
result : List List
List of new basis vectors. List of new basis vectors.
""" """
result = [] result = []
...@@ -165,7 +165,7 @@ class InformationStore(object): ...@@ -165,7 +165,7 @@ class InformationStore(object):
Returns Returns
------- -------
result : numpy.ndarray numpy.ndarray
Scalar matrix. Scalar matrix.
""" """
m = self.history_length m = self.history_length
...@@ -207,7 +207,7 @@ class InformationStore(object): ...@@ -207,7 +207,7 @@ class InformationStore(object):
Returns Returns
------- -------
delta : List List
List of the new scalar coefficients (deltas). List of the new scalar coefficients (deltas).
""" """
m = self.history_length m = self.history_length
......
...@@ -35,7 +35,7 @@ class LaplaceOperator(EndomorphicOperator): ...@@ -35,7 +35,7 @@ class LaplaceOperator(EndomorphicOperator):
Parameters Parameters
---------- ----------
logarithmic : boolean, logarithmic : bool, optional
Whether smoothness is calculated on a logarithmic scale or linear scale Whether smoothness is calculated on a logarithmic scale or linear scale
default : True default : True
space : int space : int
......
...@@ -57,7 +57,7 @@ class LinearOperator(with_metaclass( ...@@ -57,7 +57,7 @@ class LinearOperator(with_metaclass(
@abc.abstractproperty @abc.abstractproperty
def domain(self): def domain(self):
""" """
domain : DomainTuple DomainTuple
The domain on which the Operator's input Field lives. The domain on which the Operator's input Field lives.
Every Operator which inherits from the abstract LinearOperator Every Operator which inherits from the abstract LinearOperator
base class must have this attribute. base class must have this attribute.
...@@ -67,7 +67,7 @@ class LinearOperator(with_metaclass( ...@@ -67,7 +67,7 @@ class LinearOperator(with_metaclass(
@abc.abstractproperty @abc.abstractproperty
def target(self): def target(self):
""" """
target : DomainTuple DomainTuple
The domain on which the Operator's output Field lives. The domain on which the Operator's output Field lives.
Every Operator which inherits from the abstract LinearOperator Every Operator which inherits from the abstract LinearOperator
base class must have this attribute. base class must have this attribute.
...@@ -77,7 +77,7 @@ class LinearOperator(with_metaclass( ...@@ -77,7 +77,7 @@ class LinearOperator(with_metaclass(
@property @property
def inverse(self): def inverse(self):
""" """
inverse : LinearOperator LinearOperator
Returns a LinearOperator object which behaves as if it were Returns a LinearOperator object which behaves as if it were
the inverse of this operator. the inverse of this operator.
""" """
...@@ -87,7 +87,7 @@ class LinearOperator(with_metaclass( ...@@ -87,7 +87,7 @@ class LinearOperator(with_metaclass(
@property @property
def adjoint(self): def adjoint(self):
""" """
adjoint : LinearOperator LinearOperator
Returns a LinearOperator object which behaves as if it were Returns a LinearOperator object which behaves as if it were
the adjoint of this operator. the adjoint of this operator.
""" """
...@@ -141,7 +141,7 @@ class LinearOperator(with_metaclass( ...@@ -141,7 +141,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : integer int
This is any subset of LinearOperator.{TIMES, ADJOINT_TIMES, This is any subset of LinearOperator.{TIMES, ADJOINT_TIMES,
INVERSE_TIMES, ADJOINT_INVERSE_TIMES, INVERSE_ADJOINT_TIMES}, INVERSE_TIMES, ADJOINT_INVERSE_TIMES, INVERSE_ADJOINT_TIMES},
joined together by the "|" operator. joined together by the "|" operator.
...@@ -158,7 +158,7 @@ class LinearOperator(with_metaclass( ...@@ -158,7 +158,7 @@ class LinearOperator(with_metaclass(
The input Field, living on the Operator's domain or target, The input Field, living on the Operator's domain or target,
depending on mode. depending on mode.
mode : integer mode : int
LinearOperator.TIMES: normal application LinearOperator.TIMES: normal application
LinearOperator.ADJOINT_TIMES: adjoint application LinearOperator.ADJOINT_TIMES: adjoint application
LinearOperator.INVERSE_TIMES: inverse application LinearOperator.INVERSE_TIMES: inverse application
...@@ -168,7 +168,7 @@ class LinearOperator(with_metaclass( ...@@ -168,7 +168,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : Field Field
The processed Field living on the Operator's target or domain, The processed Field living on the Operator's target or domain,
depending on mode. depending on mode.
""" """
...@@ -188,7 +188,7 @@ class LinearOperator(with_metaclass( ...@@ -188,7 +188,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : Field Field
The processed Field living on the Operator's target domain. The processed Field living on the Operator's target domain.
""" """
return self.apply(x, self.TIMES) return self.apply(x, self.TIMES)
...@@ -203,7 +203,7 @@ class LinearOperator(with_metaclass( ...@@ -203,7 +203,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : Field Field
The processed Field living on the Operator's domain. The processed Field living on the Operator's domain.
""" """
return self.apply(x, self.INVERSE_TIMES) return self.apply(x, self.INVERSE_TIMES)
...@@ -218,7 +218,7 @@ class LinearOperator(with_metaclass( ...@@ -218,7 +218,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : Field Field
The processed Field living on the Operator's domain. The processed Field living on the Operator's domain.
""" """
return self.apply(x, self.ADJOINT_TIMES) return self.apply(x, self.ADJOINT_TIMES)
...@@ -233,7 +233,7 @@ class LinearOperator(with_metaclass( ...@@ -233,7 +233,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
out : Field Field
The processed Field living on the Operator's target domain. The processed Field living on the Operator's target domain.
Notes Notes
...@@ -267,7 +267,7 @@ class LinearOperator(with_metaclass( ...@@ -267,7 +267,7 @@ class LinearOperator(with_metaclass(
Returns Returns
------- -------
sample : Field Field
Returns the a sample from the Gaussian of given covariance. A sample from the Gaussian of given covariance.
""" """
raise NotImplementedError raise NotImplementedError
...@@ -36,9 +36,9 @@ def SmoothnessOperator(domain, strength=1., logarithmic=True, space=None): ...@@ -36,9 +36,9 @@ def SmoothnessOperator(domain, strength=1., logarithmic=True, space=None):
Parameters Parameters
---------- ----------
strength: nonnegative float strength : nonnegative float
Specifies the strength of the SmoothnessOperator Specifies the strength of the SmoothnessOperator
logarithmic : boolean logarithmic : bool, optional
Whether smoothness is calculated on a logarithmic scale or linear scale Whether smoothness is calculated on a logarithmic scale or linear scale
default : True default : True
""" """
......
Supports Markdown
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