Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
374675e9
Commit
374675e9
authored
5 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Support fields as amplitudes in correlated field
parent
a25ec34e
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!367
WIP: Normalized amplitudes pp
Pipeline
#62511
passed
5 years ago
Stage: build_docker
Stage: test
Stage: demo_runs
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nifty5/library/correlated_fields.py
+12
-3
12 additions, 3 deletions
nifty5/library/correlated_fields.py
with
12 additions
and
3 deletions
nifty5/library/correlated_fields.py
+
12
−
3
View file @
374675e9
...
@@ -19,13 +19,14 @@ from functools import reduce
...
@@ -19,13 +19,14 @@ from functools import reduce
from
operator
import
mul
from
operator
import
mul
from
..domain_tuple
import
DomainTuple
from
..domain_tuple
import
DomainTuple
from
..field
import
Field
from
..operators.adder
import
Adder
from
..operators.adder
import
Adder
from
..operators.contraction_operator
import
ContractionOperator
from
..operators.contraction_operator
import
ContractionOperator
from
..operators.distributors
import
PowerDistributor
from
..operators.distributors
import
PowerDistributor
from
..operators.harmonic_operators
import
HarmonicTransformOperator
from
..operators.harmonic_operators
import
HarmonicTransformOperator
from
..operators.operator
import
Operator
from
..operators.operator
import
Operator
from
..operators.simple_linear_operators
import
VdotOperator
,
ducktape
from
..operators.simple_linear_operators
import
VdotOperator
,
ducktape
from
..sugar
import
full
from
..sugar
import
full
,
makeOp
def
CorrelatedField
(
target
,
amplitude_operator
,
name
=
'
xi
'
,
codomain
=
None
):
def
CorrelatedField
(
target
,
amplitude_operator
,
name
=
'
xi
'
,
codomain
=
None
):
...
@@ -68,15 +69,23 @@ def CorrelatedField(target, amplitude_operator, name='xi', codomain=None):
...
@@ -68,15 +69,23 @@ def CorrelatedField(target, amplitude_operator, name='xi', codomain=None):
codomain
=
tgt
[
0
].
get_default_codomain
()
codomain
=
tgt
[
0
].
get_default_codomain
()
h_space
=
codomain
h_space
=
codomain
ht
=
HarmonicTransformOperator
(
h_space
,
target
=
tgt
[
0
])
ht
=
HarmonicTransformOperator
(
h_space
,
target
=
tgt
[
0
])
p_space
=
amplitude_operator
.
target
[
0
]
if
isinstance
(
amplitude_operator
,
Operator
):
p_space
=
amplitude_operator
.
target
[
0
]
elif
isinstance
(
amplitude_operator
,
Field
):
p_space
=
amplitude_operator
.
domain
[
0
]
else
:
raise
TypeError
power_distributor
=
PowerDistributor
(
h_space
,
p_space
)
power_distributor
=
PowerDistributor
(
h_space
,
p_space
)
A
=
power_distributor
(
amplitude_operator
)
A
=
power_distributor
(
amplitude_operator
)
vol
=
h_space
.
scalar_dvol
**-
0.5
vol
=
h_space
.
scalar_dvol
**-
0.5
xi
=
ducktape
(
h_space
,
None
,
name
)
# When doubling the resolution of `tgt` the value of the highest k-mode
# When doubling the resolution of `tgt` the value of the highest k-mode
# will scale with a square root. `vol` cancels this effect such that the
# will scale with a square root. `vol` cancels this effect such that the
# same power spectrum can be used for the spaces with the same volume,
# same power spectrum can be used for the spaces with the same volume,
# different resolutions and the same object in them.
# different resolutions and the same object in them.
return
ht
(
vol
*
A
*
ducktape
(
h_space
,
None
,
name
))
if
isinstance
(
amplitude_operator
,
Field
):
return
ht
(
makeOp
(
A
)
@xi
).
scale
(
vol
)
return
ht
(
A
*
xi
).
scale
(
vol
)
def
MfCorrelatedField
(
target
,
amplitudes
,
name
=
'
xi
'
):
def
MfCorrelatedField
(
target
,
amplitudes
,
name
=
'
xi
'
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment