Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
71e38722
Commit
71e38722
authored
Feb 10, 2020
by
Lukas Platz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
concise CorrelatedField offset parametrization
parent
ff7dfaa8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
nifty6/library/correlated_fields.py
nifty6/library/correlated_fields.py
+12
-10
No files found.
nifty6/library/correlated_fields.py
View file @
71e38722
...
...
@@ -352,18 +352,19 @@ class _Amplitude(Operator):
class
CorrelatedFieldMaker
:
def
__init__
(
self
,
amplitude_offset
,
prefix
,
total_N
):
if
not
isinstance
(
amplitude_offset
,
Operator
):
raise
TypeError
(
"
amplitude_offset
needs to be an operator"
)
def
__init__
(
self
,
offset_mean
,
offset_fluctuations_op
,
prefix
,
total_N
):
if
not
isinstance
(
offset_fluctuations_op
,
Operator
):
raise
TypeError
(
"
offset_fluctuations_op
needs to be an operator"
)
self
.
_a
=
[]
self
.
_position_spaces
=
[]
self
.
_azm
=
amplitude_offset
self
.
_offset_mean
=
offset_mean
self
.
_azm
=
offset_fluctuations_op
self
.
_prefix
=
prefix
self
.
_total_N
=
total_N
@
staticmethod
def
make
(
offset_
amplitude_mean
,
offset_amplitude
_stddev
,
prefix
,
def
make
(
offset_
mean
,
offset_variation_mean
,
offset_variation
_stddev
,
prefix
,
total_N
=
0
,
dofdex
=
None
):
if
dofdex
is
None
:
...
...
@@ -371,13 +372,13 @@ class CorrelatedFieldMaker:
elif
len
(
dofdex
)
!=
total_N
:
raise
ValueError
(
"length of dofdex needs to match total_N"
)
N
=
max
(
dofdex
)
+
1
if
total_N
>
0
else
0
zm
=
_LognormalMomentMatching
(
offset_
amplitude
_mean
,
offset_
amplitude
_stddev
,
zm
=
_LognormalMomentMatching
(
offset_
variation
_mean
,
offset_
variation
_stddev
,
prefix
+
'zeromode'
,
N
)
if
total_N
>
0
:
zm
=
_Distributor
(
dofdex
,
zm
.
target
,
UnstructuredDomain
(
total_N
))
@
zm
return
CorrelatedFieldMaker
(
zm
,
prefix
,
total_N
)
return
CorrelatedFieldMaker
(
offset_mean
,
zm
,
prefix
,
total_N
)
def
add_fluctuations
(
self
,
position_space
,
...
...
@@ -470,12 +471,13 @@ class CorrelatedFieldMaker:
corr
=
reduce
(
mul
,
a
)
return
ht
(
azm
*
corr
*
ducktape
(
hspace
,
None
,
self
.
_prefix
+
'xi'
))
def
finalize
(
self
,
offset
=
None
,
prior_info
=
100
):
def
finalize
(
self
,
prior_info
=
100
):
"""
offset vs zeromode: volume factor
"""
op
=
self
.
_finalize_from_op
()
if
offset
is
not
None
:
if
self
.
_offset_mean
is
not
None
:
offset
=
self
.
_offset_mean
# Deviations from this offset must not be considered here as they
# are learned by the zeromode
if
isinstance
(
offset
,
(
Field
,
MultiField
)):
...
...
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