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
ift
NIFTy
Commits
0408c142
Commit
0408c142
authored
May 05, 2021
by
Philipp Arras
Browse files
correlated_fields_simple.py: Support fixed zero mode
parent
0eff4f8e
Pipeline
#100964
passed with stages
in 12 minutes and 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/library/correlated_fields_simple.py
View file @
0408c142
...
...
@@ -62,6 +62,8 @@ def SimpleCorrelatedField(
for
kk
in
[
offset_std
,
fluctuations
,
loglogavgslope
]:
if
len
(
kk
)
!=
2
:
raise
TypeError
if
not
(
offset_std
is
None
or
len
(
offset_std
)
==
2
):
raise
TypeError
for
kk
in
[
flexibility
,
asperity
]:
if
not
(
kk
is
None
or
len
(
kk
)
==
2
):
raise
TypeError
...
...
@@ -69,7 +71,6 @@ def SimpleCorrelatedField(
raise
ValueError
fluct
=
LognormalTransform
(
*
fluctuations
,
prefix
+
'fluctuations'
,
0
)
avgsl
=
NormalTransform
(
*
loglogavgslope
,
prefix
+
'loglogavgslope'
,
0
)
zm
=
LognormalTransform
(
*
offset_std
,
prefix
+
'zeromode'
,
0
)
pspace
=
PowerSpace
(
harmonic_partner
)
twolog
=
_TwoLogIntegrations
(
pspace
)
...
...
@@ -107,8 +108,11 @@ def SimpleCorrelatedField(
maskzm
=
np
.
ones
(
pspace
.
shape
)
maskzm
[
0
]
=
0
maskzm
=
makeOp
(
makeField
(
pspace
,
maskzm
))
insert
=
ValueInserter
(
pspace
,
(
0
,))
a
=
(
maskzm
@
((
ps_expander
@
fluct
)
*
a
))
+
insert
(
zm
)
a
=
(
maskzm
@
((
ps_expander
@
fluct
)
*
a
))
if
offset_std
is
not
None
:
zm
=
LognormalTransform
(
*
offset_std
,
prefix
+
'zeromode'
,
0
)
insert
=
ValueInserter
(
pspace
,
(
0
,))
a
=
a
+
insert
(
zm
)
a
=
a
.
scale
(
target
.
total_volume
)
ht
=
HarmonicTransformOperator
(
harmonic_partner
,
target
)
...
...
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