nifty7.domains.lm_space module

class LMSpace(lmax, mmax=None)[source]

Bases: nifty7.domains.structured_domain.StructuredDomain

Represents a set of spherical harmonic coefficients.

Its harmonic partner spaces are HPSpace and GLSpace.

Parameters
  • lmax (int) – The maximum l value of any spherical harmonic coefficient a_{lm} that is represented by this object. Must be \ge 0.

  • mmax (int, optional) – The maximum m value of any spherical harmonic coefficient a_{lm} that is represented by this object. If not supplied, it is set to lmax. Must be \ge 0 and \le lmax.

__repr__()[source]

Return repr(self).

check_codomain(codomain)[source]

Raises TypeError if codomain is not a matching partner domain for self.

Notes

This function only checks whether codomain is of type GLSpace or HPSpace.

get_conv_kernel_from_func(func)[source]

Creates a convolution kernel defined by a function.

Assumes the function to be radially symmetric, e.g. only dependant on theta in radians.

Parameters

func (function) – This function needs to take exactly one argument, which is colatitude in radians, and return the kernel amplitude at that colatitude.

get_default_codomain()[source]

Returns a GLSpace object, which is capable of storing an accurate representation of data residing on self.

Returns

The partner domain

Return type

GLSpace

get_fft_smoothing_kernel_function(sigma)[source]

Helper for Gaussian smoothing.

This method, which is only implemented for harmonic domains, helps to smoothe fields that are defined on a domain that has this domain as its harmonic partner. The returned function does a pointwise evaluation of a zero-centered Gaussian on the field values, which corresponds to a convolution with a Gaussian kernel with sigma standard deviation in position space.

Parameters

sigma (float) – A real number representing a physical scale on which the smoothing takes place. Mathematically sigma is the standard deviation of a convolution with a normalized, zero-centered Gaussian that takes place in position space.

Returns

A smoothing operation that multiplies values with a Gaussian kernel.

Return type

function (array-like -> array-like)

get_k_length_array()[source]

k vector lengths, if applicable.

Returns the length of the k vector for every pixel. This method is only implemented for harmonic domains.

Returns

An array containing the k vector lengths

Return type

Field

get_unique_k_lengths()[source]

Sorted unique k-vector lengths, if applicable.

Returns an array of floats containing the unique k vector lengths for this domain. This method is only implemented for harmonic domains.

property harmonic

True iff this domain is a harmonic domain.

Type

bool

property lmax

maximum allowed l

The maximum l value of any spherical harmonic coefficient a_{lm} that is represented in this domain.

Type

int

property mmax

maximum allowed m

The maximum m value of any spherical harmonic coefficient a_{lm} that is represented in this domain.

Type

int

property scalar_dvol

uniform pixel volume, if applicable

Returns the volume factors of this domain as a floating point scalar, if the volume factors are all identical, otherwise returns None.

Type

float or None

property shape

number of pixels along each axis

The shape of the array-like object required to store information defined on the domain.

Type

tuple of int

property size

total number of pixels.

Equivalent to the products over all entries in the domain’s shape.

Type

int