lensit.ffs_covs.ell_mat

class lensit.ffs_covs.ell_mat.ell_mat(lib_dir, shape, lsides, cache=1)[source]

Library helping with flat-sky patch discretization and harmonic mode structure.

This handles Fourier mode structure on the flat sky, at the given resolution and size of specified rectangular box.

Parameters:
  • lib_dir – various things might be cached there (unlens cache is set to 0, in which case only a hashdict is put there at instantiation)
  • shape (2-tuple) – pair of int defining the number of pixels on each side of the box
  • lsides (2-tuple) – physical size (in radians) of the box sides
  • cache (optional) – if non-zero, a bunch of matrices might be cached to speed up some calculations.
alm2rfftmap(alm, filt_func=<function ell_mat.<lambda>>)[source]

Returns a ffs_alm array from a rfftmap.

Pseudo-inverse to fftmap2alm

bin_inell(rfftmap)[source]

Bin in a rfftmap according to multipole \(\ell\)

Input must have the same shape then self.rshape

degrade(LDshape, lib_dir=None)[source]

Returns an ell_mat instance on the same physical flat-sky patch but a degraded sampling resolution

get_Nell()[source]

Mode number counts on the flat-sky patch.

Goes roughly like \(2\ell + 1\)

get_cossin_2iphi_mat()[source]
Returns:\(\cos(2i\phi), \sin(2i\phi)\) as rfft arrays
get_e2iphi_mat(cache_only=False)[source]

Returns the matrix containing the phase \(e^{2 i \phi}\)

get_ellmat(ellmax=None)[source]

Returns the matrix containing the multipole ell assigned to 2d-frequency \(k = (k_x,k_y)\)

get_phasemat(ellmax=None)[source]

Returns the rfft array containing the phase \(\phi\) where 2d-frequencies are \(k = |k| e^{i \phi}\)

get_pixwinmat()[source]

Pixel window function rfft array \(\sin(k_x l_{\rm cell, x} / 2) \sin (k_y l_{\rm cell, y} / 2 )\)

get_unique_ells(return_index=False, return_inverse=False, return_counts=False)[source]

Returns list of multipoles \(\ell\) present in the flat-sky patch

static k2ell(k)[source]

Mapping of 2d-frequency \(k\) to multipole \(\ell\)

\(\ell = \rm{int}\left(|k| - \frac 12 \right)\)

map2cl(m, m2=None)[source]

Returns s pseudo-\(C_\ell\) estimate from a map.

Returns a cross-\(C_\ell\) if m2 is set. Must have compatible shape.

rfft2_reals()[source]

Pure reals modes in 2d rfft according to patch specifics

rfftmap2alm(rfftmap, filt_func=<function ell_mat.<lambda>>)[source]

Turns a rfft map to ffs_alm array.

This performs the filtering defined by the instance together with the normalization

class lensit.ffs_covs.ell_mat.ffs_alm(ellmat, filt_func=<function ffs_alm.<lambda>>, kxfilt_func=None, kyfilt_func=None)[source]

Library to facilitate operations on flat-sky alms in the ffs scheme.

Methods includes alm2map and map2alm, among other things. The instance contains info on the sky patch size and discretization.

Parameters:
  • ellmatlensit.ffs_covs.ell_mat.ell_mat instance carrying flat-sky patch definitions
  • filt_func (callable, optional) – mutlipole filtering. Set this to discard multipoles in map2alm Defaults to lambda ell : ell > 0
  • kxfilt_func (callable, optional) – filtering on x-component of the 2d-frequencies
  • kyfilt_func (callable, optional) – filtering on y-component of the 2d-frequencies
EBlms2QUalms(EBlms)[source]

Turns EB alms list into QU alms.

QUlms2EBalms(QUlms)[source]

Turns QU alms list into EB alms.

TEBlms2TQUalms(TEBlms)[source]

Turns TEB alms list into TQU alms.

TQUlms2TEBalms(TQUlms)[source]

Turns TQU alms list into TEB alms.

alm2Pk_minimal(alm)[source]

Power spectrum estimation on the grid, with minimal binning (only exact same frequencies).

Many bins will have only number count 4 or something.

Returns:list with integer array of squared frequencies, integer array number counts, and Pk estimates. (only non zero counts frequencies)
alm2cl(alm, alm2=None, ellmax=None)[source]

Returns power spectrum of alm array

alm2map(alm, lib_almout=None)[source]

Returns position-space map from alm array

almxfl(alm, fl, inplace=False)[source]

Multiply :flat-sky math:a_{ell lm} array with isotropic function \(f_\ell\)

bicubic_prefilter(alm)[source]

Refilter the map for use in bicubic spline prefiltering.

Mostly useful for lensing of maps.

bin_realpart_inell(alm, ellmax=None)[source]

Bin real part of a rfftmap according to multipole \(\ell\)

Input must have the same shape then self.rshape

get_Nell()[source]

Mode number counts on the flat-sky patch.

Analog of \(2\ell + 1\) on the flat-sky. instance mode filtering is included (i.e. set to zero for mods filtered out)

map2alm(m, lib_almin=None)[source]

Computes alm array of input position-space map

map2cl(m1, m2=None, ellmax=None)[source]

Returns power spectrum of alm array

udgrade(lib_alm, alm)[source]

Degrades or upgrades a alm vector from this ffs_alm instance to another instance.

class lensit.ffs_covs.ell_mat.ffs_alm_pyFFTW(ellmat, filt_func=<function ffs_alm_pyFFTW.<lambda>>, num_threads=1, flags_init=('FFTW_MEASURE', ))[source]

Same as ffs_alm but with pyfftw fft-engine threaded fftw library (up to 10 times faster than numpy’s).

alm2map(alm, lib_almout=None)[source]

Returns position-space map from alm array