Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ift
NIFTy
Commits
a054240a
Commit
a054240a
authored
Jan 16, 2019
by
Philipp Frank
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs
parent
15eec065
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
13 deletions
+37
-13
nifty5/library/dynamic_operator.py
nifty5/library/dynamic_operator.py
+37
-13
No files found.
nifty5/library/dynamic_operator.py
View file @
a054240a
...
...
@@ -34,7 +34,7 @@ def _float_or_listoffloat(inp):
return
[
float
(
x
)
for
x
in
inp
]
if
isinstance
(
inp
,
list
)
else
float
(
inp
)
def
_make_dynamic_operator
(
domain
,
def
_make_dynamic_operator
(
target
,
harmonic_padding
,
sm_s0
,
sm_x0
,
...
...
@@ -44,8 +44,10 @@ def _make_dynamic_operator(domain,
minimum_phase
,
sigc
=
None
,
quant
=
None
):
if
not
isinstance
(
domain
,
RGSpace
):
if
not
isinstance
(
target
,
RGSpace
):
raise
TypeError
(
"RGSpace required"
)
if
not
target
.
harmonic
:
raise
TypeError
(
"Target space must be harmonic"
)
if
not
(
isinstance
(
harmonic_padding
,
int
)
or
harmonic_padding
is
None
or
all
(
isinstance
(
ii
,
int
)
for
ii
in
harmonic_padding
)):
raise
TypeError
...
...
@@ -62,7 +64,7 @@ def _make_dynamic_operator(domain,
if
cone
and
(
sigc
is
None
or
quant
is
None
):
raise
RuntimeError
dom
=
DomainTuple
.
make
(
domain
)
dom
=
DomainTuple
.
make
(
target
.
get_default_co
domain
()
)
ops
=
{}
FFT
=
FFTOperator
(
dom
)
Real
=
Realizer
(
dom
)
...
...
@@ -134,7 +136,8 @@ def _make_dynamic_operator(domain,
return
m
,
ops
def
dynamic_operator
(
domain
,
def
dynamic_operator
(
*
,
target
,
harmonic_padding
,
sm_s0
,
sm_x0
,
...
...
@@ -143,11 +146,22 @@ def dynamic_operator(domain,
minimum_phase
=
False
):
'''Constructs an operator encoding the Green's function of a linear
homogeneous dynamic system.
When evaluated, this operator returns the Green's function representation
in harmonic space. This result can be used as a convolution kernel to
construct solutions of the homogeneous stochastic differential equation
encoded in this operator. Note that if causal is True, the Green's function
is convolved with a step function in time, where the temporal axis is the
first axis of the space. In this case the resulting function only extends
up to half the length of the first axis of the space to avoid boundary
effects during convolution. If minimum_phase is true then the spectrum of
the Green's function is used to construct a corresponding minimum phase
filter.
Parameters
----------
domain
: RGSpace
The
position
space in which the Green's function shall be constructed.
target
: RGSpace
The
harmonic
space in which the Green's function shall be constructed.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
field is not padded at all.
...
...
@@ -159,13 +173,15 @@ def dynamic_operator(domain,
key for dynamics encoding parameter.
causal : boolean
Whether or not the Green's function shall be causal in time.
Default is True.
minimum_phase: boolean
Whether or not the Green's function shall be a minimum phase filter.
Default is False.
Returns
-------
Operator
The Operator encoding the dynamic Green's function in
h
ar
monic
space.
The Operator encoding the dynamic Green's function in
t
ar
get
space.
Dictionary of Operator
A collection of sub-chains of Operator which can be used for plotting
and evaluation.
...
...
@@ -175,7 +191,7 @@ def dynamic_operator(domain,
The first axis of the domain is interpreted the time axis.
'''
dct
=
{
'
domain'
:
domain
,
'
target'
:
target
,
'harmonic_padding'
:
harmonic_padding
,
'sm_s0'
:
sm_s0
,
'sm_x0'
:
sm_x0
,
...
...
@@ -187,7 +203,8 @@ def dynamic_operator(domain,
return
_make_dynamic_operator
(
**
dct
)
def
dynamic_lightcone_operator
(
domain
,
def
dynamic_lightcone_operator
(
*
,
target
,
harmonic_padding
,
sm_s0
,
sm_x0
,
...
...
@@ -199,11 +216,16 @@ def dynamic_lightcone_operator(domain,
minimum_phase
=
False
):
'''Extends the functionality of :function: dynamic_operator to a Green's
function which is constrained to be within a light cone.
The resulting Green's function is constrained to be within a light cone.
This is achieved via convolution of the function with a light cone in
space-time. Thereby the first axis of the space is set to be the teporal
axis.
Parameters
----------
domain
: RGSpace
The
position
space in which the Green's function shall be constructed.
target
: RGSpace
The
harmonic
space in which the Green's function shall be constructed.
It needs to have at least two dimensions.
harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the
...
...
@@ -222,8 +244,10 @@ def dynamic_lightcone_operator(domain,
Quantization of the light cone in pixels.
causal : boolean
Whether or not the Green's function shall be causal in time.
Default is True.
minimum_phase: boolean
Whether or not the Green's function shall be a minimum phase filter.
Default is False.
Returns
-------
...
...
@@ -238,10 +262,10 @@ def dynamic_lightcone_operator(domain,
The first axis of the domain is interpreted the time axis.
'''
if
len
(
domain
.
shape
)
<
2
:
if
len
(
target
.
shape
)
<
2
:
raise
ValueError
(
"Space must be at least 2 dimensional!"
)
dct
=
{
'
domain'
:
domain
,
'
target'
:
target
,
'harmonic_padding'
:
harmonic_padding
,
'sm_s0'
:
sm_s0
,
'sm_x0'
:
sm_x0
,
...
...
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