There is a maintenance of MPCDF Gitlab on Thursday, April 22st 2020, 9:00 am CEST - Expect some service interruptions during this time

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
from __future__ import absolute_import, division, print_function
Philipp Arras's avatar
Philipp Arras committed
20

21
from ..compat import *
Martin Reinecke's avatar
Martin Reinecke committed
22
from ..minimization.quadratic_energy import QuadraticEnergy
Martin Reinecke's avatar
Martin Reinecke committed
23
from .wiener_filter_curvature import WienerFilterCurvature
24

25

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

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

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