Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
8b7d2857
Commit
8b7d2857
authored
5 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Cosmetics
parent
cb0b29db
No related branches found
No related tags found
1 merge request
!415
CorrelatedFieldMaker: offset parametrization in one place
Pipeline
#71430
passed
5 years ago
Stage: build_docker
Stage: test
Stage: demo_runs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_operators/test_correlated_fields.py
+9
-12
9 additions, 12 deletions
test/test_operators/test_correlated_fields.py
with
9 additions
and
12 deletions
test/test_operators/test_correlated_fields.py
+
9
−
12
View file @
8b7d2857
...
@@ -31,7 +31,7 @@ import nifty6 as ift
...
@@ -31,7 +31,7 @@ import nifty6 as ift
@pytest.mark.parametrize
(
'
rseed
'
,
[
13
,
2
])
@pytest.mark.parametrize
(
'
rseed
'
,
[
13
,
2
])
@pytest.mark.parametrize
(
'
Astds
'
,
[[
1.
,
3.
],
[
0.2
,
1.4
]])
@pytest.mark.parametrize
(
'
Astds
'
,
[[
1.
,
3.
],
[
0.2
,
1.4
]])
@pytest.mark.parametrize
(
'
offset_std_mean
'
,
[
1.
,
10.
])
@pytest.mark.parametrize
(
'
offset_std_mean
'
,
[
1.
,
10.
])
@pytest.mark.parametrize
(
'
N
'
,
[
0
,
2
])
@pytest.mark.parametrize
(
'
N
'
,
[
0
,
2
])
def
testAmplitudesConsistency
(
rseed
,
sspace
,
Astds
,
offset_std_mean
,
N
):
def
testAmplitudesConsistency
(
rseed
,
sspace
,
Astds
,
offset_std_mean
,
N
):
def
stats
(
op
,
samples
):
def
stats
(
op
,
samples
):
sc
=
ift
.
StatCalculator
()
sc
=
ift
.
StatCalculator
()
...
@@ -43,18 +43,16 @@ def testAmplitudesConsistency(rseed, sspace, Astds, offset_std_mean, N):
...
@@ -43,18 +43,16 @@ def testAmplitudesConsistency(rseed, sspace, Astds, offset_std_mean, N):
nsam
=
100
nsam
=
100
fsspace
=
ift
.
RGSpace
((
12
,),
(
0.4
,))
fsspace
=
ift
.
RGSpace
((
12
,),
(
0.4
,))
if
N
==
2
:
if
N
==
2
:
dofdex1
=
[
0
,
0
]
dofdex1
=
[
0
,
0
]
dofdex2
=
[
1
,
0
]
dofdex2
=
[
1
,
0
]
dofdex3
=
[
1
,
1
]
dofdex3
=
[
1
,
1
]
else
:
else
:
dofdex1
,
dofdex2
,
dofdex3
=
None
,
None
,
None
dofdex1
,
dofdex2
,
dofdex3
=
None
,
None
,
None
fa
=
ift
.
CorrelatedFieldMaker
.
make
(
0.
,
offset_std_mean
,
1E-8
,
''
,
N
,
dofdex1
)
fa
=
ift
.
CorrelatedFieldMaker
.
make
(
0.
,
offset_std_mean
,
1E-8
,
''
,
N
,
dofdex1
)
fa
.
add_fluctuations
(
sspace
,
Astds
[
0
],
1E-8
,
1.1
,
2.
,
2.1
,
.
5
,
-
2
,
1.
,
fa
.
add_fluctuations
(
sspace
,
Astds
[
0
],
1E-8
,
1.1
,
2.
,
2.1
,
.
5
,
-
2
,
1.
,
'
spatial
'
,
dofdex
=
dofdex2
)
'
spatial
'
,
dofdex
=
dofdex2
)
fa
.
add_fluctuations
(
fsspace
,
Astds
[
1
],
1E-8
,
3.1
,
1.
,
.
5
,
.
1
,
-
4
,
1.
,
'
freq
'
,
dofdex
=
dofdex3
)
fa
.
add_fluctuations
(
fsspace
,
Astds
[
1
],
1E-8
,
3.1
,
1.
,
.
5
,
.
1
,
-
4
,
1.
,
'
freq
'
,
dofdex
=
dofdex3
)
op
=
fa
.
finalize
()
op
=
fa
.
finalize
()
samples
=
[
ift
.
from_random
(
'
normal
'
,
op
.
domain
)
for
_
in
range
(
nsam
)]
samples
=
[
ift
.
from_random
(
'
normal
'
,
op
.
domain
)
for
_
in
range
(
nsam
)]
...
@@ -82,14 +80,13 @@ def testAmplitudesConsistency(rseed, sspace, Astds, offset_std_mean, N):
...
@@ -82,14 +80,13 @@ def testAmplitudesConsistency(rseed, sspace, Astds, offset_std_mean, N):
assert_allclose
(
slice_fluct_std1
,
sl_fluct_freq
,
rtol
=
0.5
)
assert_allclose
(
slice_fluct_std1
,
sl_fluct_freq
,
rtol
=
0.5
)
fa
=
ift
.
CorrelatedFieldMaker
.
make
(
0.
,
offset_std_mean
,
.
1
,
''
,
N
,
dofdex1
)
fa
=
ift
.
CorrelatedFieldMaker
.
make
(
0.
,
offset_std_mean
,
.
1
,
''
,
N
,
dofdex1
)
fa
.
add_fluctuations
(
fsspace
,
Astds
[
1
],
1.
,
3.1
,
1.
,
.
5
,
.
1
,
-
4
,
1.
,
'
freq
'
,
dofdex
=
dofdex3
)
fa
.
add_fluctuations
(
fsspace
,
Astds
[
1
],
1.
,
3.1
,
1.
,
.
5
,
.
1
,
-
4
,
1.
,
'
freq
'
,
dofdex
=
dofdex3
)
m
=
3.
m
=
3.
x
=
fa
.
moment_slice_to_average
(
m
)
x
=
fa
.
moment_slice_to_average
(
m
)
fa
.
add_fluctuations
(
sspace
,
x
,
1.5
,
1.1
,
2.
,
2.1
,
.
5
,
-
2
,
1.
,
'
spatial
'
,
0
,
dofdex
=
dofdex2
)
fa
.
add_fluctuations
(
sspace
,
x
,
1.5
,
1.1
,
2.
,
2.1
,
.
5
,
-
2
,
1.
,
'
spatial
'
,
0
,
dofdex
=
dofdex2
)
op
=
fa
.
finalize
()
op
=
fa
.
finalize
()
em
,
estd
=
stats
(
fa
.
slice_fluctuation
(
0
),
samples
)
em
,
estd
=
stats
(
fa
.
slice_fluctuation
(
0
),
samples
)
assert_allclose
(
m
,
em
,
rtol
=
0.5
)
assert_allclose
(
m
,
em
,
rtol
=
0.5
)
assert
op
.
target
[
-
2
]
==
sspace
assert
op
.
target
[
-
2
]
==
sspace
assert
op
.
target
[
-
1
]
==
fsspace
assert
op
.
target
[
-
1
]
==
fsspace
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment