wiener_filter_energy.py 2.29 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/>.
#
Martin Reinecke's avatar
Martin Reinecke committed
14
# Copyright(C) 2013-2018 Max-Planck-Society
15
16
17
18
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.

19
20
from __future__ import absolute_import, division, print_function
from ..compat import *
Martin Reinecke's avatar
Martin Reinecke committed
21
from ..minimization.quadratic_energy import QuadraticEnergy
Martin Reinecke's avatar
Martin Reinecke committed
22
from .wiener_filter_curvature import WienerFilterCurvature
23

24

25
26
def WienerFilterEnergy(position, d, R, N, S, iteration_controller=None,
                       iteration_controller_sampling=None):
27
28
    """The Energy for the Wiener filter.

29
    It covers the case of linear measurement with
Martin Reinecke's avatar
Martin Reinecke committed
30
    Gaussian noise and Gaussian signal prior with known covariance.
31
32
33

    Parameters
    ----------
Martin Reinecke's avatar
Martin Reinecke committed
34
    position : Field
Philipp Arras's avatar
Philipp Arras committed
35
        The current map in harmonic space.
Martin Reinecke's avatar
Martin Reinecke committed
36
    d : Field
Martin Reinecke's avatar
Martin Reinecke committed
37
        the data
Martin Reinecke's avatar
Martin Reinecke committed
38
    R : LinearOperator
Martin Reinecke's avatar
Martin Reinecke committed
39
40
        The response operator, description of the measurement process. It needs
        to map from harmonic signal space to data space.
Martin Reinecke's avatar
Martin Reinecke committed
41
    N : EndomorphicOperator
Martin Reinecke's avatar
Martin Reinecke committed
42
        The noise covariance in data space.
Martin Reinecke's avatar
Martin Reinecke committed
43
    S : EndomorphicOperator
Martin Reinecke's avatar
Martin Reinecke committed
44
        The prior signal covariance in harmonic space.
Martin Reinecke's avatar
Martin Reinecke committed
45
    inverter : Minimizer, optional
Martin Reinecke's avatar
Martin Reinecke committed
46
        the minimization strategy to use for operator inversion
Martin Reinecke's avatar
Martin Reinecke committed
47
        If None, the energy object will not support curvature computation.
48
49
50
51
    sampling_inverter : Minimizer, optional
        The minimizer to use during numerical sampling
        if None, it is not possible to draw inverse samples
        default: None
52
    """
53
54
    op = WienerFilterCurvature(R, N, S, iteration_controller,
                               iteration_controller_sampling)
Martin Reinecke's avatar
Martin Reinecke committed
55
56
    vec = R.adjoint_times(N.inverse_times(d))
    return QuadraticEnergy(position, op, vec)