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
d018c524
Commit
d018c524
authored
Nov 29, 2017
by
Martin Reinecke
Browse files
more cosmetics
parent
3ccb329c
Pipeline
#22320
passed with stage
in 4 minutes and 47 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nifty/library/log_normal_wiener_filter_curvature.py
View file @
d018c524
from
..operators
import
EndomorphicOperator
from
..utilities
import
memo
from
..field
import
exp
from
..sugar
import
create_composed_fft_operator
class
LogNormalWienerFilterCurvature
(
EndomorphicOperator
):
...
...
nifty/library/noise_energy.py
View file @
d018c524
...
...
@@ -6,10 +6,10 @@ from ..utilities import memo
class
NoiseEnergy
(
Energy
):
def
__init__
(
self
,
position
,
d
,
m
,
D
,
t
,
FFT
,
Instrument
,
nonlinearity
,
alpha
,
q
,
Projection
,
samples
=
3
,
sample_list
=
None
,
inverter
=
None
):
def
__init__
(
self
,
position
,
d
,
m
,
D
,
t
,
FFT
,
Instrument
,
nonlinearity
,
alpha
,
q
,
Projection
,
samples
=
3
,
sample_list
=
None
,
inverter
=
None
):
super
(
NoiseEnergy
,
self
).
__init__
(
position
=
position
.
copy
())
dummy
=
self
.
position
.
norm
()
self
.
m
=
m
self
.
D
=
D
self
.
d
=
d
...
...
@@ -39,13 +39,11 @@ class NoiseEnergy(Energy):
self
.
inverter
=
inverter
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
d
,
self
.
m
,
self
.
D
,
self
.
t
,
self
.
FFT
,
self
.
Instrument
,
self
.
nonlinearity
,
self
.
alpha
,
self
.
q
,
self
.
Projection
,
sample_list
=
self
.
sample_list
,
samples
=
self
.
samples
,
inverter
=
self
.
inverter
)
return
self
.
__class__
(
position
,
self
.
d
,
self
.
m
,
self
.
D
,
self
.
t
,
self
.
FFT
,
self
.
Instrument
,
self
.
nonlinearity
,
self
.
alpha
,
self
.
q
,
self
.
Projection
,
sample_list
=
self
.
sample_list
,
samples
=
self
.
samples
,
inverter
=
self
.
inverter
)
@
property
@
memo
...
...
@@ -53,8 +51,10 @@ class NoiseEnergy(Energy):
likelihood
=
0.
for
sample
in
self
.
sample_list
:
likelihood
+=
self
.
_likelihood
(
sample
)
return
((
likelihood
/
float
(
len
(
self
.
sample_list
)))
+
0.5
*
self
.
one
.
vdot
(
self
.
position
)
+
(
self
.
alpha
-
self
.
one
).
vdot
(
self
.
position
)
+
self
.
q
.
vdot
(
exp
(
-
self
.
position
)))
return
((
likelihood
/
float
(
len
(
self
.
sample_list
)))
+
0.5
*
self
.
one
.
vdot
(
self
.
position
)
+
(
self
.
alpha
-
self
.
one
).
vdot
(
self
.
position
)
+
self
.
q
.
vdot
(
exp
(
-
self
.
position
)))
def
_likelihood
(
self
,
m
):
residual
=
self
.
d
-
\
...
...
@@ -69,8 +69,9 @@ class NoiseEnergy(Energy):
likelihood_gradient
=
Field
(
self
.
position
.
domain
,
val
=
0.
)
for
sample
in
self
.
sample_list
:
likelihood_gradient
+=
self
.
_likelihood_gradient
(
sample
)
return
(
likelihood_gradient
/
float
(
len
(
self
.
sample_list
))
+
0.5
*
self
.
one
+
(
self
.
alpha
-
self
.
one
)
-
self
.
q
*
(
exp
(
-
self
.
position
)))
return
(
likelihood_gradient
/
float
(
len
(
self
.
sample_list
))
+
0.5
*
self
.
one
+
(
self
.
alpha
-
self
.
one
)
-
self
.
q
*
(
exp
(
-
self
.
position
)))
def
_likelihood_gradient
(
self
,
m
):
residual
=
self
.
d
-
\
...
...
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