flatsky – Flatsky analysis tools

rec_lens – quadratic lensing reconstruction

cmblensplus.flatsky.rec_lens.qtt(nx, ny, D, rL, fC, T1, T2, gtype='')

Reconstruct the CMB lensing potential and curl mode from the temperature quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

Temperature power spectrum on the 2D Fourier grid.

T1ndarray of complex, shape (nx, ny)

Fourier modes of the first inverse-variance filtered temperature map.

T2ndarray of complex, shape (nx, ny)

Fourier modes of the second inverse-variance filtered temperature map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

cmblensplus.flatsky.rec_lens.qte(nx, ny, D, rL, fC, T, E, gtype='')

Reconstruct the CMB lensing potential and curl mode from the suboptimal TE quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D Fourier grid.

Tndarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered temperature map.

Endarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered E-mode map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

cmblensplus.flatsky.rec_lens.qtb(nx, ny, D, rL, fC, T, B, gtype='')

Reconstruct the CMB lensing potential and curl mode from the TB quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D Fourier grid.

Tndarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered temperature map.

Bndarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered B-mode map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

cmblensplus.flatsky.rec_lens.qee(nx, ny, D, rL, fC, E1, E2, gtype='')

Reconstruct the CMB lensing potential and curl mode from the EE quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

EE power spectrum on the 2D Fourier grid.

E1ndarray of complex, shape (nx, ny)

Fourier modes of the first inverse-variance filtered E-mode map.

E2ndarray of complex, shape (nx, ny)

Fourier modes of the second inverse-variance filtered E-mode map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

cmblensplus.flatsky.rec_lens.qeb(nx, ny, D, rL, fC, E, B, gtype='')

Reconstruct the CMB lensing potential and curl mode from the EB quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

EE power spectrum on the 2D Fourier grid.

Endarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered E-mode map.

Bndarray of complex, shape (nx, ny)

Fourier modes of the inverse-variance filtered B-mode map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

cmblensplus.flatsky.rec_lens.qbb(nx, ny, D, rL, fC, B1, B2, gtype='')

Reconstruct the CMB lensing potential and curl mode from the BB quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

BB power spectrum on the 2D Fourier grid.

B1ndarray of complex, shape (nx, ny)

Fourier modes of the first inverse-variance filtered B-mode map.

B2ndarray of complex, shape (nx, ny)

Fourier modes of the second inverse-variance filtered B-mode map.

gtypestr, optional

Type of output. Use 'k' for convergence or '' for lensing potential. Default is ''.

Returns

glmndarray of complex, shape (nx, ny)

Fourier modes of the CMB lensing potential.

clmndarray of complex, shape (nx, ny)

Fourier modes of the curl mode, or pseudo lensing potential.

rec_rot – quadratic pol. rot. reconstruction

cmblensplus.flatsky.rec_rot.qte(nx, ny, D, rL, fC, T, E)

