wiener_filter_curvature.py 2.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
14
# Copyright(C) 2013-2019 Max-Planck-Society
15
#
16
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
Philipp Arras's avatar
Philipp Arras committed
17

Martin Reinecke's avatar
Martin Reinecke committed
18
from ..operators.inversion_enabler import InversionEnabler
19
from ..operators.sampling_enabler import SamplingEnabler
Philipp Arras's avatar
Philipp Arras committed
20
from ..operators.sandwich_operator import SandwichOperator
21

Martin Reinecke's avatar
PEP8    
Martin Reinecke committed
22

23
24
def WienerFilterCurvature(R, N, S, iteration_controller=None,
                          iteration_controller_sampling=None):
Jakob Knollmueller's avatar
Jakob Knollmueller committed
25
26
27
28
    """The curvature of the WienerFilterEnergy.

    This operator implements the second derivative of the
    WienerFilterEnergy used in some minimization algorithms or
29
30
    for error estimates of the posterior maps. It is the
    inverse of the propagator operator.
Jakob Knollmueller's avatar
Jakob Knollmueller committed
31
32
33

    Parameters
    ----------
Martin Reinecke's avatar
Martin Reinecke committed
34
    R : LinearOperator
Martin Reinecke's avatar
Martin Reinecke committed
35
        The response operator of the Wiener filter measurement.
Martin Reinecke's avatar
Martin Reinecke committed
36
    N : EndomorphicOperator
Martin Reinecke's avatar
Martin Reinecke committed
37
        The noise covariance.
Martin Reinecke's avatar
Martin Reinecke committed
38
    S : DiagonalOperator
Martin Reinecke's avatar
Martin Reinecke committed
39
        The prior signal covariance
40
41
42
43
44
    iteration_controller : IterationController
        The iteration controller to use during numerical inversion via
        ConjugateGradient.
    iteration_controller_sampling : IterationController
        The iteration controller to use for sampling.
Jakob Knollmueller's avatar
Jakob Knollmueller committed
45
    """
46
    M = SandwichOperator.make(R, N.inverse)
47
    if iteration_controller_sampling is not None:
48
49
        op = SamplingEnabler(M, S.inverse, iteration_controller_sampling,
                             S.inverse)
50
51
    else:
        op = M + S.inverse
52
    return InversionEnabler(op, iteration_controller, S.inverse)