- class RGSpace(shape, distances=None, harmonic=False, _realdistances=None)#
Represents a regular Cartesian grid.
shape (int or tuple of int) – Number of grid points or numbers of gridpoints along each axis.
distances (None or float or tuple of float, optional) –
Distance between two grid points along each axis.
- By default (distances=None):
If harmonic==True, all distances will be set to 1
If harmonic==False, the distance along each axis will be set to the inverse of the number of points along that axis.
harmonic (bool, optional) – Whether the space represents a grid in position or harmonic space. Default: False.
Topologically, a n-dimensional RGSpace is a n-Torus, i.e. it has periodic boundary conditions.
Raises TypeError if codomain is not a matching partner domain for self.
- property distances#
Distance between grid points along each axis. The n-th entry of the tuple is the distance between neighboring grid points along the n-th dimension.
tuple of float
Creates a convolution kernel defined by a function.
Assumes the function to be radially symmetric, e.g. only dependant on distance.
func (function) – This function needs to take exactly one argument, which is distance from center (in the same units as the RGSpace distances), and return the kernel amplitude at that distance.
RGSpaceobject representing the (position or harmonic) partner domain of self, depending on self.harmonic.
The partner domain
- Return type:
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.
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.
A smoothing operation that multiplies values with a Gaussian kernel.
- Return type:
function (array-like -> array-like)
k vector lengths, if applicable.
Returns the length of the k vector for every pixel. This method is only implemented for harmonic domains.
An array containing the k vector lengths
- Return type:
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.
- 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.
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.
tuple of int
- property size#
total number of pixels.
Equivalent to the products over all entries in the domain’s shape.