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
82fae1d6
Commit
82fae1d6
authored
Feb 07, 2018
by
Martin Reinecke
Browse files
remove log-normal-related code; superseded by more general nonlinear classes
parent
848b1006
Pipeline
#24591
passed with stage
in 15 minutes and 23 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty4/library/__init__.py
View file @
82fae1d6
from
.critical_power_energy
import
CriticalPowerEnergy
from
.critical_power_curvature
import
CriticalPowerCurvature
from
.log_normal_wiener_filter_energy
import
LogNormalWienerFilterEnergy
from
.log_normal_wiener_filter_curvature
import
LogNormalWienerFilterCurvature
from
.wiener_filter_energy
import
WienerFilterEnergy
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.noise_energy
import
NoiseEnergy
...
...
test/test_energies/test_map.py
View file @
82fae1d6
...
...
@@ -72,53 +72,11 @@ class Energy_Tests(unittest.TestCase):
tol
=
1e-5
assert_allclose
(
a
,
b
,
rtol
=
tol
,
atol
=
tol
)
@
expand
(
product
([
ift
.
RGSpace
(
64
,
distances
=
.
789
),
ift
.
RGSpace
([
32
,
32
],
distances
=
.
789
)],
[
4
,
78
,
23
]))
def
testLognormalMap
(
self
,
space
,
seed
):
np
.
random
.
seed
(
seed
)
dim
=
len
(
space
.
shape
)
hspace
=
space
.
get_default_codomain
()
ht
=
ift
.
HarmonicTransformOperator
(
hspace
,
target
=
space
)
binbounds
=
ift
.
PowerSpace
.
useful_binbounds
(
hspace
,
logarithmic
=
False
)
pspace
=
ift
.
PowerSpace
(
hspace
,
binbounds
=
binbounds
)
P
=
ift
.
PowerProjectionOperator
(
domain
=
hspace
,
power_space
=
pspace
)
xi0
=
ift
.
Field
.
from_random
(
domain
=
hspace
,
random_type
=
'normal'
)
def
pspec
(
k
):
return
1
/
(
1
+
k
**
2
)
**
dim
pspec
=
ift
.
PS_field
(
pspace
,
pspec
)
A
=
P
.
adjoint_times
(
ift
.
sqrt
(
pspec
))
n
=
ift
.
Field
.
from_random
(
domain
=
space
,
random_type
=
'normal'
)
sh0
=
xi0
*
A
s
=
ht
(
sh0
)
Instrument
=
ift
.
ScalingOperator
(
10.
,
space
)
R
=
Instrument
*
ht
N
=
ift
.
ScalingOperator
(
1.
,
space
)
d
=
Instrument
(
ift
.
exp
(
s
))
+
n
direction
=
ift
.
Field
.
from_random
(
'normal'
,
hspace
)
direction
/=
np
.
sqrt
(
direction
.
var
())
eps
=
1e-6
sh1
=
sh0
+
eps
*
direction
IC
=
ift
.
GradientNormController
(
iteration_limit
=
100
,
tol_abs_gradnorm
=
1e-5
)
inverter
=
ift
.
ConjugateGradient
(
IC
)
S
=
ift
.
create_power_operator
(
hspace
,
power_spectrum
=
_flat_PS
)
energy0
=
ift
.
library
.
LogNormalWienerFilterEnergy
(
position
=
sh0
,
d
=
d
,
R
=
R
,
N
=
N
,
S
=
S
,
inverter
=
inverter
)
energy1
=
energy0
.
at
(
sh1
)
a
=
(
energy1
.
value
-
energy0
.
value
)
/
eps
b
=
energy0
.
gradient
.
vdot
(
direction
)
tol
=
1e-3
assert_allclose
(
a
,
b
,
rtol
=
tol
,
atol
=
tol
)
@
expand
(
product
([
ift
.
RGSpace
(
64
,
distances
=
.
789
),
ift
.
RGSpace
([
32
,
32
],
distances
=
.
789
)],
[
ift
.
library
.
Exponential
,
ift
.
library
.
Linear
],
[
ift
.
library
.
Tanh
,
ift
.
library
.
Exponential
,
ift
.
library
.
Linear
],
[
4
,
78
,
23
]))
def
testNonlinearMap
(
self
,
space
,
nonlinearity
,
seed
):
np
.
random
.
seed
(
seed
)
...
...
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