nifty8.operators.harmonic_operators module#
- class FFTOperator(domain, target=None, space=None)[source]#
Bases:
LinearOperator
Transforms between a pair of position and harmonic RGSpaces.
- Parameters:
domain (Domain, tuple of Domain or DomainTuple) – The domain of the data that is input by “times” and output by “adjoint_times”.
target (Domain, optional) – The target (sub-)domain of the transform operation. If omitted, a domain will be chosen automatically.
space (int, optional) – The index of the subdomain on which the operator should act If None, it is set to 0 if domain contains exactly one space. domain[space] must be an RGSpace.
Notes
This operator performs full FFTs, which implies that its output field will always have complex type, regardless of the type of the input field. If a real field is desired after a forward/backward transform couple, it must be manually cast to real.
- apply(x, mode)[source]#
Applies the Operator to a given x, in a specified mode.
- Parameters:
x (
nifty8.field.Field
) – The input Field, defined on the Operator’s domain or target, depending on mode.mode (int) –
TIMES
: normal applicationADJOINT_TIMES
: adjoint applicationINVERSE_TIMES
: inverse applicationADJOINT_INVERSE_TIMES
orINVERSE_ADJOINT_TIMES
: adjoint inverse application
- Returns:
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type:
- HarmonicSmoothingOperator(domain, sigma, space=None)[source]#
Returns an operator that carries out a smoothing with a Gaussian kernel of width sigma on the part of domain given by space.
- Parameters:
domain (Domain, tuple of Domain, or DomainTuple) – The total domain of the operator’s input and output fields
sigma (float>=0) – The sigma of the Gaussian used for smoothing. It has the same units as the RGSpace the operator is working on. If sigma==0, an identity operator will be returned.
space (int, optional) – The index of the sub-domain on which the smoothing is performed. Can be omitted if domain only has one sub-domain.
Notes
The sub-domain on which the smoothing is carried out must be a non-harmonic RGSpace.
- class HarmonicTransformOperator(domain, target=None, space=None)[source]#
Bases:
LinearOperator
Transforms between a harmonic domain and a position domain counterpart.
- Built-in domain pairs are
a harmonic and a non-harmonic RGSpace (with matching distances)
an LMSpace and a HPSpace
an LMSpace and a GLSpace
The supported operations are times() and adjoint_times(). If inverse_times() on RGSpaces is needed the HartleyOperator should be used instead.
- Parameters:
domain (Domain, tuple of Domain or DomainTuple) – The domain of the data that is input by “times” and output by “adjoint_times”.
target (Domain, optional) – The target domain of the transform operation. If omitted, a domain will be chosen automatically. Whenever the input domain of the transform is an RGSpace, the codomain (and its parameters) are uniquely determined. For LMSpace, a GLSpace of sufficient resolution is chosen.
space (int, optional) – The index of the domain on which the operator should act If None, it is set to 0 if domain contains exactly one subdomain. domain[space] must be a harmonic domain.
Notes
HarmonicTransformOperator uses a Hartley transformation to transform between harmonic and non-harmonic RGSpaces. This has the advantage that all field values are real in either space. If you require a true Fourier transform you should use FFTOperator instead.
- apply(x, mode)[source]#
Applies the Operator to a given x, in a specified mode.
- Parameters:
x (
nifty8.field.Field
) – The input Field, defined on the Operator’s domain or target, depending on mode.mode (int) –
TIMES
: normal applicationADJOINT_TIMES
: adjoint applicationINVERSE_TIMES
: inverse applicationADJOINT_INVERSE_TIMES
orINVERSE_ADJOINT_TIMES
: adjoint inverse application
- Returns:
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type:
- class HartleyOperator(domain, target=None, space=None)[source]#
Bases:
LinearOperator
Transforms between a pair of position and harmonic RGSpaces.
- Parameters:
domain (Domain, tuple of Domain or DomainTuple) – The domain of the data that is input by “times” and output by “adjoint_times”.
target (Domain, optional) – The target (sub-)domain of the transform operation. If omitted, a domain will be chosen automatically.
space (int, optional) – The index of the subdomain on which the operator should act If None, it is set to 0 if domain contains exactly one space. domain[space] must be an RGSpace.
Notes
This operator always produces output fields with the same data type as its input. This is achieved by performing so-called Hartley transforms (https://en.wikipedia.org/wiki/Discrete_Hartley_transform). For complex input fields, the operator will transform the real and imaginary parts separately and use the results as real and imaginary parts of the result field, respectively. In many contexts the Hartley transform is a perfect substitute for the Fourier transform, but in some situations (e.g. convolution with a general, non-symmetric kernel, the full FFT must be used instead.
- apply(x, mode)[source]#
Applies the Operator to a given x, in a specified mode.
- Parameters:
x (
nifty8.field.Field
) – The input Field, defined on the Operator’s domain or target, depending on mode.mode (int) –
TIMES
: normal applicationADJOINT_TIMES
: adjoint applicationINVERSE_TIMES
: inverse applicationADJOINT_INVERSE_TIMES
orINVERSE_ADJOINT_TIMES
: adjoint inverse application
- Returns:
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type:
- class SHTOperator(domain, target=None, space=None)[source]#
Bases:
LinearOperator
Transforms between a harmonic domain on the sphere and a position domain counterpart.
- Built-in domain pairs are
an LMSpace and a HPSpace
an LMSpace and a GLSpace
The supported operations are times() and adjoint_times().
- Parameters:
domain (Domain, tuple of Domain or DomainTuple) – The domain of the data that is input by “times” and output by “adjoint_times”.
target (Domain, optional) – The target domain of the transform operation. If omitted, a domain will be chosen automatically. Whenever the input domain of the transform is an RGSpace, the codomain (and its parameters) are uniquely determined. For LMSpace, a GLSpace of sufficient resolution is chosen.
space (int, optional) – The index of the domain on which the operator should act If None, it is set to 0 if domain contains exactly one subdomain. domain[space] must be a LMSpace.
- apply(x, mode)[source]#
Applies the Operator to a given x, in a specified mode.
- Parameters:
x (
nifty8.field.Field
) – The input Field, defined on the Operator’s domain or target, depending on mode.mode (int) –
TIMES
: normal applicationADJOINT_TIMES
: adjoint applicationINVERSE_TIMES
: inverse applicationADJOINT_INVERSE_TIMES
orINVERSE_ADJOINT_TIMES
: adjoint inverse application
- Returns:
The processed Field defined on the Operator’s target or domain, depending on mode.
- Return type: