wiener_filter_energy.py 2.21 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.

Martin Reinecke's avatar
Martin Reinecke committed
19
from ..minimization.quadratic_energy import QuadraticEnergy
Martin Reinecke's avatar
Martin Reinecke committed
20
from .wiener_filter_curvature import WienerFilterCurvature
21

22

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

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

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