so_mcm
- a module for mode coupling calculation#
Routines for mode coupling calculation. For more details on computation of the matrix see https://pspy.readthedocs.io/en/latest/scientific_doc.pdf.
- pspy.so_mcm.apply_Bbl(Bbl, ps, spectra=None)#
Bin theoretical power spectra
- Parameters:
Bbl (2d array (or dict of 2d array)) – a binning matrix, if spectra is not None will be a Bbl dictionnary for spin0 and 2 fields, otherwise a (n_bins,lmax) matrix
ps (1d array or dict of 1d array) – theory ps, if spectra is not None it will be a ps dictionnary, otherwise a (lmax) vector
spectra (list of string) – needed for spin0 and spin2 cross correlation, the arrangement of the spectra
- pspy.so_mcm.coupling_dict_to_array(dict)#
Take a mcm or Bbl dictionnary with entries:
(spin0xspin0), (spin0xspin2), (spin2xspin0), (spin2xspin2)
and return a 9 x dim1, 9 x dim2 array. dim1 and dim2 are the dimensions of the spin0 object
- pspy.so_mcm.format_toepliz_fortran(coupling, l_toep, lmax)#
Take a matrix and apply the toepliz appoximation (fortran)
- Parameters:
coupling (array) – consist of an array where the upper part is the exact matrix and the lower part is the diagonal. We will feed the off diagonal of the lower part using the measurement of the correlation from the exact computatio
l_toep (integer) – the l at which we start the approx
lmax (integer) – the maximum multipole of the array
- pspy.so_mcm.format_toepliz_fortran2(coupling, l_toep, l_exact, lmax)#
Take a matrix and apply the toepliz appoximation (fortran)
- Parameters:
coupling (array) – consist of an array where the upper part is the exact matrix and the lower part is the diagonal. We will feed the off diagonal of the lower part using the measurement of the correlation from the exact computatio
l_toep (integer) – the l at which we start the approx
l_exact (integer) – the l until which we do the exact computation
lmax (integer) – the maximum multipole of the array
- pspy.so_mcm.mcm_and_bbl_spin0(win1, binning_file, lmax, niter, type='Dl', win2=None, bl1=None, bl2=None, input_alm=False, binned_mcm=True, save_file=None, l_exact=None, l_toep=None, l_band=None, l3_pad=2000, return_coupling_only=False)#
Get the mode coupling matrix and the binning matrix for spin0 fields
- Parameters:
win1 (so_map (or alm)) – the window function of survey 1, if input_alm=True, expect wlm1
binning_file (text file) – a binning file with three columns bin low, bin high, bin mean
lmax (integer) – the maximum multipole to consider for the spectra computation
type (string) – the type of binning, either bin Cl or bin Dl
win2 (so_map (or alm)) – the window function of survey 2, if input_alm=True, expect wlm2
bl1 (1d array) – the beam of survey 1, expected to start at l=0
bl2 (1d array) – the beam of survey 2, expected to start at l=0
niter (int) – specify the number of iteration in map2alm
binned_mcm (boolean) – wether to bin or not the mcm
save_file (boolean) – save the mcm and bbl to disk
l_toep (int) –
l_band (int) –
l_exact (int) –
- pspy.so_mcm.mcm_and_bbl_spin0and2(win1, binning_file, lmax, niter, type='Dl', win2=None, bl1=None, bl2=None, input_alm=False, pure=False, binned_mcm=True, save_file=None, l3_pad=2000, l_exact=None, l_toep=None, l_band=None, return_coupling_only=False)#
Get the mode coupling matrix and the binning matrix for spin 0 and 2 fields
- Parameters:
win1 (python tuple of so_map or alms (if input_alm=True)) – a python tuple (win_spin0,win_spin2) with the window functions of survey 1, if input_alm=True, expect (wlm_spin0, wlm_spin2)
binning_file (text file) – a binning file with three columns bin low, bin high, bin mean
lmax (integer) – the maximum multipole to consider
type (string) – the type of binning, either bin Cl or bin Dl
win2 (python tuple of so_map or alms (if input_alm=True)) – a python tuple (win_spin0,win_spin2) with the window functions of survey 1, if input_alm=True, expect (wlm_spin0, wlm_spin2)
bl1 (python tuple of 1d array) – a python tuple (beam_spin0,beam_spin2) with the beam of survey 1, expected to start at l=0
bl2 (python tuple of 1d array) – a python tuple (beam_spin0,beam_spin2) with the beam of survey 2, expected to start at l=0
niter (int) – specify the number of iteration in map2alm
pureB (boolean) – do B mode purification
binned_mcm (boolean) – wether to bin or not the mcm
save_file (boolean) – save the mcm and bbl to disk
l_toep (int) –
l_band (int) –
l_exact (int) –
save_coupling (str) –
- pspy.so_mcm.read_coupling(prefix, spin_pairs=None)#
Read the inverse of the mode coupling matrix and the binning matrix :param prefix: the prefix for the name of the file :type prefix: string :param spin_pairs: needed for spin0 and 2 fields. :type spin_pairs: list of strings :param unbin: also read the unbin matrix :type unbin: boolean
- pspy.so_mcm.save_coupling(prefix, mode_coupling_inv, Bbl, spin_pairs=None)#
Save the inverse of the mode coupling matrix and the binning matrix in npy format
- Parameters:
prefix (string) – the prefix for the name of the file
mode_coupling_inv (2d array (or dict of 2d array)) – the inverse of the mode coupling matrix, if spin pairs is not none, should be a dictionnary with entries - spin0xspin0, spin0xspin2, spin2xspin0, spin2xspin2
Bbl (2d array (or dict of 2d array)) – the binning matrix,if spin pairs is not none, should be a dictionnary with entries - spin0xspin0, spin0xspin2, spin2xspin0, spin2xspin2 otherwise, it will be a single matrix.
spin_pairs (list of strings) – needed for spin0 and 2 fields.