nifty8.domains.power_space module#
- class PowerSpace(harmonic_partner, binbounds=None)[source]#
Bases:
StructuredDomain
Represents non-equidistantly binned spaces for power spectra.
A power space is the result of a projection of a harmonic domain where k-modes of equal length get mapped to one power index.
- Parameters:
harmonic_partner (StructuredDomain) – The harmonic domain of which this is the power space.
binbounds (None, or tuple of float) –
- By default (binbounds=None):
There are as many bins as there are distinct k-vector lengths in the harmonic partner space. The binbounds property of the PowerSpace will be None.
- else:
The bin bounds requested for this PowerSpace. The array must be sorted and strictly ascending. The first entry is the right boundary of the first bin, and the last entry is the left boundary of the last bin, i.e. there will be len(binbounds)+1 bins in total, with the first and last bins reaching to -+infinity, respectively.
- property binbounds#
inner bin boundaries
The boundaries between bins, starting with the right boundary of the first bin, up to the left boundary of the last bin.
None is used to indicate natural binning.
- Type:
None or tuple of float
- property dvol#
pixel volume(s)
Returns the volume factors of this domain, either as a floating point scalar (if the volume factors are all identical) or as a floating point array with a shape of self.shape.
- Type:
float or numpy.ndarray(dtype=float)
- property harmonic#
Always False for this class.
- Type:
bool
- property harmonic_partner#
the harmonic domain associated with self.
- Type:
- property k_lengths#
k-vector length for each bin.
- Type:
numpy.ndarray(float)
- static linear_binbounds(nbin, first_bound, last_bound)[source]#
Produces linearly spaced bin bounds.
- Parameters:
nbin (int) – the number of bins
first_bound (float) – the k values for the right boundary of the first bin and the left boundary of the last bin, respectively. They are given in length units of the harmonic partner space.
last_bound (float) – the k values for the right boundary of the first bin and the left boundary of the last bin, respectively. They are given in length units of the harmonic partner space.
- Returns:
binbounds array with nbin-1 entries with binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining values equidistantly spaced (in linear scale) between these two.
- Return type:
numpy.ndarray(numpy.float64)
- static logarithmic_binbounds(nbin, first_bound, last_bound)[source]#
Produces logarithmically spaced bin bounds.
- Parameters:
nbin (int) – the number of bins
first_bound (float) – the k values for the right boundary of the first bin and the left boundary of the last bin, respectively. They are given in length units of the harmonic partner space.
last_bound (float) – the k values for the right boundary of the first bin and the left boundary of the last bin, respectively. They are given in length units of the harmonic partner space.
- Returns:
binbounds array with nbin-1 entries with binbounds[0]=first_bound and binbounds[-1]=last_bound and the remaining values equidistantly spaced (in natural logarithmic scale) between these two.
- Return type:
numpy.ndarray(numpy.float64)
- property pindex#
bin indices
Bin index for every pixel in the harmonic partner.
- Type:
- 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
- static useful_binbounds(space, logarithmic, nbin=None)[source]#
Produces bin bounds suitable for a given domain.
- Parameters:
space (StructuredDomain) – the domain for which the binbounds will be computed.
logarithmic (bool) – If True bins will have equal size in linear space; otherwise they will have equal size in logarithmic space.
nbin (int, optional) – the number of bins If None, the highest possible number of bins will be used
- Returns:
Binbounds array with nbin-1 entries, if nbin is supplied, or the maximum number of entries that does not produce empty bins, if nbin is not supplied. The first and last bin boundary are inferred from space.
- Return type:
numpy.ndarray(numpy.float64)