healpix_analyse.alm#

Attributes#

Classes#

AlmCoeffs

Container for local complex spherical harmonic coefficients.

AlmTransform

Local FFT-oriented spherical harmonic transform on a HEALPix patch.

Module Contents#

healpix_analyse.alm.ArrayLike#
class healpix_analyse.alm.AlmCoeffs[source]#

Container for local complex spherical harmonic coefficients.

Parameters:
  • alm (torch.Tensor) – Complex coefficient tensor with shape [K] or [B, K].

  • l (torch.Tensor) – Degree indices with shape [K].

  • m (torch.Tensor) – Order indices with shape [K]. Only m >= 0 is stored in V1.

  • meta (dict) – Metadata associated with the transform.

alm: torch.Tensor#
l: torch.Tensor#
m: torch.Tensor#
meta: Dict[str, Any]#
property n_modes: int#
property is_batched: bool#
clone() → AlmCoeffs[source]#
to(device: str | torch.device | None = None, dtype: torch.dtype | None = None) → AlmCoeffs[source]#
cpu() → AlmCoeffs[source]#
cuda() → AlmCoeffs[source]#
class healpix_analyse.alm.AlmTransform(cell_ids: ArrayLike, level: int, indexing_scheme: str = '2D_array', ellipsoid: str = 'sphere', method: str = 'fft', dtype: torch.dtype = torch.float32, device: str | torch.device | None = None, debug: bool = False, lon: numpy.ndarray = None, lat: numpy.ndarray = None, weights: numpy.array = None)[source]#

Local FFT-oriented spherical harmonic transform on a HEALPix patch.

This implementation follows a two-stage local solver:

  1. local Fourier analysis on each observed iso-latitude ring,

  2. local Legendre analysis over the observed ring colatitudes.

The design avoids explicit dense Y_lm evaluation over all pixels. It is intended as a practical starting point for large local patches and keeps only m >= 0 coefficients.

Parameters:
  • level (int) – HEALPix level such that nside = 2**level.

  • cell_ids (array-like) – HEALPix cell identifiers at the given level.

  • indexing_scheme (str, default "ring") – The indexing scheme for the cell IDs.

  • ellipsoid ({"sphere", "WGS84"}, default "sphere") – Geometry model.

  • method ({"fft", "alm"}, default "fft", Alm approximation, alm option under development.) – Analysis mode used in the Legendre stage.

  • dtype (torch.dtype, default torch.float32) – Real dtype for maps and geometry.

  • device (str or torch.device, optional) – Execution device. If None, uses CUDA when available, else CPU.

  • debug (bool, default False) – Whether to store diagnostic timing information.

Notes

Current assumptions: - all input cells are at the same HEALPix level, - reconstruction is only performed on the same input cells, - input maps are real-valued.

level#
indexing_scheme = ''#
ellipsoid = ''#
method = ''#
dtype = Ellipsis#
cdtype = Ellipsis#
device#
debug = False#
cell_ids#
pixel_shift#
phase_shift#
compute_phase_shift(x0, dim=-1)[source]#

Applique un décalage spatial x0 à un signal via sa FFT déjà calculée.

Parameters:
  • x0 (float or torch.Tensor) – Décalage à appliquer dans l’espace réel. Convention: f(x - x0) <-> F(k) * exp(-i 2π k x0)

  • dim (int) – Dimension correspondant à la FFT 1D.

Returns:

torch.Tensor – Facteur de phase.

fft(data_: ArrayLike, pbc: bool = True) → ArrayLike[source]#
abstractmethod ifft(data: ArrayLike) → ArrayLike[source]#

Reconstruct a map on the same local HEALPix cells.

Not implemented yet. The inverse needs the Legendre-projection stage that fft() does not currently compute (see the TODO next to its second FFT stage), and relies on ring bookkeeping (self.n_rings, self.idx_ring, self.weights, self.xa, self.N_k) that __init__ does not currently set. Rather than fail on a missing attribute or silently return a wrong map, this raises explicitly until that work lands.