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
Neel Shah
NIFTy
Commits
e51171cc
Commit
e51171cc
authored
Nov 06, 2019
by
Philipp Frank
Browse files
fixup refactor slope handling
parent
e3d7fc8e
Changes
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
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