API reference of PySSC
Wrapper routines
All of the necessary routines are encapsulated in the PySSC module and the main wrapper function.
- PySSC.Sij(z_arr, kernels, order=2, sky='full', method='classic', cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10, clmask=None, mask=None, mask2=None, var_tol=0.05, machinefile=None, Nn=None, Np='default', AngPow_path=None, verbose=False, debug=False)
Wrapper routine to compute the Sij matrix. It calls different routines depending on the inputs : fullsky or partial sky, computation method.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
order (int, default 2) – The passed kernels will be multiplied to that power, e.g. if two the kernels will be squared. You should normally set it to one and feed the product of kernels that you want. Examples: for cluster counts, set to one and feed the redshift selection functions. For cross-spectra Cl(i,j), set to one and feed the products Wi(z)*Wj(z) for all pairs of bins (i,j). The default is two for backward compatibility to times where the function was intended only for auto-spectra, so kernels needed to be squared internally. That default may change in future.
sky (str, default
'full') –Choice of survey geometry, given as a case-insensitive string. Valid choices:
'full'/'fullsky'/'full sky'/'full-sky','psky'/'partial sky'/'partial-sky'/'partial'/'masked'.
method (str, default
'classic') –Choice of computational method, given as a case-insensitive string. Valid choices:
'classic'/'standard'/'default'/'std','alternative'/'alt'(only available for full sky),'AngPow'/'AP'.
'classic'calls to PySSC.Sij_fullsky or PySSC.Sij_psky routine.'alternative'calls to PySSC.Sij_alt_fullsky only in the case of sky set to'full'.'AngPow'calls to PySSC.Sij_Angpow or PySSC.Sij_AngPow_fullsky.cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology, if you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosis, Euclid Forecasts (Blanchard et al 2020).
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals such as : Nk = 2**precision.
clmask (str or numpy.ndarray, default None) – Array or path to fits file containing the angular power spectrum of the mask. Only implemented if sky is set to psky.
mask (str or numpy.ndarray, default None) – Array or path to fits file containing the mask in healpix form. In that case PySSC will use healpy to compute the mask power spectrum. Thus it is faster to directly give clmask if you have it (or if you compute several Sij matrices for some reason). Only implemented if sky is set to psky
mask2 (str or numpy.ndarray, default None) – Array or path to fits file containing a potential second mask in healpix form. In the case where you want the covariance between observables measured on different areas of the sky. PySSC will use healpy to compute the mask power spectrum. Again, it is faster to directly give clmask if you have it. Only implemented if sky is set to psky. If mask is set and mask2 is None, PySSC assumes that all observables share the same mask.
implemented] (multimask [To be) – list where each element is a dictionnary of the form {‘mask’:’mask.fits’, ‘kernels’:kernels_array}. That is, it gives an observable and the corresponding mask. To be used to compute the SSC of different observables with different sky coverage. If multimask is set, it overrides mask and mask2.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time. Only implemented if sky is set to psky.
machinefile (str, default None) – Path to text file storing the IP addresses of all the nodes in the cluster network, and associated number of threads. machinefile is used for parallel computing in mpi. Default is None (running in local). If not None, the Nn variable must be set by the user. Only implemented if method is set to AngPow.
Nn (int, default None) – Number of threads on which the user wants the AngPow routine to be run in mpi. This number should not exceed the maximum number of threads provided in machinefile. Default is None. If not None, the machinefile variable must be set by the user. Only implemented if method is set to AngPow.
Np (str, default 'default') – Equivalent to set the local environment variable OMP_NUM_THREADS to Np. It represents the number of processes AngPow is allowed to use on each machine. Default is ‘default’ : AngPow uses the pre-existing OMP_NUM_THREADS value.
AngPow_path (str, default None) – path to the Angpow binary repertory (finishing by ‘/’). Default is None and assumes that AngPow is installed at
'./AngPow/'.verbose (bool, default False) – Verbosity of the routine. Defaults to False.
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sij matrix of shape (nbins, nbins).
- Return type
Array_like
- PySSC.Sijkl(z_arr, kernels, sky='full', cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10, clmask=None, mask=None, mask2=None, var_tol=0.05, tol=0.001, verbose=False, debug=False)
[DEPRECATED] Wrapper routine to compute the Sijkl matrix. It calls different routines depending on the inputs : full sky or partial sky methods.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
sky (str, default
'full') –Choice of survey geometry, given as a case-insensitive string. Valid choices:
'full'/'fullsky'/'full sky'/'full-sky','psky'/'partial sky'/'partial-sky'/'partial'/'masked'.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by classy`
cosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology, if you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts. Defaults to 0.
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals such as : Nk = 2**precision.
clmask (str or numpy.ndarray, default None) – Array or path to fits file containing the angular power spectrum of the mask. Only implemented if sky is set to psky.
mask (str or numpy.ndarray, default None) – Array or path to fits file containing the mask in healpix form. In that case PySSC will use healpy to compute the mask power spectrum. Thus it is faster to directly give clmask if you have it (or if you compute several Sij matrices for some reason). Only implemented if sky is set to ‘psky’.
mask2 (str or numpy.ndarray, default None) – Array or path to fits file containing a potential second mask in healpix form. In the case where you want the covariance between observables measured on different areas of the sky. PySSC will use healpy to compute the mask power spectrum. Again, it is faster to directly give clmask if you have it. Only implemented if sky is set to psky. If mask is set and mask2 is None, PySSC assumes that all observables share the same mask.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time. Only implemented if sky is set to psky.
tol (float, default 1e-3) – Tolerance value telling PySSC to cut off (i.e. set Sijkl=0) the matrix elements where there is too small overlap between the kernels rendering the computation unreliable.
verbose (bool, default False) – Verbosity of the routine. Defaults to False
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sijkl matrix of shape (nbins,nbins,nbins,nbins).
- Return type
Array_like
Full-sky routines
Several full-sky implementation are available to compute the Sij matrix.
- PySSC.Sij_fullsky(z_arr, kernels, order=2, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10)
Routine to compute the Sij matrix in full sky. Standard computation method.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
order (int, default 2) – The passed kernels will be multiplied to that power, e.g. if two the kernels will be squared. You should normally set it to one and feed the product of kernels that you want. Examples: for cluster counts, set to one and feed the redshift selection functions. For cross-spectra Cl(i,j), set to one and feed the products Wi(z)*Wj(z) for all pairs of bins (i,j). The default is two for backward compatibility to times where the function was intended only for auto-spectra, so kernels needed to be squared internally. That default may change in future.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts. Defaults to 0.
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals such as : Nk = 2**precision.
- Returns
Sij matrix of shape (nbins, nbins).
- Return type
Array_like
Notes
Equation used
\[S_{ij} = \frac{1}{2\pi^2} \int k^2 dk \ P(k) \frac{U(i,k)}{I_\mathrm{norm}(i)} \frac{U(j,k)}{I_\mathrm{norm}(j)}\]with \(I_\mathrm{norm}(i) = \int dX \ W(i,z)^\mathrm{order}\) and \(U(i,k) = \int dX \ W(i,z)^\mathrm{order} \ G(z) \ j_0(kr)\).
This can also be seen as an angular power spectrum:
\[S_{ij} = \frac{C_S(\ell=0,i,j)}{4 \pi}\]with \(C_S(\ell=0,i,j) = \frac{2}{\pi} \int k^2 dk \ P(k) \frac{U(i,k)}{I_\mathrm{norm}(i)} \frac{U(j,k)}{I_\mathrm{norm}(j)}\).
\(dX\) depends on the convention used to define the observable’s kernel:
\[C_\mathrm{observable}(\ell,i,j) = \int dX \ W(i,z) \, W(j,z) \ P(k=(\ell+1/2)/r,z)\]\(dX = dV = \frac{dV}{dz} dz = r^2(z) \frac{dr}{dz} dz\). Used in Lacasa & Grain 2019.
\(dX = d\chi/\chi^2 = \frac{dr/dz}{r^2(z)} dz\). Used in cosmosis.
The convention of the Euclid Forecasts is nearly the same as 1 up to a factor \(c^2\) (or \(\frac{c^2}{H_0^2}\) depending on the probe), which is a constant so does not matter in the ratio here.
- PySSC.Sij_alt_fullsky(z_arr, kernels, order=2, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0)
Alternative routine to compute the Sij matrix in full sky.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
order (int, default 2) – The passed kernels will be multiplied to that power, e.g. if two the kernels will be squared. You should normally set it to one and feed the product of kernels that you want. Examples: for cluster counts, set to one and feed the redshift selection functions. For cross-spectra Cl(i,j), set to one and feed the products Wi(z)*Wj(z) for all pairs of bins (i,j). The default is two for backward compatibility to times where the function was intended only for auto-spectra, so kernels needed to be squared internally. That default may change in future.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts Defaults to 0.
- Returns
Sij matrix of shape (nbins, nbins).
- Return type
array_like
Notes
Equation used
\[S_{ij} = \int dX_1 \, dX_2 \frac{W(i,z_1)^\mathrm{order}}{I_\mathrm{norm}(i)} \frac{W(j,z_2)^\mathrm{order}}{I_\mathrm{norm}(j)} \ \sigma^2(z_1,z_2)\]with \(I_\mathrm{norm}(i) = \int dX \ W(i,z)^\mathrm{order}\) and \(\sigma^2(z_1,z_2) = \frac{1}{2\pi^2} \int k^2 dk \ P(k|z_1,z_2) \ j_0(kr_1) j_0(kr_2)\). The latter is computed with the auxiliary function sigma2_fullsky.
\(dX\) depends on the convention used to define the observable’s kernel:
\[C_\mathrm{observable}(\ell,i,j) = \int dX \ W(i,z) \, W(j,z) \ P(k=(\ell+1/2)/r,z)\]\(dX = dV = \frac{dV}{dz} dz = r^2(z) \frac{dr}{dz} dz\). Used in Lacasa & Grain 2019.
\(dX = d\chi/\chi^2 = \frac{dr/dz}{r^2(z)} dz\). Used in cosmosis.
The convention of the Euclid Forecasts is nearly the same as 1 up to a factor \(c^2\) (or \(\frac{c^2}{H_0^2}\) depending on the probe), which is a constant so does not matter in the ratio here.
- PySSC.sigma2_fullsky(z_arr, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None)
Routine to compute sigma^2(z1,z2) in full sky.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
- Returns
sigma2 array of shape (nz, nz).
- Return type
array_like
Notes
Equation used
\(\sigma^2(z_1,z_2) = \frac{1}{2\pi^2} \int k^2 dk \ P(k|z_1,z_2) \ j_0(kr_1) j_0(kr_2)\). The latter can be rewritten as \(\sigma^2(z_1,z_2) = \frac{1}{2 \pi^2 r_1 r_2} G(z_1) G(z_2) \int dk \ P(k,z=0) \left[\cos\left(k(r_1-r_2)\right)-\cos\left(k(r_1+r_2)\right)\right]/2\) and computed with an FFT.
- PySSC.Sij_AngPow_fullsky(z_arr, kernels, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'P_k_max_h/Mpc': 20, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk', 'z_max_pk': 0}, machinefile=None, Nn=None, Np='default', AngPow_path=None, verbose=False, debug=False)
Routine to compute the Sij matrix in full sky using AngPow.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology, if you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time.
machinefile (str, default None) – Path to text file storing the IP addresses of all the nodes in the cluster network, and associated number of threads. machinefile is used for parallel computing in mpi. Default is None (running in local). If not None, the Nn variable must be set by the user. Only implemented if method is set to AngPow.
Nn (int, default None) – Number of threads on which the user wants the AngPow routine to be run in mpi. This number should not exceed the maximum number of threads provided in machinefile. Default is None. If not None, the machinefile variable must be set by the user. Only implemented if method is set to AngPow.
Np (str, default 'default') – Equivalent to set the local environment variable OMP_NUM_THREADS to Np. It represents the number of processes AngPow is allowed to use on each machine. Default is ‘default’ : AngPow uses the pre-existing OMP_NUM_THREADS value.
AngPow_path (str, default None) – path to the Angpow binary repertory (finishing by ‘/’). Default is None and assumes that AngPow is installed at ‘./AngPow/’.
verbose (bool, default False) – Verbosity of the routine. Defaults to False
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sij matrix of shape (nbins, nbins).
- Return type
array_like
And only one is implemented for the Sijkl matrix:
- PySSC.Sijkl_fullsky(z_arr, kernels, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10, tol=0.001)
[DEPRECATED] Routine to compute the Sijkl matrix in full sky.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts Defaults to 0.
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals. Nk = 2**precision.
tol (float, default 1e-3) – Tolerance value telling PySSC to cut off (i.e. set Sijkl=0) the matrix elements where there is too small overlap between the kernels rendering the computation unreliable.
- Returns
Sijkl matrix, shape (nbins,nbins,nbins,nbins).
- Return type
array_like
Notes
Equation used (using indices \((\alpha,\beta,\gamma,\delta)\) instead of \((i,j,k,l)\) to avoid confusion with the Fourier wavevector and multipole):
\[S_{\alpha \beta \gamma \delta}=\frac{1}{2\pi^2} \int k^2 dk \ P(k) \frac{U(\alpha,\beta ; k,\ell=0)}{I_\mathrm{norm}(\alpha,\beta)} \frac{U(\gamma,\delta;k,\ell=0)}{I_\mathrm{norm}(\gamma,\delta)}\]with:
\(I_\mathrm{norm}(\alpha,\beta) = \int dX \ W(\alpha,z) \ W(\beta,z)\) and \(U(\alpha,\beta;k,\ell) = \int dX \ W(\alpha,z) \ W(\beta,z) \ G(z) \ j_\ell(k r)\).
Partial-sky routines
Two partial-sky implemetentationas are available to compute the Sij matrix:
- PySSC.Sij_psky(z_arr, kernels, order=2, clmask=None, mask=None, mask2=None, multimask=None, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10, var_tol=0.05, verbose=False, debug=False)
Routine to compute the Sij matrix in partial sky.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
order (int, default 2) – The passed kernels will be multiplied to that power, e.g. if two the kernels will be squared. You should normally set it to one and feed the product of kernels that you want. Examples: for cluster counts, set to one and feed the redshift selection functions. For cross-spectra Cl(i,j), set to one and feed the products Wi(z)*Wj(z) for all pairs of bins (i,j). The default is two for backward compatibility to times where the function was intended only for auto-spectra, so kernels needed to be squared internally. That default may change in future.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts Defaults to 0.
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals. Nk = 2**precision.
clmask (str or numpy.ndarray, default None) – Array or path to fits file containing the angular power spectrum of the mask. To be used when the observable(s) have a single mask.
mask (str or numpy.ndarray, default None) – Array or path to fits file containing the mask in healpix form. PySSC will use healpy to compute the mask power spectrum. It is faster to directly give clmask if you have it (particularly when calling PySSC several times). To be used when the observable(s) have a single mask.
mask2 (str or numpy.ndarray, default None) – Array or path to fits file containing a potential second mask in healpix form. In the case where you want the covariance between observables measured on different areas of the sky. PySSC will use healpy to compute the mask cross-spectrum. Again, it is faster to directly give clmask if you have it. If mask is set and mask2 is None, PySSC assumes that all observables share the same mask.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time. Only implemented if sky is set to psky.
verbose (bool, default False) – Verbosity of the routine. Defaults to False
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sij matrix, shape (nbins,nbins).
- Return type
array_like
Notes
Equation used:
\[S_{ij} = \frac{1}{(4\pi f_{\mathrm{sky}})^2} \sum_\ell (2\ell+1) \ C(\ell,\mathrm{mask}) \ C_S(\ell,i,j)\]where \(C_S(\ell,i,j) = \frac{2}{\pi} \int k^2 dk \ P(k) \frac{U(i;k,\ell)}{I_\mathrm{norm}(i)} \frac{U(j;k,\ell)}{I_\mathrm{norm}(j)}\)
with \(I_\mathrm{norm}(i) = \int dX \ W(i,z)^\mathrm{order}\) and \(U(i;k,\ell) = \int dX \ W(i,z)^\mathrm{order} \ G(z) \ j_\ell(k r)\)
- PySSC.Sij_AngPow(z_arr, kernels, clmask=None, mask=None, mask2=None, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'P_k_max_h/Mpc': 20, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk', 'z_max_pk': 0}, var_tol=0.05, machinefile=None, Nn=None, Np='default', AngPow_path=None, verbose=False, debug=False)
Routine to compute the Sij matrix in partial sky using AngPow.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
clmask (str or numpy.ndarray, default None) – Array or path to fits file containing the angular power spectrum of the mask.
mask (str or numpy.ndarray, default None) – Array or path to fits file containing the mask in healpix form. In that case PySSC will use healpy to compute the mask power spectrum. Thus it is faster to directly give clmask if you have it (or if you compute several Sij matrices for some reason).
mask2 (str or numpy.ndarray, default None) – Array or path to fits file containing a potential second mask in healpix form. In the case where you want the covariance between observables measured on different areas of the sky. PySSC will use healpy to compute the mask power spectrum. Again, it is faster to directly give clmask if you have it. Only implemented if sky is set to psky. If mask is set and mask2 is None, PySSC assumes that all observables share the same mask.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology, if you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time.
machinefile (str, default None) – Path to text file storing the IP addresses of all the nodes in the cluster network, and associated number of threads. machinefile is used for parallel computing in mpi. Default is None (running in local). If not None, the Nn variable must be set by the user. Only implemented if method is set to AngPow.
Nn (int, default None) – Number of threads on which the user wants the AngPow routine to be run in mpi. This number should not exceed the maximum number of threads provided in machinefile. Default is None. If not None, the machinefile variable must be set by the user. Only implemented if method is set to AngPow.
Np (str, default
'default') – Equivalent to set the local environment variable OMP_NUM_THREADS to Np. It represents the number of processes AngPow is allowed to use on each machine. Default is ‘default’ : AngPow uses the pre-existing OMP_NUM_THREADS value.AngPow_path (str, default None) – path to the Angpow binary repertory (finishing by ‘/’). Default is None and assumes that AngPow is installed at ‘./AngPow/’.
verbose (bool, default False) – Verbosity of the routine. Defaults to False
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sij matrix of shape (nbins, nbins).
- Return type
array_like
And only one is implemented for the Sijkl matrix:
- PySSC.Sijkl_psky(z_arr, kernels, clmask=None, mask=None, mask2=None, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, convention=0, precision=10, var_tol=0.05, tol=0.001, verbose=False, debug=False)
[DEPRECATED] Routine to compute the Sijkl matrix in partial sky.
- Parameters
z_arr (array_like) – Input array of redshifts of size nz.
kernels (array_like) – 2d array for the collection of kernels, shape (nbins, nz).
clmask (str or numpy.ndarray, default None) – Array or path to fits file containing the angular power spectrum of the mask. Only implemented if sky is set to psky.
mask (str or numpy.ndarray, default None) – Array or path to fits file containing the mask in healpix form. In that case PySSC will use healpy to compute the mask power spectrum. Thus it is faster to directly give clmask if you have it (or if you compute several Sij matrices for some reason). Only implemented if sky is set to ‘psky’.
mask2 (str or numpy.ndarray, default None) – Array or path to fits file containing a potential second mask in healpix form. In the case where you want the covariance between observables measured on different areas of the sky. PySSC will use healpy to compute the mask power spectrum. Again, it is faster to directly give clmask if you have it. Only implemented if sky is set to psky. If mask is set and mask2 is None, PySSC assumes that all observables share the same mask.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by classy`
cosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology, if you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
convention (int, default 0) – Integer to dictate the convention used in the definition of the kernels. 0 = Lacasa & Grain 2019. 1 = Cosmosic , Euclid Forecasts Defaults to 0.
precision (int, default 10) – Integer which drives the number of Fourier wavenumbers in internal integrals such as : Nk = 2**precision.
var_tol (float, default 0.05) – Float that drives the target precision for the sum over angular multipoles. Default is 5%. Lowering it means increasing the number of multipoles thus increasing computational time. Only implemented if sky is set to psky.
tol (float, default 1e-3) – Tolerance value telling PySSC to cut off (i.e. set Sijkl=0) the matrix elements where there is too small overlap between the kernels rendering the computation unreliable.
verbose (bool, default False) – Verbosity of the routine. Defaults to False
debug (bool, default False) – Debuging options to look for incoherence in the routine. Defaults to False.
- Returns
Sijkl matrix of shape (nbins,nbins,nbins,nbins).
- Return type
Array_like
Notes
Equation used (using indices \((\alpha,\beta,\gamma,\delta)\) instead of \((i,j,k,l)\) to avoid confusion with the Fourier wavevector and multipole):
\[S_{\alpha \beta \gamma \delta} = \frac{1}{(4\pi f_{\mathrm{sky}})^2} \sum_\ell (2\ell+1) \ C(\ell,\mathrm{mask}) \ C_S(\ell,\alpha,\beta,\gamma,\delta)\]where \(C(\ell,\alpha,\beta,\gamma,\delta) = \frac{2}{\pi} \int k^2 dk \ P(k) \frac{U(\alpha,\beta;k,\ell)}{I_\mathrm{norm}(\alpha,\beta)} \frac{U(\gamma,\delta;k,\ell)}{I_\mathrm{norm}(\gamma,\delta)}\) with \(I_\mathrm{norm}(\alpha,\beta) = \int dX \ W(\alpha,z) \ W(\beta,z)\) and \(U(\alpha,\beta;k,\ell) = \int dX \ W(\alpha,z) \ W(\beta,z) \ G(z) \ j_\ell(k r)\).
Flat-sky routine
An additional Sij implementation is provided in the flat-sky limit.
- PySSC.Sij_flatsky(z_arr, kernels, bin_centres, theta, cosmo_params={'A_s': 2.035e-09, 'H0': 67.0, 'n_s': 0.96, 'omega_b': 0.022, 'omega_cdm': 0.12, 'output': 'mPk'}, cosmo_Class=None, verbose=False)
Routine to compute Sij according to the flat-sky approximation See Eq. 16 of arXiv:1612.05958
- Parameters
z_arr (array_like) – Redshift array of size nz (must be >0)
kernels (array_like) – 2d array for the collection of kernels, shape (nbins,nz)
bin_centres (array_like) – Central values of redshift bins. Dimensions: (nbins,)
theta (float) – Radius of the survey mask in deg.
cosmo_params (dict, default default_cosmo_params) – Dictionary of cosmology or cosmological parameters that can be accepted by
classycosmo_Class (classy.Class object, default None) – classy.Class object containing precomputed cosmology. If you already have it and do not want PySSC to lose time recomputing cosmology with CLASS.
verbose (bool, default False) – Verbosity of the routine.
- Returns
Sij matrix of shape (nbins, nbins) in flat-sky approximation
- Return type
Array_like
Notes
The mask is assumed to be a circle with radius theta