# 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 .
#
# Copyright(C) 2013-2018 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from ..minimization.quadratic_energy import QuadraticEnergy
from .wiener_filter_curvature import WienerFilterCurvature
def WienerFilterEnergy(position, d, R, N, S, iteration_controller=None,
iteration_controller_sampling=None):
"""The Energy for the Wiener filter.
It covers the case of linear measurement with
Gaussian noise and Gaussian signal prior with known covariance.
Parameters
----------
position : Field
The current map in harmonic space.
d : Field
the data
R : LinearOperator
The response operator, description of the measurement process. It needs
to map from harmonic signal space to data space.
N : EndomorphicOperator
The noise covariance in data space.
S : EndomorphicOperator
The prior signal covariance in harmonic space.
inverter : Minimizer, optional
the minimization strategy to use for operator inversion
If None, the energy object will not support curvature computation.
sampling_inverter : Minimizer, optional
The minimizer to use during numerical sampling
if None, it is not possible to draw inverse samples
default: None
"""
op = WienerFilterCurvature(R, N, S, iteration_controller,
iteration_controller_sampling)
vec = R.adjoint_times(N.inverse_times(d))
return QuadraticEnergy(position, op, vec)