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
10
Merge Requests
10
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
b247969a
Commit
b247969a
authored
Mar 01, 2019
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks
parent
e77b5d08
Pipeline
#44431
passed with stages
in 8 minutes and 35 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
26 deletions
+12
-26
nifty5/library/correlated_fields.py
nifty5/library/correlated_fields.py
+5
-11
nifty5/library/smooth_linear_amplitude.py
nifty5/library/smooth_linear_amplitude.py
+7
-15
No files found.
nifty5/library/correlated_fields.py
View file @
b247969a
...
...
@@ -24,13 +24,6 @@ from ..operators.distributors import PowerDistributor
from
..operators.harmonic_operators
import
HarmonicTransformOperator
from
..operators.simple_linear_operators
import
ducktape
# import numpy as np
# from ..operators.value_inserter import ValueInserter
# from ..operators.simple_linear_operators import FieldAdapter
# from ..operators.diagonal_operator import DiagonalOperator
# from ..sugar import from_global_data
# from ..library.inverse_gamma_operator import InverseGammaOperator
def
CorrelatedField
(
target
,
amplitude_operator
,
name
=
'xi'
,
codomain
=
None
):
"""Constructs an operator which turns a white Gaussian excitation field
...
...
@@ -81,7 +74,7 @@ def CorrelatedField(target, amplitude_operator, name='xi', codomain=None):
# 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,
# different resolutions and the same object in them.
return
ht
(
vol
*
(
A
)
*
ducktape
(
h_space
,
None
,
name
))
return
ht
(
vol
*
A
*
ducktape
(
h_space
,
None
,
name
))
def
MfCorrelatedField
(
target
,
amplitudes
,
name
=
'xi'
):
...
...
@@ -148,16 +141,17 @@ def MfPartiallyCorrelatedField(target, energy_amplitude, name='xi_u'):
into a correlated field defined on a DomainTuple with two entries.
On the first domain, a white correlation structure is assumed. On
the second domain, the correlation structures given by energy_amplitude
is
used.
are
used.
This operator may be used as a model for multi-frequency reconstructions
with correlation structure only in the energy direction.
Parameters
----------
target : Domain
, Domain
Tuple or tuple of Domain
target : DomainTuple or tuple of Domain
Target of the operator. Must contain exactly two spaces.
It is assumed that the second space is the energy domain.
It is assumed that the second space is the energy domain, so it must
be a one-dimensional RGSpace.
energy_amplitude: Operator
amplitude operator for the energy correlation structure
name : string
...
...
nifty5/library/smooth_linear_amplitude.py
View file @
b247969a
...
...
@@ -26,11 +26,7 @@ from ..operators.qht_operator import QHTOperator
from
..operators.slope_operator
import
SlopeOperator
from
..operators.symmetrizing_operator
import
SymmetrizingOperator
from
..sugar
import
makeOp
from
..library.inverse_gamma_operator
import
InverseGammaOperator
from
..sugar
import
from_global_data
from
..operators.diagonal_operator
import
DiagonalOperator
from
..operators.simple_linear_operators
import
FieldAdapter
from
..operators.value_inserter
import
ValueInserter
...
...
@@ -190,13 +186,11 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za=None, zq=None,
if
sv
<=
0
or
iv
<=
0
:
raise
ValueError
if
za
!=
None
and
zq
!=
None
:
separate_zero_mode_prior
=
True
separate_zero_mode_prior
=
za
is
not
None
and
zq
is
not
None
if
separate_zero_mode_prior
:
za
,
zq
=
float
(
za
),
float
(
zq
)
print
(
keys
[
2
]
+
" mean: "
,
(
zq
/
(
1
+
za
)))
else
:
separate_zero_mode_prior
=
False
if
za
!=
None
or
zq
!=
None
:
if
za
is
not
None
or
zq
is
not
None
:
raise
ValueError
(
"za and zq have to be given together"
)
et
=
ExpTransform
(
target
,
n_pix
)
...
...
@@ -221,14 +215,12 @@ def SLAmplitude(*, target, n_pix, a, k0, sm, sv, im, iv, za=None, zq=None,
# Go from loglog-space to linear-linear-space
return
et
@
loglog_ampl
.
exp
()
else
:
zero_mode
=
ValueInserter
(
et
.
target
,
(
0
,)
*
len
(
et
.
target
.
shape
))
zero_mode
=
zero_mode
@
InverseGammaOperator
(
zero_mode
.
domain
,
za
,
zq
)
@
FieldAdapter
(
zero_mode
.
domain
,
keys
[
2
])
zero_mode
=
(
ValueInserter
(
et
.
target
,
(
0
,)
*
len
(
et
.
target
.
shape
))
@
InverseGammaOperator
(
zero_mode
.
domain
,
za
,
zq
).
ducktape
(
keys
[
2
]))
mask
=
np
.
ones
(
et
.
target
.
shape
)
mask
[(
0
,)
*
len
(
et
.
target
.
shape
)]
=
0.
mask
=
from_global_data
(
et
.
target
,
mask
)
mask
=
DiagonalOperator
(
mask
)
mask
=
makeOp
(
Field
.
from_global_data
(
et
.
target
,
mask
))
return
mask
@
et
@
loglog_ampl
.
exp
()
+
zero_mode
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