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

cleanups

parent cb5ac9c6
Pipeline #19549 passed with stage
in 4 minutes and 6 seconds
...@@ -26,7 +26,6 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -26,7 +26,6 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
self.T = T self.T = T
if preconditioner is None: if preconditioner is None:
preconditioner = self.theta.inverse_times preconditioner = self.theta.inverse_times
self._domain = self.theta.domain
super(CriticalPowerCurvature, self).__init__( super(CriticalPowerCurvature, self).__init__(
inverter=inverter, inverter=inverter,
preconditioner=preconditioner, preconditioner=preconditioner,
...@@ -39,7 +38,7 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -39,7 +38,7 @@ class CriticalPowerCurvature(InvertibleOperatorMixin, EndomorphicOperator):
@property @property
def domain(self): def domain(self):
return self._domain return self.theta.domain
@property @property
def self_adjoint(self): def self_adjoint(self):
......
...@@ -17,12 +17,11 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin, ...@@ -17,12 +17,11 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin,
Parameters Parameters
---------- ----------
R: LinearOperator, R: LinearOperator,
The response operator of the Wiener filter measurement. The response operator of the Wiener filter measurement.
N : EndomorphicOperator N: EndomorphicOperator
The noise covariance. The noise covariance.
S: DiagonalOperator, S: DiagonalOperator,
The prior signal covariance The prior signal covariance
""" """
def __init__(self, R, N, S, d, position, inverter, fft4exp=None, **kwargs): def __init__(self, R, N, S, d, position, inverter, fft4exp=None, **kwargs):
...@@ -31,7 +30,6 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin, ...@@ -31,7 +30,6 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin,
self.S = S self.S = S
self.d = d self.d = d
self.position = position self.position = position
self._domain = self.S.domain
if fft4exp is None: if fft4exp is None:
self._fft = create_composed_fft_operator(self.domain, self._fft = create_composed_fft_operator(self.domain,
...@@ -45,7 +43,7 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin, ...@@ -45,7 +43,7 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin,
@property @property
def domain(self): def domain(self):
return self._domain return self.S.domain
@property @property
def self_adjoint(self): def self_adjoint(self):
...@@ -55,8 +53,6 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin, ...@@ -55,8 +53,6 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin,
def unitary(self): def unitary(self):
return False return False
# ---Added properties and methods---
def _times(self, x): def _times(self, x):
part1 = self.S.inverse_times(x) part1 = self.S.inverse_times(x)
# part2 = self._exppRNRexppd * x # part2 = self._exppRNRexppd * x
...@@ -72,15 +68,11 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin, ...@@ -72,15 +68,11 @@ class LogNormalWienerFilterCurvature(InvertibleOperatorMixin,
def _expp_sspace(self): def _expp_sspace(self):
return exp(self._fft(self.position)) return exp(self._fft(self.position))
@property
@memo
def _expp(self):
return self._fft.adjoint_times(self._expp_sspace)
@property @property
@memo @memo
def _Rexppd(self): def _Rexppd(self):
return self.R(self._expp) - self.d expp = self._fft.adjoint_times(self._expp_sspace)
return self.R(expp) - self.d
@property @property
@memo @memo
......
...@@ -13,15 +13,15 @@ class LogNormalWienerFilterEnergy(Energy): ...@@ -13,15 +13,15 @@ class LogNormalWienerFilterEnergy(Energy):
Parameters Parameters
---------- ----------
position: Field, position: Field,
The current position. The current position.
d : Field, d: Field,
the data. the data.
R : Operator, R: Operator,
The response operator, describtion of the measurement process. The response operator, describtion of the measurement process.
N : EndomorphicOperator, N: EndomorphicOperator,
The noise covariance in data space. The noise covariance in data space.
S : EndomorphicOperator, S: EndomorphicOperator,
The prior signal covariance in harmonic space. The prior signal covariance in harmonic space.
""" """
def __init__(self, position, d, R, N, S, inverter, fft4exp=None): def __init__(self, position, d, R, N, S, inverter, fft4exp=None):
...@@ -47,12 +47,12 @@ class LogNormalWienerFilterEnergy(Energy): ...@@ -47,12 +47,12 @@ class LogNormalWienerFilterEnergy(Energy):
@memo @memo
def value(self): def value(self):
return 0.5*(self.position.vdot(self._Sp) + return 0.5*(self.position.vdot(self._Sp) +
self._Rexppd.vdot(self._NRexppd)) self.curvature._Rexppd.vdot(self.curvature._NRexppd))
@property @property
@memo @memo
def gradient(self): def gradient(self):
return self._Sp + self._exppRNRexppd return self._Sp + self.curvature._exppRNRexppd
@property @property
@memo @memo
...@@ -62,22 +62,6 @@ class LogNormalWienerFilterEnergy(Energy): ...@@ -62,22 +62,6 @@ class LogNormalWienerFilterEnergy(Energy):
fft4exp=self._fft, fft4exp=self._fft,
inverter=self._inverter) inverter=self._inverter)
@property
def _expp(self):
return self.curvature._expp
@property
def _Rexppd(self):
return self.curvature._Rexppd
@property
def _NRexppd(self):
return self.curvature._NRexppd
@property
def _exppRNRexppd(self):
return self.curvature._exppRNRexppd
@property @property
@memo @memo
def _Sp(self): def _Sp(self):
......
...@@ -10,16 +10,14 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -10,16 +10,14 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator):
for error estimates of the posterior maps. It is the for error estimates of the posterior maps. It is the
inverse of the propagator operator. inverse of the propagator operator.
Parameters Parameters
---------- ----------
R: LinearOperator, R: LinearOperator,
The response operator of the Wiener filter measurement. The response operator of the Wiener filter measurement.
N : EndomorphicOperator N: EndomorphicOperator
The noise covariance. The noise covariance.
S: DiagonalOperator, S: DiagonalOperator,
The prior signal covariance The prior signal covariance
""" """
def __init__(self, R, N, S, inverter, preconditioner=None, **kwargs): def __init__(self, R, N, S, inverter, preconditioner=None, **kwargs):
...@@ -28,7 +26,6 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -28,7 +26,6 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator):
self.S = S self.S = S
if preconditioner is None: if preconditioner is None:
preconditioner = self.S.times preconditioner = self.S.times
self._domain = self.S.domain
super(WienerFilterCurvature, self).__init__( super(WienerFilterCurvature, self).__init__(
inverter=inverter, inverter=inverter,
preconditioner=preconditioner, preconditioner=preconditioner,
...@@ -36,7 +33,7 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -36,7 +33,7 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator):
@property @property
def domain(self): def domain(self):
return self._domain return self.S.domain
@property @property
def self_adjoint(self): def self_adjoint(self):
...@@ -46,8 +43,6 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator): ...@@ -46,8 +43,6 @@ class WienerFilterCurvature(InvertibleOperatorMixin, EndomorphicOperator):
def unitary(self): def unitary(self):
return False return False
# ---Added properties and methods---
def _times(self, x): def _times(self, x):
res = self.R.adjoint_times(self.N.inverse_times(self.R(x))) res = self.R.adjoint_times(self.N.inverse_times(self.R(x)))
res += self.S.inverse_times(x) res += self.S.inverse_times(x)
......
...@@ -13,14 +13,14 @@ class WienerFilterEnergy(Energy): ...@@ -13,14 +13,14 @@ class WienerFilterEnergy(Energy):
---------- ----------
position: Field, position: Field,
The current position. The current position.
d : Field, d: Field,
the data. the data
R : Operator, R: LinearOperator,
The response operator, description of the measurement process. The response operator, description of the measurement process.
N : EndomorphicOperator, N: EndomorphicOperator,
The noise covariance in data space. The noise covariance in data space.
S : EndomorphicOperator, S: EndomorphicOperator,
The prior signal covariance in harmonic space. The prior signal covariance in harmonic space.
""" """
def __init__(self, position, d, R, N, S, inverter, _j=None): def __init__(self, position, d, R, N, S, inverter, _j=None):
......
...@@ -31,7 +31,6 @@ class Prober(object): ...@@ -31,7 +31,6 @@ class Prober(object):
https://www.python.org/download/releases/2.2.3/descrintro/#cooperation https://www.python.org/download/releases/2.2.3/descrintro/#cooperation
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ https://rhettinger.wordpress.com/2011/05/26/super-considered-super/
""" """
def __init__(self, domain=None, probe_count=8, def __init__(self, domain=None, probe_count=8,
......
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