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
3eb142ac
Commit
3eb142ac
authored
Oct 24, 2019
by
Philipp Frank
Browse files
replaced expander
parent
a4dc9c3b
Pipeline
#62468
passed with stages
in 7 minutes and 2 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/correlated_fields_normalized_amplitude.py
View file @
3eb142ac
...
...
@@ -19,21 +19,6 @@ import nifty5 as ift
from
functools
import
reduce
from
operator
import
mul
class
FullExpander
(
ift
.
LinearOperator
):
def
__init__
(
self
,
target
):
self
.
_domain
=
ift
.
makeDomain
(
ift
.
UnstructuredDomain
(
1
))
self
.
_target
=
ift
.
makeDomain
(
target
)
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
x
=
x
.
to_global_data
()
if
mode
==
self
.
TIMES
:
res
=
x
[
0
]
else
:
res
=
x
.
sum
()
return
ift
.
full
(
self
.
_tgt
(
mode
),
res
)
def
CorrelatedFieldNormAmplitude
(
target
,
amplitudes
,
stdmean
,
stdstd
,
...
...
@@ -98,11 +83,10 @@ def CorrelatedFieldNormAmplitude(target, amplitudes,
a
=
a
*
(
ift
.
ContractionOperator
(
pd
.
domain
,
spaces
[:
i
]
+
spaces
[(
i
+
1
):]).
adjoint
@
amps
[
i
])
expander
=
FullExpander
(
a
.
target
)
fstdstd
=
ift
.
full
(
expander
.
domain
,
stdstd
)
fstdmean
=
ift
.
full
(
expander
.
domain
,
stdmean
)
Std
=
ift
.
makeOp
(
fstdstd
)
@
ift
.
ducktape
(
expander
.
domain
,
None
,
names
[
1
])
Std
=
expander
@
(
ift
.
Adder
(
fstdmean
)
@
Std
).
exp
()
expander
=
ift
.
VdotOperator
(
ift
.
full
(
a
.
target
,
1.
)).
adjoint
Std
=
stdstd
*
ift
.
ducktape
(
expander
.
domain
,
None
,
names
[
1
])
Std
=
expander
@
(
ift
.
Adder
(
ift
.
full
(
expander
.
domain
,
stdmean
))
@
Std
).
exp
()
A
=
pd
@
(
Std
*
a
)
# For `vol` see comment in `CorrelatedField`
...
...
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