pspy_utils
- a module with utilities for pspy
#
Utils for pspy.
- pspy.pspy_utils.beam_from_fwhm(fwhm_arcminute, lmax)#
Compute the harmonic transform of the beam given the beam full width half maximum in arcminute
- Parameters:
fwhm_arcminute (float) – full width half maximum in arcminute
lmax (integer) – the maximum multipole to consider
- pspy.pspy_utils.calibrate_alms(alms, cal=1.0, pol_eff=1.0)#
Apply a calibration amplitude and a polarization efficiency to a set of alms.
- Parameters:
alms (array) –
cal (float) – calibration amplitude (default to 1)
pol_eff (float) – polarization efficiency (default to 1)
- pspy.pspy_utils.create_arbitrary_binning_file(delta_l_list, l_bound_list, binning_file=None)#
This function return a binning scheme with non constant bin size you specify a list of bin size: delta_l_list, and the corresponding bound at which this bin size ceases to apply: l_bound_list optionnaly write to disk a binning file in format, lmin, lmax, lmean
- Parameters:
delta_l_list (list of integers) – the different binsize we want to consider
l_bound_list (list of integers) – the multipole at which the binsize ceases to apply
write_binning_file (string) – if you want to write to disk, pass a string with the name of the file
- pspy.pspy_utils.create_binning_file(bin_size, n_bins, lmax=None, file_name=None)#
Create a (constant) binning file, and optionnaly write it to disk
- Parameters:
bin_size (float) – the size of the bins
n_bins (integer) – the number of bins
lmax (integer) – the maximum multipole to consider
file_name (string) – the name of the binning file
- pspy.pspy_utils.create_directory(name)#
Create a directory
- Parameters:
name (string) – the name of the directory
- pspy.pspy_utils.get_nlth_dict(rms_uKarcmin_T, type, lmax, spectra=None, rms_uKarcmin_pol=None, beamfile=None)#
Return the effective noise power spectrum Nl/bl^2 given a beam file and a noise rms
- Parameters:
rms_uKarcmin_T (float) – the temperature noise rms in uK.arcmin
type (string) – ‘Cl’ or ‘Dl’
lmax (integer) – the maximum multipole to consider
spectra (list of strings) – needed for spin0 and spin2 cross correlation, the arrangement of the spectra
rms_uKarcmin_pol (float) – the polarisation noise rms in uK.arcmin
beamfile (string) – the name of the beam transfer function (assuming it’s given as a two column file l,bl)
- pspy.pspy_utils.is_pos_def(mat)#
This function check if a matrix is positive definite
- Parameters:
mat (2d array) – the matrix tested
- pspy.pspy_utils.is_symmetric(mat, tol=1e-08)#
This function check if a matrix is symmetric
- Parameters:
mat (2d array) – the matrix tested
tol – the absolute tolerance on assymetry
- pspy.pspy_utils.naive_binning(l, fl, binning_file, lmax)#
Bin a function of l given a binning file and lmax
- Parameters:
l (1d integer array) – the multipoles
fl (1d float array) – the 1-dimensional function to bin
binning_file (string) – the name of the binning file
lmax (integer) – the maximum multipole to consider
- pspy.pspy_utils.ps_from_params(cosmo_params, output_type, lmax, start_at_zero=False, **accuracy_pars)#
- Given a set of cosmological parameters compute the corresponding lensed power spectrum
You need to have camb installed to use this function
- Parameters:
cosmo_params (dict) – dictionnary of cosmological parameters # e.g cosmo_params = {“cosmomc_theta”:0.0104085, “logA”: 3.044, “ombh2”: 0.02237, “omch2”: 0.1200, “ns”: 0.9649, “Alens”: 1.0, “tau”: 0.0544}
output_type (string) – ‘Cl’ or ‘Dl’
lmax (integer) – the maximum multipole to consider
start_at_zero (boolean) – if True, ps start at l=0 and cl(l=0) and cl(l=1) are set to 0 else, start at l=2
accuracy_pars (dict) – optional accuracy parameters that CAMB understand (e.g. lens_potential_accuracy)
- pspy.pspy_utils.ps_lensed_theory_to_dict(filename, output_type, lmax=None, start_at_zero=False)#
Read a lensed power spectrum from CAMB and return a dictionnary
- Parameters:
filename (string) – the name of the CAMB lensed power spectrum you want to read
lmax (integer) – the maximum multipole (spectra will be cut at)
output_type (string) – ‘Cl’ or ‘Dl’
start_at_zero (boolean) – if True, ps start at l=0 and cl(l=0) and cl(l=1) are set to 0
- pspy.pspy_utils.read_beam_file(beamfile, lmax=None)#
Read beam file with formal, l, bl, stuff and normalize it
- Parameters:
beamfile (string) – the name of the beam file
lmax (integer) – the maximum multipole to consider
- pspy.pspy_utils.read_binning_file(file_name, lmax)#
Read a binningFile and truncate it to lmax, if bin_low lower than 2, set it to 2. format is bin_low, bin_high, bin_mean
- Parameters:
binningfile (string) – the name of the binning file
lmax (integer) – the maximum multipole to consider
- pspy.pspy_utils.rotate_pol_alms(alms, pol_rot_angle)#
Apply a rotation on the alms due to polangle miscalibration.
- Parameters:
alms (array) –
pol_rot_angle (float) – must be in degree
- pspy.pspy_utils.unlensed_ps_from_params(cosmo_params, lmax, raw_cl=False, start_at_zero=False, **accuracy_pars)#
- Given a set of cosmological parameters compute the corresponding unlensed power spectrum
as well as the corresponding lensing potential You need to have camb installed to use this function
- Parameters:
cosmo_params (dict) – dictionnary of cosmological parameters # e.g cosmo_params = {“cosmomc_theta”:0.0104085, “logA”: 3.044, “ombh2”: 0.02237, “omch2”: 0.1200, “ns”: 0.9649, “Alens”: 1.0, “tau”: 0.0544}
raw_cl (boolean) –
- wether to rescale or not the power spectrum, the rescaling factors are:
l * (l + 1) / (2 * np.pi) for TT, EE, BB, TE (l * (l + 1)) ** 2 / (2 * np.pi) for PP (l ** 2 * (l + 1)) / (2 * np.pi) for PT and PE
lmax (integer) – the maximum multipole to consider
start_at_zero (boolean) – if True, ps start at l=0 and cl(l=0) and cl(l=1) are set to 0 else, start at l=2
accuracy_pars (dict) – optional accuracy parameters that CAMB understand (e.g. lens_potential_accuracy)