Commit c5494e13 authored by Theo Steininger's avatar Theo Steininger
Browse files

Merge branch 'master' into 'spherical_plots'


See merge request !136
parents 7de910e8 aa21eae3
Pipeline #12813 passed with stage
in 4 minutes and 30 seconds
......@@ -218,7 +218,7 @@ class Field(Loggable, Versionable, object):
See Also
......@@ -270,12 +270,13 @@ class Field(Loggable, Versionable, object):
def power_analyze(self, spaces=None, logarithmic=False, nbin=None,
binbounds=None, decompose_power=True):
""" Computes the powerspectrum for a subspace of the Field.
""" Computes the square root power spectrum for a subspace of `self`.
Creates a PowerSpace for the space addressed by `spaces` with the given
binning and computes the power spectrum as a Field over this
PowerSpace. This can only be done if the subspace to be analyzed is a
harmonic space.
harmonic space. The resulting field has the same units as the initial
field, corresponding to the square root of the power spectrum.
......@@ -456,14 +457,10 @@ class Field(Loggable, Versionable, object):
def power_synthesize(self, spaces=None, real_power=True, real_signal=True,
mean=None, std=None):
""" Converts a power spectrum into a random field realization.
""" Yields a sampled field with `self`**2 as its power spectrum.
This method draws a Gaussian random field in the harmic partner domain
of a PowerSpace.
For this the spaces specified by `spaces` must be a PowerSpaces.
This method draws a Gaussian random field in the harmonic partner
domain of this fields domains, using this field as power spectrum.
......@@ -484,7 +481,6 @@ class Field(Loggable, Versionable, object):
std : float *optional*
The standard deviation of the Gaussian noise field which is used
for the Field synthetization (default : None).
{default : None}
if std==None : std will be set to 1
......@@ -493,10 +489,20 @@ class Field(Loggable, Versionable, object):
The output object. A random field created with the power spectrum
stored in the `spaces` in `self`.
For this the spaces specified by `spaces` must be a PowerSpace.
This expects this field to be the square root of a power spectrum, i.e.
to have the unit of the field to be sampled.
See Also
ValueError : If domain specified by `spaces` is not a PowerSpace.
# check if the `spaces` input is valid
......@@ -26,6 +26,34 @@ __all__ = ['create_power_operator']
def create_power_operator(domain, power_spectrum, dtype=None,
""" Creates a diagonal operator with the given power spectrum.
Constructs a diagonal operator that lives over the specified domain, or
its default harmonic codomain in case it is not harmonic.
domain : DomainObject
Domain over which the power operator shall live. If this is not a
harmonic domain, it will return an operator for its harmonic codomain
power_spectrum : (array-like, method)
An array-like object, or a method that implements the square root
of a power spectrum as a function of k.
dtype : type *optional*
dtype that the field holding the power spectrum shall use
(default : None).
if dtype == None: the dtype of `power_spectrum` will be used.
distribution_strategy : string *optional*
Distributed strategy to be used by the underlying d2o objects.
(default : 'not')
DiagonalOperator : An operator that implements the given power spectrum.
if not domain.harmonic:
fft = FFTOperator(domain)
domain =[0]
Supports Markdown
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