lenspyx.lensing

See examples/demo_lenspyx.ipynb for example calls of this couple of routines

lenspyx.lensing.alm2lenmap(alm, dlms, geometry: tuple = ('healpix', {'nside': 2048}), epsilon=1e-07, verbose=0, nthreads: int = 0, pol=True)[source]

Computes lensed CMB maps from their alm’s and deflection field alm’s.

Parameters:
  • alm – undeflected map healpy alm array or sequence of arrays
  • dlms

    The spin-1 deflection, in the form of one or two arrays.

    The two arrays are the gradient and curl deflection healpy alms:

    \(\sqrt{L(L+1)}\phi_{LM}\) with \(\phi\) the lensing potential

    \(\sqrt{L(L+1)}\Omega_{LM}\) with \(\Omega\) the lensing curl potential

    The curl can be omitted if zero, resulting in principle in slightly faster transforms

  • geometry (optional) – sphere pixelization, tuple with geometry name and argument dictionary, defaults to Healpix with nside 2048
  • epsilon (optional) – target accuracy of the result (defaults to 1e-7)
  • verbose (optional) – If set, prints a bunch of timing and other info. Defaults to 0.
  • nthreads (optional) – number of threads to use (defaults to os.cpu_count())
  • pol – if True, input arrays are interpreted as T and E if there are two, T E B if there are 3, otherwise performs only spin-0 transforms.
Returns:

lensed maps, each an array of size given by the number of pixels of input geometry. T, Q, U if pol and there 2 or 3 input arrays, otherwise spin-0 maps

lenspyx.lensing.alm2lenmap_spin(gclm: numpy.ndarray, dlms: numpy.ndarray, spin: int, geometry: tuple = ('healpix', {'nside': 2048}), epsilon: float = 1e-07, verbose=0, nthreads: int = 0)[source]

Computes a deflected spin-weight lensed CMB map from its gradient and curl modes and deflection field alm.

Parameters:
  • gclm – undeflected map healpy gradient (and curl, if relevant) modes (e.g. polarization Elm and Blm).
  • dlms

    The spin-1 deflection, in the form of one or two arrays.

    The two arrays are the gradient and curl deflection healpy alms:

    \(\sqrt{L(L+1)}\phi_{LM}\) with \(\phi\) the lensing potential

    \(\sqrt{L(L+1)}\Omega_{LM}\) with \(\Omega\) the lensing curl potential

    The curl can be omitted if zero, resulting in principle in slightly faster transforms

  • spin (int >= 0) – spin-weight of the maps to deflect (e.g. 2 for polarization).
  • geometry (optional) – sphere pixelization, tuple with geometry name and argument dictionary, defaults to Healpix with nside 2048
  • epsilon (optional) – target accuracy of the result (defaults to 1e-7)
  • verbose (optional) – If set, prints a bunch of timing and other info. Defaults to 0.
  • nthreads (optional) – number of threads to use (defaults to os.cpu_count())
Returns:

lensed maps for input geometry (real and imaginary parts), arrays of size given by the number of pixels of input geometry

Note

If curl modes are zero (deflection and/or alm’s to lens), they can be omitted, which can result in slightly faster transforms

lenspyx.lensing.get_geom(geometry: tuple = ('healpix', {'nside': 2048}))[source]

Returns sphere pixelization geometry instance from name and arguments

Note

Custom geometries can be defined following lenspyx.remapping.utils_geom.Geom