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
Open sidebar
ift
NIFTy
Commits
4fe143dd
Commit
4fe143dd
authored
Nov 13, 2019
by
Philipp Haim
Browse files
Working for arbitrary constelation of DomainTuple
parent
eacba248
Pipeline
#63621
failed with stages
in 4 minutes and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/correlated_fields.py
View file @
4fe143dd
...
...
@@ -231,21 +231,18 @@ class CorrelatedFieldMaker:
twolog
=
_TwoLogIntegrations
(
target
,
space
)
dt
=
twolog
.
_logvol
axis
=
target
.
axes
[
space
][
0
]
sl
=
(
slice
(
None
),)
*
axis
first
=
(
slice
(
None
),)
*
axis
+
(
0
,)
extender_sl
=
(
None
,)
*
axis
+
(
slice
(
None
),)
+
(
None
,)
*
(
target
.
axes
[
-
1
][
-
1
]
-
axis
)
first
=
sl
+
(
0
,)
second
=
sl
+
(
1
,)
expander
=
ContractionOperator
(
twolog
.
domain
,
spaces
=
space
).
adjoint
sqrt_t
=
np
.
zeros
(
twolog
.
domain
[
space
].
shape
)
#sqrt_t[first] = sqrt_t[second] = np.sqrt(dt)
sqrt_t
[
0
]
=
sqrt_t
[
1
]
=
np
.
sqrt
(
dt
)
sqrt_t
=
from_global_data
(
twolog
.
domain
[
space
],
sqrt_t
)
sqrt_t
=
DiagonalOperator
(
sqrt_t
,
twolog
.
domain
,
spaces
=
space
)
sigmasq
=
sqrt_t
@
expander
@
flexibility
dist
=
np
.
zeros
(
twolog
.
domain
[
space
].
shape
)
dist
[
first
]
+=
1.
dist
[
0
]
+=
1.
dist
=
from_global_data
(
twolog
.
domain
[
space
],
dist
)
dist
=
DiagonalOperator
(
dist
,
twolog
.
domain
,
spaces
=
space
)
...
...
@@ -258,8 +255,9 @@ class CorrelatedFieldMaker:
smoothslope
=
_make_slope_Operator
(
smooth
,
loglogavgslope
,
space
)
# move to tests
#assert_allclose(
# smooth(from_random('normal', smooth.domain)).val[0:2], 0)
assert_allclose
(
smooth
(
from_random
(
'normal'
,
smooth
.
domain
)).
val
[(
slice
(
None
),)
*
axis
+
(
slice
(
0
,
2
),)],
0
)
consistency_check
(
twolog
)
check_jacobian_consistency
(
smooth
,
from_random
(
'normal'
,
smooth
.
domain
))
...
...
@@ -275,7 +273,7 @@ class CorrelatedFieldMaker:
expander
=
DiagonalOperator
(
from_global_data
(
target
[
space
],
arr
)
,
target
,
spaces
=
space
)
@
expander
mask
=
np
.
zeros
(
target
.
shape
)
mask
[
0
]
=
vol
mask
[
first
]
=
vol
adder
=
Adder
(
from_global_data
(
target
,
mask
))
ampl
=
adder
@
((
expander
@
fluctuations
)
*
normal_ampl
)
...
...
Write
Preview
Supports
Markdown
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