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
e51171cc
Commit
e51171cc
authored
Nov 06, 2019
by
Philipp Frank
Browse files
fixup refactor slope handling
parent
e3d7fc8e
Pipeline
#63052
failed with stages
in 4 minutes and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/correlated_fields.py
View file @
e51171cc
...
...
@@ -63,7 +63,7 @@ class _SlopeRemover(EndomorphicOperator):
if
mode
==
self
.
TIMES
:
res
=
x
-
x
[
-
1
]
*
self
.
_sc
else
:
res
=
np
.
empty
(
x
.
shape
)
res
=
np
.
zeros
(
x
.
shape
,
dtype
=
x
.
dtype
)
res
+=
x
res
[
-
1
]
-=
(
x
*
self
.
_sc
).
sum
()
return
from_global_data
(
self
.
_tgt
(
mode
),
res
)
...
...
@@ -75,8 +75,11 @@ def _make_slope_Operator(smooth,loglogavgslope):
logkl
-=
logkl
[
0
]
logkl
=
np
.
insert
(
logkl
,
0
,
0
)
noslope
=
_SlopeRemover
(
tg
,
logkl
)
@
smooth
# FIXME Move to tests
consistency_check
(
_SlopeRemover
(
tg
,
logkl
))
_t
=
VdotOperator
(
from_global_data
(
tg
,
logkl
)).
adjoint
return
noslope
+
_t
@
loglogavgslope
return
_t
@
loglogavgslope
+
noslope
def
_log_k_lengths
(
pspace
):
return
np
.
log
(
pspace
.
k_lengths
[
1
:])
...
...
@@ -186,6 +189,7 @@ class CorrelatedFieldMaker:
smooth
=
twolog
@
(
scale
*
ducktape
(
scale
.
target
,
None
,
key
))
smoothslope
=
_make_slope_Operator
(
smooth
,
loglogavgslope
)
#smoothslope = smooth
# move to tests
assert_allclose
(
...
...
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