Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
ift
NIFTy
Commits
6b9e5599
Commit
6b9e5599
authored
Jul 25, 2018
by
Martin Reinecke
Browse files
cosmetics
parent
3124afc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
test/test_energies/consistency_check.py
View file @
6b9e5599
...
...
@@ -83,7 +83,7 @@ class Energy_Tests(unittest.TestCase):
model
=
self
.
make_model
(
type1
,
space_key
=
's1'
,
space
=
space
,
seed
=
seed
)[
's1'
]
model
=
ift
.
PointwiseExponential
(
model
)
d
=
np
.
random
.
poisson
(
120
,
size
=
space
.
shape
)
d
=
np
.
random
.
poisson
(
120
,
size
=
space
.
shape
)
d
=
ift
.
Field
.
from_global_data
(
space
,
d
)
energy
=
ift
.
PoissonianEnergy
(
model
,
d
)
ift
.
extra
.
check_value_gradient_consistency
(
energy
)
...
...
@@ -118,8 +118,7 @@ class Energy_Tests(unittest.TestCase):
model
=
self
.
make_model
(
type1
,
space_key
=
's1'
,
space
=
space
,
seed
=
seed
)[
's1'
]
model
=
ift
.
PointwisePositiveTanh
(
model
)
d
=
np
.
random
.
binomial
(
1
,
0.1
,
size
=
space
.
shape
)
d
=
np
.
random
.
binomial
(
1
,
0.1
,
size
=
space
.
shape
)
d
=
ift
.
Field
.
from_global_data
(
space
,
d
)
energy
=
ift
.
BernoulliEnergy
(
model
,
d
)
ift
.
extra
.
check_value_gradient_consistency
(
energy
)
test/test_models/test_model_gradients.py
View file @
6b9e5599
...
...
@@ -125,11 +125,11 @@ class Model_Tests(unittest.TestCase):
[
4
,
78
,
23
],
))
def
testModelLibrary
(
self
,
space
,
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
,
seed
):
#tests amplitude model and coorelated field model
ceps_k
,
sm
,
sv
,
im
,
iv
,
seed
):
#
tests amplitude model and coorelated field model
np
.
random
.
seed
(
seed
)
model
=
ift
.
make_amplitude_model
(
space
,
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
)[
0
]
model
=
ift
.
make_amplitude_model
(
space
,
Npixdof
,
ceps_a
,
ceps_k
,
sm
,
sv
,
im
,
iv
)[
0
]
S
=
ift
.
ScalingOperator
(
1.
,
model
.
position
.
domain
)
model
=
model
.
at
(
S
.
draw_sample
())
ift
.
extra
.
check_value_gradient_consistency
(
model
)
...
...
@@ -143,20 +143,18 @@ class Model_Tests(unittest.TestCase):
[
ift
.
GLSpace
(
15
),
ift
.
RGSpace
(
64
,
distances
=
.
789
),
ift
.
RGSpace
([
32
,
32
],
distances
=
.
789
)],
[
4
,
78
,
23
]))
[
4
,
78
,
23
]))
def
testPointModel
(
seld
,
space
,
seed
):
S
=
ift
.
ScalingOperator
(
1.
,
space
)
pos
=
ift
.
MultiField
.
from_dict
(
{
'points'
:
S
.
draw_sample
()})
alpha
=
1.5
q
=
0.73
model
=
ift
.
PointSources
(
pos
,
alpha
,
q
)
#All those cdfs and ppfs are not that accurate
#
All those cdfs and ppfs are not that accurate
ift
.
extra
.
check_value_gradient_consistency
(
model
,
tol
=
1e-5
)
@
expand
(
product
(
[
'Variable'
,
'Constant'
],
[
ift
.
GLSpace
(
15
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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