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
d33f8631
Commit
d33f8631
authored
Sep 20, 2018
by
Martin Reinecke
Browse files
Merge branch 'NIFTy_5' into outer_product
parents
eb0162e9
b95589ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
nifty5/library/correlated_fields.py
View file @
d33f8631
...
...
@@ -27,22 +27,25 @@ from ..operators.harmonic_operators import HarmonicTransformOperator
from
..operators.simple_linear_operators
import
FieldAdapter
def
CorrelatedField
(
s_space
,
amplitude_model
):
def
CorrelatedField
(
s_space
,
amplitude_model
,
name
=
'xi'
):
'''
Function for construction of correlated fields
Parameters
----------
s_space : Field domain
amplitude_model : model for correlation structure
s_space : Domain
Field domain
amplitude_model: Operator
model for correlation structure
name : string
MultiField component name
'''
h_space
=
s_space
.
get_default_codomain
()
ht
=
HarmonicTransformOperator
(
h_space
,
s_space
)
p_space
=
amplitude_model
.
target
[
0
]
power_distributor
=
PowerDistributor
(
h_space
,
p_space
)
A
=
power_distributor
(
amplitude_model
)
return
ht
(
A
*
FieldAdapter
(
MultiDomain
.
make
({
"xi"
:
h_space
}),
"xi"
))
return
ht
(
A
*
FieldAdapter
(
MultiDomain
.
make
({
name
:
h_space
}),
name
))
def
MfCorrelatedField
(
s_space_spatial
,
s_space_energy
,
amplitude_model_spatial
,
...
...
nifty5/operators/harmonic_operators.py
View file @
d33f8631
...
...
@@ -289,6 +289,10 @@ class SHTOperator(LinearOperator):
else
:
self
.
sjob
.
set_Healpix_geometry
(
target
.
nside
)
def
__reduce__
(
self
):
return
(
_unpickleSHTOperator
,
(
self
.
_domain
,
self
.
_target
[
self
.
_space
],
self
.
_space
))
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
utilities
.
iscomplextype
(
x
.
dtype
):
...
...
@@ -337,6 +341,10 @@ class SHTOperator(LinearOperator):
return
Field
(
tdom
,
dobj
.
ensure_default_distributed
(
odat
))
def
_unpickleSHTOperator
(
*
args
):
return
SHTOperator
(
*
args
)
class
HarmonicTransformOperator
(
LinearOperator
):
"""Transforms between a harmonic domain and a position domain counterpart.
...
...
nifty5/operators/operator_adapter.py
View file @
d33f8631
...
...
@@ -69,6 +69,6 @@ class OperatorAdapter(LinearOperator):
def
__repr__
(
self
):
from
..utilities
import
indent
mode
=
[
"adjoint"
,
"inverse"
,
"adjoint inverse"
][
self
.
_trafo
]
mode
=
[
"adjoint"
,
"inverse"
,
"adjoint inverse"
][
self
.
_trafo
-
1
]
res
=
"OperatorAdapter: {}
\n
"
.
format
(
mode
)
return
res
+
indent
(
self
.
_op
.
__repr__
())
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