Commit a054240a authored by Philipp Frank's avatar Philipp Frank

docs

parent 15eec065
...@@ -34,7 +34,7 @@ def _float_or_listoffloat(inp): ...@@ -34,7 +34,7 @@ def _float_or_listoffloat(inp):
return [float(x) for x in inp] if isinstance(inp, list) else float(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, harmonic_padding,
sm_s0, sm_s0,
sm_x0, sm_x0,
...@@ -44,8 +44,10 @@ def _make_dynamic_operator(domain, ...@@ -44,8 +44,10 @@ def _make_dynamic_operator(domain,
minimum_phase, minimum_phase,
sigc=None, sigc=None,
quant=None): quant=None):
if not isinstance(domain, RGSpace): if not isinstance(target, RGSpace):
raise TypeError("RGSpace required") 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 if not (isinstance(harmonic_padding, int) or harmonic_padding is None
or all(isinstance(ii, int) for ii in harmonic_padding)): or all(isinstance(ii, int) for ii in harmonic_padding)):
raise TypeError raise TypeError
...@@ -62,7 +64,7 @@ def _make_dynamic_operator(domain, ...@@ -62,7 +64,7 @@ def _make_dynamic_operator(domain,
if cone and (sigc is None or quant is None): if cone and (sigc is None or quant is None):
raise RuntimeError raise RuntimeError
dom = DomainTuple.make(domain) dom = DomainTuple.make(target.get_default_codomain())
ops = {} ops = {}
FFT = FFTOperator(dom) FFT = FFTOperator(dom)
Real = Realizer(dom) Real = Realizer(dom)
...@@ -134,7 +136,8 @@ def _make_dynamic_operator(domain, ...@@ -134,7 +136,8 @@ def _make_dynamic_operator(domain,
return m, ops return m, ops
def dynamic_operator(domain, def dynamic_operator(*,
target,
harmonic_padding, harmonic_padding,
sm_s0, sm_s0,
sm_x0, sm_x0,
...@@ -143,11 +146,22 @@ def dynamic_operator(domain, ...@@ -143,11 +146,22 @@ def dynamic_operator(domain,
minimum_phase=False): minimum_phase=False):
'''Constructs an operator encoding the Green's function of a linear '''Constructs an operator encoding the Green's function of a linear
homogeneous dynamic system. 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 Parameters
---------- ----------
domain : RGSpace target : RGSpace
The position space in which the Green's function shall be constructed. The harmonic space in which the Green's function shall be constructed.
harmonic_padding : None, int, list of int harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the Amount of central padding in harmonic space in pixels. If None the
field is not padded at all. field is not padded at all.
...@@ -159,13 +173,15 @@ def dynamic_operator(domain, ...@@ -159,13 +173,15 @@ def dynamic_operator(domain,
key for dynamics encoding parameter. key for dynamics encoding parameter.
causal : boolean causal : boolean
Whether or not the Green's function shall be causal in time. Whether or not the Green's function shall be causal in time.
Default is True.
minimum_phase: boolean minimum_phase: boolean
Whether or not the Green's function shall be a minimum phase filter. Whether or not the Green's function shall be a minimum phase filter.
Default is False.
Returns Returns
------- -------
Operator Operator
The Operator encoding the dynamic Green's function in harmonic space. The Operator encoding the dynamic Green's function in target space.
Dictionary of Operator Dictionary of Operator
A collection of sub-chains of Operator which can be used for plotting A collection of sub-chains of Operator which can be used for plotting
and evaluation. and evaluation.
...@@ -175,7 +191,7 @@ def dynamic_operator(domain, ...@@ -175,7 +191,7 @@ def dynamic_operator(domain,
The first axis of the domain is interpreted the time axis. The first axis of the domain is interpreted the time axis.
''' '''
dct = { dct = {
'domain': domain, 'target': target,
'harmonic_padding': harmonic_padding, 'harmonic_padding': harmonic_padding,
'sm_s0': sm_s0, 'sm_s0': sm_s0,
'sm_x0': sm_x0, 'sm_x0': sm_x0,
...@@ -187,7 +203,8 @@ def dynamic_operator(domain, ...@@ -187,7 +203,8 @@ def dynamic_operator(domain,
return _make_dynamic_operator(**dct) return _make_dynamic_operator(**dct)
def dynamic_lightcone_operator(domain, def dynamic_lightcone_operator(*,
target,
harmonic_padding, harmonic_padding,
sm_s0, sm_s0,
sm_x0, sm_x0,
...@@ -199,11 +216,16 @@ def dynamic_lightcone_operator(domain, ...@@ -199,11 +216,16 @@ def dynamic_lightcone_operator(domain,
minimum_phase=False): minimum_phase=False):
'''Extends the functionality of :function: dynamic_operator to a Green's '''Extends the functionality of :function: dynamic_operator to a Green's
function which is constrained to be within a light cone. 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 Parameters
---------- ----------
domain : RGSpace target : RGSpace
The position space in which the Green's function shall be constructed. The harmonic space in which the Green's function shall be constructed.
It needs to have at least two dimensions. It needs to have at least two dimensions.
harmonic_padding : None, int, list of int harmonic_padding : None, int, list of int
Amount of central padding in harmonic space in pixels. If None the Amount of central padding in harmonic space in pixels. If None the
...@@ -222,8 +244,10 @@ def dynamic_lightcone_operator(domain, ...@@ -222,8 +244,10 @@ def dynamic_lightcone_operator(domain,
Quantization of the light cone in pixels. Quantization of the light cone in pixels.
causal : boolean causal : boolean
Whether or not the Green's function shall be causal in time. Whether or not the Green's function shall be causal in time.
Default is True.
minimum_phase: boolean minimum_phase: boolean
Whether or not the Green's function shall be a minimum phase filter. Whether or not the Green's function shall be a minimum phase filter.
Default is False.
Returns Returns
------- -------
...@@ -238,10 +262,10 @@ def dynamic_lightcone_operator(domain, ...@@ -238,10 +262,10 @@ def dynamic_lightcone_operator(domain,
The first axis of the domain is interpreted the time axis. 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!") raise ValueError("Space must be at least 2 dimensional!")
dct = { dct = {
'domain': domain, 'target': target,
'harmonic_padding': harmonic_padding, 'harmonic_padding': harmonic_padding,
'sm_s0': sm_s0, 'sm_s0': sm_s0,
'sm_x0': sm_x0, 'sm_x0': sm_x0,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment