Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
41d128bb
Commit
41d128bb
authored
Jun 27, 2018
by
Reimar H Leike
Browse files
deleted old PoissonEnergy
parent
fdf2bec6
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty5/library/__init__.py
View file @
41d128bb
from
.los_response
import
LOSResponse
from
.los_response
import
LOSResponse
from
.nonlinear_wiener_filter_energy
import
NonlinearWienerFilterEnergy
from
.nonlinear_wiener_filter_energy
import
NonlinearWienerFilterEnergy
from
.nonlinearities
import
Exponential
,
Linear
,
PositiveTanh
,
Tanh
from
.nonlinearities
import
Exponential
,
Linear
,
PositiveTanh
,
Tanh
from
.poisson_energy
import
PoissonEnergy
from
.unit_log_gauss
import
UnitLogGauss
from
.unit_log_gauss
import
UnitLogGauss
from
.poisson_log_likelihood
import
PoissonLogLikelihood
from
.poisson_log_likelihood
import
PoissonLogLikelihood
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.wiener_filter_curvature
import
WienerFilterCurvature
...
...
nifty5/library/poisson_energy.py
deleted
100644 → 0
View file @
fdf2bec6
# 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/>.
#
# 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.energy
import
Energy
from
..operators.diagonal_operator
import
DiagonalOperator
from
..operators.sandwich_operator
import
SandwichOperator
from
..operators.inversion_enabler
import
InversionEnabler
from
..sugar
import
log
class
PoissonEnergy
(
Energy
):
def
__init__
(
self
,
position
,
d
,
Instrument
,
nonlinearity
,
ht
,
Phi_h
,
iteration_controller
=
None
):
super
(
PoissonEnergy
,
self
).
__init__
(
position
=
position
)
self
.
_ic
=
iteration_controller
self
.
_d
=
d
self
.
_Instrument
=
Instrument
self
.
_nonlinearity
=
nonlinearity
self
.
_ht
=
ht
self
.
_Phi_h
=
Phi_h
htpos
=
ht
(
position
)
lam
=
Instrument
(
nonlinearity
(
htpos
))
Rho
=
DiagonalOperator
(
nonlinearity
.
derivative
(
htpos
))
eps
=
1e-100
# to catch harmless 0/0 where data is zero
W
=
DiagonalOperator
((
d
+
eps
)
/
(
lam
**
2
+
eps
))
phipos
=
Phi_h
.
inverse_adjoint_times
(
position
)
prior_energy
=
0.5
*
position
.
vdot
(
phipos
)
likel_energy
=
lam
.
sum
()
-
d
.
vdot
(
log
(
lam
+
eps
))
self
.
_value
=
prior_energy
+
likel_energy
R1
=
Instrument
*
Rho
*
ht
self
.
_grad
=
(
phipos
+
R1
.
adjoint_times
((
lam
-
d
)
/
(
lam
+
eps
))).
lock
()
self
.
_curv
=
Phi_h
.
inverse
+
SandwichOperator
.
make
(
R1
,
W
)
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
_d
,
self
.
_Instrument
,
self
.
_nonlinearity
,
self
.
_ht
,
self
.
_Phi_h
,
self
.
_ic
)
@
property
def
value
(
self
):
return
self
.
_value
@
property
def
gradient
(
self
):
return
self
.
_grad
@
property
def
curvature
(
self
):
return
InversionEnabler
(
self
.
_curv
,
self
.
_ic
,
self
.
_Phi_h
.
inverse
)
nifty5/library/poisson_log_likelihood.py
View file @
41d128bb
...
@@ -26,7 +26,7 @@ from ..sugar import log, makeOp
...
@@ -26,7 +26,7 @@ from ..sugar import log, makeOp
class
PoissonLogLikelihood
(
Energy
):
class
PoissonLogLikelihood
(
Energy
):
def
__init__
(
self
,
lamb
,
d
):
def
__init__
(
self
,
lamb
,
d
):
"""
"""
s
: Sky model object
lamb
: Sky model object
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
covariance
covariance
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment