wiener_filter_energy.py 1.5 KB
Newer Older
1
2
3
from ...energies.energy import Energy
from ...energies.memoization import memo
from . import WienerFilterCurvature
4

5

6
7
8
class WienerFilterEnergy(Energy):
    """The Energy for the Wiener filter.

9
    It covers the case of linear measurement with
Martin Reinecke's avatar
Martin Reinecke committed
10
    Gaussian noise and Gaussian signal prior with known covariance.
11
12
13

    Parameters
    ----------
Jakob Knollmueller's avatar
Jakob Knollmueller committed
14
15
    position: Field,
        The current position.
16
17
18
19
20
21
22
23
24
25
    d : Field,
        the data.
    R : Operator,
        The response operator, describtion of the measurement process.
    N : EndomorphicOperator,
        The noise covariance in data space.
    S : EndomorphicOperator,
        The prior signal covariance in harmonic space.
    """

26
    def __init__(self, position, d, R, N, S):
27
        super(WienerFilterEnergy, self).__init__(position=position)
28
29
30
31
        self.d = d
        self.R = R
        self.N = N
        self.S = S
32

33
    def at(self, position):
34
        return self.__class__(position=position, d=self.d, R=self.R, N=self.N,
35
                              S=self.S)
36
37

    @property
38
    @memo
39
    def value(self):
40
        return 0.5*self.position.vdot(self._Dx) - self._j.vdot(self.position)
41
42

    @property
43
    @memo
44
    def gradient(self):
45
        return self._Dx - self._j
46
47

    @property
48
    @memo
49
    def curvature(self):
50
51
        return WienerFilterCurvature(R=self.R, N=self.N, S=self.S)

52
    @property
53
    @memo
54
55
    def _Dx(self):
        return self.curvature(self.position)
56

57
58
59
60
    @property
    @memo
    def _j(self):
        return self.R.adjoint_times(self.N.inverse_times(self.d))