Commit 0fd5d047 authored by Jakob Knollmueller's avatar Jakob Knollmueller

some docstrings added

parent c55e5b61
Pipeline #13412 passed with stage
in 5 minutes and 21 seconds
......@@ -128,9 +128,6 @@ if __name__ == "__main__":
# t0 = Field(p_space, val=log(1./(1+p_space.kindex)**2))
t0 = data_power- 1.
S0 = create_power_operator(h_space, power_spectrum=exp(t0),
distribution_strategy=distribution_strategy)
for i in range(500):
S0 = create_power_operator(h_space, power_spectrum=exp(t0),
......@@ -151,7 +148,7 @@ if __name__ == "__main__":
# Setting new power spectrum
t0.val = power_energy.position.val.real
# t0.val[-1] = t0.val[-2]
# Plotting current estimate
plot_parameters(m0,t0,log(sp),realized_power, data_power)
......
......@@ -10,8 +10,7 @@ class CriticalPowerEnergy(Energy):
It describes the energy of the logarithmic amplitudes of the power spectrum of
a Gaussian random field under reconstruction uncertainty with smoothness and
inverse gamma prior. It is used to infer a correlated signal with unknown correlation
structure.
inverse gamma prior. It is used to infer the correlation structure of a correlated signal.
Parameters
----------
......
......@@ -4,6 +4,20 @@ from nifty.operators import EndomorphicOperator,\
class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
"""The curvature of the CriticalPowerEnergy.
This operator implements the second derivative of the
CriticalPowerEnergy used in some minimization algorithms or
for error estimates of the powerspectrum.
Parameters
----------
theta: Field,
The map and inverse gamma prior contribution to the curvature.
T : SmoothnessOperator,
The smoothness prior contribution to the curvature.
"""
def __init__(self, theta, T, inverter=None, preconditioner=None):
self.theta = DiagonalOperator(theta.domain, diagonal=theta)
......
......@@ -21,6 +21,20 @@ from nifty import Field,\
class LaplaceOperator(EndomorphicOperator):
"""A irregular LaplaceOperator with free boundary and excluding monopole.
This LaplaceOperator implements the second derivative of a Field in PowerSpace
on logarithmic or linear scale with vanishing curvature at the boundary, starting
at the second entry of the Field. The second derivative of the Field on the irregular grid
is calculated using finite differences.
Parameters
----------
logarithmic : boolean,
Whether smoothness is calculated on a logarithmic scale or linear scale
default : True
"""
def __init__(self, domain,
default_spaces=None, logarithmic = True):
super(LaplaceOperator, self).__init__(default_spaces)
......@@ -38,13 +52,6 @@ class LaplaceOperator(EndomorphicOperator):
self.fwd_dist = self.positions[1:] - self.positions[:-1]
"""
input parameters:
domain- can only live over one domain
to do:
correct implementation of D20 object
"""
@property
def target(self):
return self._domain
......
......@@ -5,8 +5,26 @@ from laplace_operator import LaplaceOperator
class SmoothnessOperator(EndomorphicOperator):
"""An operator measuring the smoothness on an irregular grid with respect to some scale.
This operator applies the irregular LaplaceOperator and its adjoint to some Field over a
PowerSpace which corresponds to its smoothness and weights the result with a scale parameter sigma.
It is used in the smoothness prior terms of the CriticalPowerEnergy. For this purpose we
use free boundary conditions in the LaplaceOperator, having no curvature at both ends.
In addition the first entry is ignored as well, corresponding to the overall mean of the map.
The mean is therefore not considered in the smoothness prior.
Parameters
----------
sigma: float,
Specifies the strength of the SmoothnessOperator
logarithmic : boolean,
Whether smoothness is calculated on a logarithmic scale or linear scale
default : True
"""
def __init__(self, domain, sigma=1.,logarithmic = True,
def __init__(self, domain, sigma ,logarithmic = True,
default_spaces=None):
super(SmoothnessOperator, self).__init__(default_spaces)
......@@ -23,14 +41,7 @@ class SmoothnessOperator(EndomorphicOperator):
self._Laplace = LaplaceOperator(domain=self._domain[0], logarithmic=logarithmic)
"""
SmoothnessOperator
input parameters:
domain: Domain of the field, has to be a single PowerSpace
sigma: specifying the expected roughness, has to be a positive float
"""
@property
def sigma(self):
......
......@@ -3,6 +3,25 @@ from nifty.operators import EndomorphicOperator,\
class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator):
"""The curvature of the WienerFilterEnergy.
This operator implements the second derivative of the
WienerFilterEnergy used in some minimization algorithms or
for error estimates of the posterior maps. It corresponds to the
inverse propagator.
Parameters
----------
R: LinearOperator,
The response operator of the Wiener filter measurement.
N : EndomorphicOperator
The noise covariance.
S: DiagonalOperator,
The prior signal covariance
"""
def __init__(self, R, N, S, inverter=None, preconditioner=None):
self.R = R
......
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