Reconstruct anisotropic polarization-rotation angles from the TE quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalently dLx / (2 * pi) and dLy / (2 * pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D grid.

Tndarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered temperature map.

Endarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered E-mode map.

Returns

almndarray of complex, shape (nx, ny)

2D Fourier modes of the anisotropic polarization-rotation angles.

cmblensplus.flatsky.rec_rot.qtb(nx, ny, D, rL, fC, T, B)

Reconstruct anisotropic polarization-rotation angles from the TB quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalently dLx / (2 * pi) and dLy / (2 * pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D grid.

Tndarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered temperature map.

Bndarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered B-mode map.

Returns

almndarray of complex, shape (nx, ny)

2D Fourier modes of the anisotropic polarization-rotation angles.

cmblensplus.flatsky.rec_rot.qee(nx, ny, D, rL, fC, E1, E2)

Reconstruct anisotropic polarization-rotation angles from the EE quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalently dLx / (2 * pi) and dLy / (2 * pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

EE power spectrum on the 2D grid.

E1ndarray of complex, shape (nx, ny)

2D Fourier modes of the first inverse-variance filtered E-mode map.

E2ndarray of complex, shape (nx, ny)

2D Fourier modes of the second inverse-variance filtered E-mode map.

Returns

almndarray of complex, shape (nx, ny)

2D Fourier modes of the anisotropic polarization-rotation angles.

cmblensplus.flatsky.rec_rot.qeb(nx, ny, D, rL, EE, E, B, BB=0)

Reconstruct anisotropic polarization-rotation angles from the EB quadratic estimator.

Parameters

nxint

Number of Fourier grid points in the x direction.

nyint

Number of Fourier grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalently dLx / (2 * pi) and dLy / (2 * pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

EEndarray of float, shape (nx, ny)

EE power spectrum on the 2D grid.

Endarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered E-mode map.

Bndarray of complex, shape (nx, ny)

2D Fourier modes of the inverse-variance filtered B-mode map.

BBndarray of float or float, optional

Theory B-mode spectrum on the 2D grid. If a scalar is given, it is applied as a constant. Default is 0.

Returns

almndarray of complex, shape (nx, ny)

2D Fourier modes of the anisotropic polarization-rotation angles.

rec_tau – quadratic patchy tau reconstruction

cmblensplus.flatsky.rec_tau.qtt(nx, ny, D, rL, fC, T1, T2)

Reconstruct patchy tau from the temperature quadratic estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

Temperature power spectrum on the 2D Fourier grid.

T1ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the first inverse-variance filtered temperature field.

T2ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the second inverse-variance filtered temperature field.

Returns

tlmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of patchy tau.

cmblensplus.flatsky.rec_tau.qte(nx, ny, D, rL, fC, T, E)

Reconstruct patchy tau from the suboptimal TE quadratic estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D Fourier grid.

Tndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered temperature field.

Endarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered E-mode field.

Returns

tlmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of patchy tau.

cmblensplus.flatsky.rec_tau.qtb(nx, ny, D, rL, fC, T, B)

Reconstruct patchy tau from the TB quadratic estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

TE cross-power spectrum on the 2D Fourier grid.

Tndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered temperature field.

Bndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered B-mode field.

Returns

tlmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of patchy tau.

cmblensplus.flatsky.rec_tau.qee(nx, ny, D, rL, fC, E1, E2)

Reconstruct patchy tau from the EE quadratic estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fCndarray of float, shape (nx, ny)

EE power spectrum on the 2D Fourier grid.

E1ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the first inverse-variance filtered E-mode field.

E2ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the second inverse-variance filtered E-mode field.

Returns

tlmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of patchy tau.

cmblensplus.flatsky.rec_tau.qeb(nx, ny, D, rL, fE, fB, E, B)

Reconstruct patchy tau from the EB quadratic estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

fEndarray of float, shape (nx, ny)

EE power spectrum on the 2D Fourier grid.

fBndarray of float, shape (nx, ny)

BB power spectrum on the 2D Fourier grid.

Endarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered E-mode field.

Bndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered B-mode field.

Returns

tlmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of patchy tau.

rec_src – quadratic point-src reconstruction

cmblensplus.flatsky.rec_src.qtt(nx, ny, D, rL, T1, T2)

Reconstruct point-source fields from the temperature quadratic estimator.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

T1ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the first inverse-variance filtered temperature map.

T2ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the second inverse-variance filtered temperature map.

Returns

slmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the point-source field.

cmblensplus.flatsky.rec_src.qte(nx, ny, D, rL, T, E)

Reconstruct point-source fields from the suboptimal TE quadratic estimator.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

Tndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered temperature map.

Endarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered E-mode map.

Returns

slmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the point-source field.

cmblensplus.flatsky.rec_src.qtb(nx, ny, D, rL, T, B)

Reconstruct point-source fields from the TB quadratic estimator.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

Tndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered temperature map.

Bndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered B-mode map.

Returns

slmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the point-source field.

cmblensplus.flatsky.rec_src.qee(nx, ny, D, rL, E1, E2)

Reconstruct point-source fields from the EE quadratic estimator.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

E1ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the first inverse-variance filtered E-mode map.

E2ndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the second inverse-variance filtered E-mode map.

Returns

slmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the point-source field.

cmblensplus.flatsky.rec_src.qeb(nx, ny, D, rL, E, B)

Reconstruct point-source fields from the EB quadratic estimator.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

Endarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered E-mode map.

Bndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the inverse-variance filtered B-mode map.

Returns

slmndarray of complex, shape (nx, ny)

Two-dimensional Fourier modes of the point-source field.

norm_lens – normalization of quadratic lensing reconstruction

cmblensplus.flatsky.norm_lens.qtt(nx, ny, D, rL, OT, TT, eL)

Return the normalization of the temperature quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

OTndarray of float, shape (nx, ny)

Inverse observed temperature power spectrum on the 2D grid, with bounds (nx, ny).

TTndarray of float, shape (nx, ny)

Theoretical temperature power spectrum on the 2D grid, with bounds (nx, ny).

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.n0tt(nx, ny, D, rL, OT0, OT1, TT, eL)

Return the disconnected noise normalization of the temperature quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

OT0ndarray of float, shape (nx, ny)

First inverse observed temperature power spectrum on the 2D grid.

OT1ndarray of float, shape (nx, ny)

Second inverse observed temperature power spectrum on the 2D grid.

TTndarray of float, shape (nx, ny)

Theoretical temperature power spectrum on the 2D grid.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.n0ttc(nx, ny, D, rL, OT0, OT1, TT, eL)

Return the disconnected noise normalization of the temperature quadratic estimator for the CMB lensing potential and curl mode, allowing complex inverse observed spectra.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

OT0ndarray of complex, shape (nx, ny)

First inverse observed temperature power spectrum on the 2D grid.

OT1ndarray of complex, shape (nx, ny)

Second inverse observed temperature power spectrum on the 2D grid.

TTndarray of float, shape (nx, ny)

Theoretical temperature power spectrum on the 2D grid.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.qte(nx, ny, D, rL, OT, OE, TE, eL)

Return the normalization of the TE quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

OTndarray of float, shape (nx, ny)

Inverse observed temperature power spectrum on the 2D grid.

OEndarray of float, shape (nx, ny)

Inverse observed E-mode power spectrum on the 2D grid.

TEndarray of float, shape (nx, ny)

Theoretical TE cross spectrum on the 2D grid.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.qtb(nx, ny, D, OT, OB, TE, rL, eL)

Return the normalization of the TB quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

OTndarray of float, shape (nx, ny)

Inverse observed temperature power spectrum on the 2D grid.

OBndarray of float, shape (nx, ny)

Inverse observed B-mode power spectrum on the 2D grid.

TEndarray of float, shape (nx, ny)

Theoretical TE cross spectrum on the 2D grid.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.qee(nx, ny, D, OE, EE, rL, eL)

Return the normalization of the EE quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

OEndarray of float, shape (nx, ny)

Inverse observed E-mode power spectrum on the 2D grid.

EEndarray of float, shape (nx, ny)

Theoretical E-mode power spectrum on the 2D grid.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

cmblensplus.flatsky.norm_lens.qeb(nx, ny, D, OE, OB, EE, rL, eL)

Return the normalization of the EB quadratic estimator for the CMB lensing potential and curl mode.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

OEndarray of float, shape (nx, ny)

Inverse observed E-mode power spectrum on the 2D grid.

OBndarray of float, shape (nx, ny)

Inverse observed B-mode power spectrum on the 2D grid.

EEndarray of float, shape (nx, ny)

Theoretical E-mode power spectrum on the 2D grid.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Agndarray of complex, shape (nx, ny)

Normalization of the CMB lensing potential on the 2D grid.

Acndarray of complex, shape (nx, ny)

Normalization of the curl mode, or pseudo lensing potential, on the 2D grid.

norm_rot – normalization of quadratic pol. rot. reconstruction

cmblensplus.flatsky.norm_rot.qeb(nx, ny, D, rL, IE, IB, EE, eL, BB=0)

Return the normalization of the EB quadratic estimator for anisotropic polarization-rotation angles.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, or equivalently dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

IEndarray of float, shape (nx, ny)

Inverse of the observed E-mode power spectrum on the 2D grid.

IBndarray of float, shape (nx, ny)

Inverse of the observed B-mode power spectrum on the 2D grid.

EEndarray of float, shape (nx, ny)

Theoretical E-mode power spectrum on the 2D grid.

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

BBfloat or ndarray of float, optional

Theoretical B-mode power spectrum on the 2D grid. If an array is given, its shape should be (nx, ny). Default is 0.

Returns

Aandarray of complex, shape (nx, ny)

Normalization of anisotropic polarization-rotation angles on the 2D grid.

norm_tau – normalization of quadratic patchy tay reconstruction

cmblensplus.flatsky.norm_tau.qtt(nx, ny, D, rL, OT, TT, eL)

Return the normalization of the temperature quadratic estimator for patchy optical depth.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

OTndarray of float, shape (nx, ny)

Inverse of the observed temperature power spectrum on the 2D grid, with bounds (0:nx-1, 0:ny-1).

TTndarray of float, shape (nx, ny)

Theoretical temperature power spectrum on the 2D grid, with bounds (0:nx-1, 0:ny-1).

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Atndarray of complex, shape (nx, ny)

Normalization of patchy optical depth on the 2D grid, with bounds (0:nx-1, 0:ny-1).

cmblensplus.flatsky.norm_tau.qeb(nx, ny, D, rL, IE, IB, EE, eL)

Return the normalization of the EB quadratic estimator for patchy optical depth.

Parameters

nxint

Number of grids along the x direction.

nyint

Number of grids along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi), with bounds 0:1.

rLarray_like of int, shape (2,)

Minimum and maximum CMB multipoles used for reconstruction.

IEndarray of float, shape (nx, ny)

Inverse of the observed E-mode power spectrum on the 2D grid, with bounds (0:nx-1, 0:ny-1).

IBndarray of float, shape (nx, ny)

Inverse of the observed B-mode power spectrum on the 2D grid, with bounds (0:nx-1, 0:ny-1).

EEndarray of float, shape (nx, ny)

Theoretical E-mode power spectrum on the 2D grid, with bounds (0:nx-1, 0:ny-1).

eLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output normalization spectrum.

Returns

Atndarray of complex, shape (nx, ny)

Normalization of patchy optical depth on the 2D grid, with bounds (0:nx-1, 0:ny-1).

bispec – bispectrum tools

cmblensplus.flatsky.bispec.bispec_norm(nx, ny, D, bp, dbin_max=-1, bn=1)

Return the normalization of the binned bispectrum estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

bparray_like of float, shape (bn + 1,)

Multipole bin edges.

dbin_maxint, optional

Maximum bin separation used in the bispectrum calculation. If -1, it is set to bn. Default is -1.

bnint, optional

Number of multipole bins. This value is overwritten by len(bp) - 1. Default is 1.

Returns

normndarray of float

Normalization of the binned bispectrum estimator.

cmblensplus.flatsky.bispec.bispec_bin(kmap, bp, kn=1, bn=1, nx=0, ny=0, dbin_max=-1)

Return the binned bispectrum estimator.

Parameters

kmapndarray of complex, shape (kn, bn, nx, ny)

Fourier-space maps used for the bispectrum calculation.

bparray_like of float, shape (bn + 1,)

Multipole bin edges.

knint, optional

Number of input map sets. This value is overwritten from kmap. Default is 1.

bnint, optional

Number of multipole bins. This value is overwritten by len(bp) - 1. Default is 1.

nxint, optional

Number of Fourier grid points along the x direction. This value is overwritten from kmap. Default is 0.

nyint, optional

Number of Fourier grid points along the y direction. This value is overwritten from kmap. Default is 0.

dbin_maxint, optional

Maximum bin separation used in the bispectrum calculation. If -1, it is set to bn. Default is -1.

Returns

bispecndarray of float

Binned bispectrum estimator.

cmblensplus.flatsky.bispec.binfilter(nx, ny, D, bp, bn=1)

Return binary masks for multipole bins on two-dimensional Fourier grids.

The mask is 1 inside the corresponding multipole bin and 0 otherwise.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

bparray_like of float, shape (bn + 1,)

Multipole bin edges.

bnint, optional

Number of multipole bins. This value is overwritten by len(bp) - 1. Default is 1.

Returns

bfndarray of float, shape (bn, nx, ny)

Binary mask for each multipole bin.

cmblensplus.flatsky.bispec.bispec_norm_1d(nx, ny, D, bfs, bn=1)

Return the normalization of the one-dimensional binned bispectrum estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

bfsndarray of float, shape (3, bn, nx, ny)

Multipole-bin masks on two-dimensional grids, usually obtained from binfilter().

bnint, optional

Number of multipole bins. This value is overwritten from bfs. Default is 1.

Returns

bnormndarray of float, shape (bn,)

Normalization of the one-dimensional binned bispectrum estimator at each multipole bin.

cmblensplus.flatsky.bispec.bispec_bin_1d(nx, ny, D, bfs, bnorm, alm, bn=1)

Return the one-dimensional binned bispectrum estimator.

Parameters

nxint

Number of Fourier grid points along the x direction.

nyint

Number of Fourier grid points along the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

bfsndarray of float, shape (3, bn, nx, ny)

Multipole-bin masks on two-dimensional grids, usually obtained from binfilter().

bnormarray_like of float, shape (bn,)

Normalization of the one-dimensional binned bispectrum estimator at each multipole bin.

almndarray of complex, shape (3, nx, ny)

Fourier modes for each leg of the bispectrum.

bnint, optional

Number of multipole bins. This value is overwritten from bfs. Default is 1.

Returns

bispecndarray of float, shape (bn,)

One-dimensional binned bispectrum at each multipole bin.

utils – other tools

cmblensplus.flatsky.utils.map2alm(nx, ny, D, map)

Perform a discrete Fourier transform of a 2D map.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Side lengths of the map in the x and y directions.

mapndarray of float, shape (nx, ny)

Input map on a 2D grid.

Returns

almndarray of complex, shape (nx, ny)

Fourier modes on the 2D grid.

cmblensplus.flatsky.utils.alm2map(nx, ny, D, alm)

Perform an inverse discrete Fourier transform of 2D Fourier modes.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Side lengths of the map in the x and y directions.

almndarray of complex, shape (nx, ny)

Fourier modes on a 2D grid.

Returns

mapndarray of float, shape (nx, ny)

Transformed map on the 2D grid.

cmblensplus.flatsky.utils.el2d(nx, ny, D)

Return the absolute value of the multipole on a 2D Fourier grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

Returns

elsndarray of float, shape (nx, ny)

Absolute value of the Fourier mode, sqrt(Lx**2 + Ly**2).

cmblensplus.flatsky.utils.elarrays(nx, ny, D)

Return the Fourier-grid coordinates and their radial quantities.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

Returns

elxndarray of float, shape (nx, ny)

Fourier coordinate Lx.

elyndarray of float, shape (nx, ny)

Fourier coordinate Ly.

elsndarray of float, shape (nx, ny)

Absolute value of the Fourier mode, sqrt(Lx**2 + Ly**2).

elindarray of float, shape (nx, ny)

Inverse of els.

cmblensplus.flatsky.utils.elmask(nx, ny, D, lmin=0, lmax=1000, lxcut=0, lycut=0)

Return a mask in 2D Fourier space.

The mask is unity where lmin <= |L| <= lmax, |Lx| >= lxcut, and |Ly| >= lycut. It is zero elsewhere.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

lminint, optional

Minimum multipole. Default is 0.

lmaxint, optional

Maximum multipole. Default is 1000.

lxcutint, optional

Remove modes with |Lx| < lxcut. Default is 0.

lycutint, optional

Remove modes with |Ly| < lycut. Default is 0.

Returns

lmaskndarray of float, shape (nx, ny)

Fourier-space mask.

cmblensplus.flatsky.utils.ulm_flat(nx, ny, D, ulm, lmax=0, alpha=1.0, deapod=True)

Convert spherical harmonic coefficients to a 2D flat-sky grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

ulmndarray of complex, shape (lmax + 1, lmax + 1)

Harmonic coefficients.

lmaxint, optional

Maximum multipole of ulm. If 0, it is inferred from ulm. Default is 0.

alphafloat, optional

Scaling parameter passed to the backend routine. Default is 1.0.

deapodbool, optional

Whether to apply deapodization. Default is True.

Returns

ul2dndarray of complex, shape (nx, ny)

Harmonic coefficients converted onto the 2D grid.

cmblensplus.flatsky.utils.ulm2ulphi(ulm, lmax=0)

Convert spherical harmonic coefficients to u(l, phi_l).

Parameters

ulmndarray of complex, shape (lmax + 1, lmax + 1)

Harmonic coefficients.

lmaxint, optional

Maximum multipole of ulm. If 0, it is inferred from ulm. Default is 0.

Returns

ulphindarray of complex, shape (lmax + 1, lmax + 1)

Converted harmonic coefficients on the (l, phi_l) grid.

cmblensplus.flatsky.utils.lphi_to_cartesian(nx, ny, D, lmax, ulphi)

Convert coefficients from an (l, phi_l) grid to a Cartesian 2D grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths.

lmaxint

Maximum multipole of ulphi.

ulphindarray of complex

Input coefficients on the (l, phi_l) grid.

Returns

array_like

Coefficients converted to a Cartesian 2D grid.

cmblensplus.flatsky.utils.deapodization_bilinear(nx, ny, D, imap, alpha)

Apply bilinear deapodization to a 2D map.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths.

imapndarray of float, shape (nx, ny)

Input map.

alphafloat

Deapodization parameter.

Returns

omapndarray of float, shape (nx, ny)

Deapodized output map.

cmblensplus.flatsky.utils.alm2bcl(bn, oL, nx, ny, D, alm1, alm2=None, spc='')

Compute a binned angular power spectrum from Fourier modes.

Parameters

bnint

Number of multipole bins.

oLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output spectrum.

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

alm1ndarray of complex, shape (nx, ny)

First Fourier-mode array.

alm2ndarray of complex, shape (nx, ny), optional

Second Fourier-mode array. If not given, alm1 is used.

spcstr, optional

Multipole bin spacing. Use '' for linear spacing or 'log' for logarithmic spacing. Default is ''.

Returns

Cbndarray of float, shape (bn,)

Binned angular power spectrum.

cmblensplus.flatsky.utils.c2d2bcl(nx, ny, D, c2d, bn, oL, spc='')

Compute a binned 1D angular power spectrum from a 2D power spectrum.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

c2dndarray of float, shape (nx, ny)

Input 2D power spectrum.

bnint

Number of multipole bins.

oLarray_like of int, shape (2,)

Minimum and maximum multipoles of the output spectrum.

spcstr, optional

Multipole bin spacing. Use '' for linear spacing or 'log' for logarithmic spacing. Default is ''.

Returns

Cbndarray of float, shape (bn,)

Binned angular power spectrum.

cmblensplus.flatsky.utils.cl2c2d(nx, ny, D, lmin, lmax, Cl, method='linear')

Interpolate a 1D angular power spectrum onto a 2D Fourier grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

lminint

Minimum multipole of Cl to be interpolated.

lmaxint

Maximum multipole of Cl to be interpolated.

Clarray_like of float, shape (lmax + 1,)

Input 1D angular power spectrum.

methodstr, optional

Interpolation method. Use 'linear' for linear interpolation or 'step' for step interpolation. Default is 'linear'.

Returns

c2dndarray of float, shape (nx, ny)

Interpolated 2D power spectrum.

cmblensplus.flatsky.utils.cb2c2d(bn, bc, nx, ny, D, lmin, lmax, Cb, method='')

Interpolate a binned 1D angular power spectrum onto a 2D Fourier grid.

Parameters

bnint

Number of multipole bins.

bcarray_like of float, shape (bn,)

Multipole bin centers.

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

lminint

Minimum multipole to be interpolated.

lmaxint

Maximum multipole to be interpolated.

Cbarray_like of float, shape (bn,)

Binned 1D angular power spectrum.

methodstr, optional

Interpolation method from binned to unbinned spectrum. Use '' for spline interpolation or 'linear' for linear interpolation. Default is ''.

Returns

c2dndarray of float, shape (nx, ny)

Interpolated 2D power spectrum.

cmblensplus.flatsky.utils.gauss1alm(nx, ny, D, lmin, lmax, Cl)

Generate a random Gaussian field in 2D Fourier space.

The generated field satisfies the Hermitian condition a_l.conjugate() = a_{-l}.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

lminint

Minimum multipole of Cl to be interpolated.

lmaxint

Maximum multipole of Cl to be interpolated.

Clarray_like of float, shape (lmax + 1,)

Input 1D angular power spectrum.

Returns

almndarray of complex, shape (nx, ny)

Random Gaussian field on the 2D Fourier plane.

cmblensplus.flatsky.utils.gauss2alm(nx, ny, D, lmin, lmax, TT, TE, EE)

Generate two correlated random Gaussian fields in 2D Fourier space.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

lminint

Minimum multipole of the spectra to be interpolated.

lmaxint

Maximum multipole of the spectra to be interpolated.

TTarray_like of float, shape (lmax + 1,)

First 1D auto power spectrum.

TEarray_like of float, shape (lmax + 1,)

1D cross power spectrum.

EEarray_like of float, shape (lmax + 1,)

Second 1D auto power spectrum.

Returns

tlmndarray of complex, shape (nx, ny)

First random Gaussian field on the 2D Fourier plane.

elmndarray of complex, shape (nx, ny)

Second random Gaussian field on the 2D Fourier plane.

cmblensplus.flatsky.utils.window_sin(nx, ny, D, ap=1, cut=1)

Return a sine window function.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths, equivalent to dLx / (2*pi) and dLy / (2*pi).

apfloat, optional

Apodization parameter. The apodized range is (1 - ap) * cut * mapsize. It ranges from 0, full apodization, to 1, no apodization. Default is 1.

cutfloat, optional

Map cut parameter. The cut map size is cut * mapsize. It ranges from 0, full cut, to 1, no cut. Default is 1.

Returns

Wndarray of float, shape (nx, ny)

Window function.

cmblensplus.flatsky.utils.window_norm(nx, ny, wind, num)

Return the normalization factor of a window function.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

windndarray of float, shape (nx, ny)

Window function.

numint

Power of the window used for the normalization.

Returns

normfloat

Window normalization factor.

cmblensplus.flatsky.utils.window_norm_x(nx, ny, W1, W2, num)

Return the cross-normalization factor of two window functions.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

W1ndarray of float, shape (nx, ny)

First window function.

W2ndarray of float, shape (nx, ny)

Second window function.

numint

Power used for the normalization.

Returns

normfloat

Cross-window normalization factor.

cmblensplus.flatsky.utils.rotation(nx, ny, rot, QU, rtype='f')

Rotate a two-component field on a 2D grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

rotndarray of float, shape (nx, ny)

Rotation angle map.

QUndarray of float

Input two-component field.

rtypestr

Rotation type ``l’’ (small angle limit) or ``f’’ (no assumption)

Returns

rotatedndarray

Rotated two-component field.

cmblensplus.flatsky.utils.get_angle(nx, ny, D)

Return the Fourier-space angle on a 2D grid.

Parameters

nxint

Number of grid points in the x direction.

nyint

Number of grid points in the y direction.

Darray_like of float, shape (2,)

Map side lengths.

Returns

anglendarray of float, shape (nx, ny)

Fourier-space angle on the 2D grid.

cmblensplus.flatsky.utils.cutmap(ox, oy, cx, cy, omap)

Cut out a rectangular region from a 2D map.

Parameters

oxint

Number of grid points in the x direction of the original map.

oyint

Number of grid points in the y direction of the original map.

cxint

Number of grid points in the x direction of the cut map.

cyint

Number of grid points in the y direction of the cut map.

omapndarray

Original input map.

Returns

cmapndarray

Cut-out map.