Survey Setup Module

MGLensing.specs

class MGLensing.specs.CLOESetUp(config: dict)

Bases: object

class MGLensing.specs.EuclidSetUp(config: dict)

Bases: object

A class to set up the Euclid survey specifications and configurations.

Attributes:
survey_namestr

Name of the survey, default is ‘Euclid’.

observablestr

Observable configuration from the input config.

zminfloat

Minimum redshift value.

zmaxfloat

Maximum redshift value.

fskyfloat

Fraction of the sky covered by the survey.

gal_per_sqarcmnfloat

Number of galaxies per square arcminute.

gal_per_sqarcmn_sfloat

Number of source galaxies per square arcminute.

gal_per_sqarcmn_lfloat

Number of lens galaxies per square arcminute.

rms_shearfloat

Root mean square of the shear.

nbinint

Number of redshift bins.

z_bin_center_snp.ndarray

Centers of the source redshift bins.

z_bin_center_lnp.ndarray

Centers of the lens redshift bins.

eta_z_snp.ndarray

Normalized source galaxy distribution as a function of redshift.

eta_z_lnp.ndarray

Normalized lens galaxy distribution as a function of redshift.

zz_integrnp.ndarray

Array of redshift values used for integration.

zbin_integrint

Number of redshift bins used for integration.

noisedict

Dictionary containing noise values for different combinations of lensing and galaxy-galaxy correlations.

aa_integrnp.ndarray

Array of scale factors corresponding to the redshift values used for integration.

lminint

Minimum multipole value.

lbinint

Number of multipole bins.

lmaxfloat

Maximum multipole value.

ellnp.ndarray

Array of multipole values.

ell_bin_edgesnp.ndarray

Edges of the multipole bins.

d_ell_binnp.ndarray

Differences between consecutive multipole bin edges.

l_wl_bin_centersnp.ndarray

Centers of the multipole bins.

lum_funcnp.ndarray

Luminosity function data.

likelihoodstr

Likelihood configuration from the input config.

lmax_wl_vals, lmax_gc_valsnp.ndarray or float

Maximum scale-cuts.

l_wl, l_xc, l_gcnp.ndarray

Binned ell-values for different probes, for now l_xc=l_gc.

nell_wl, nell_xc, nell_gcint

Number of ell-bins per probe.

ells_wl, ells_gcnp.ndarray

All integer ell-values from lmin to lmax; required for likelihood with determinants.

ell_jump: int

Equals to lmax_gc, as we assume that lmax_gc<lmax_wl; required for likelihood with determinants.

mask_data_vector_wl, mask_data_vector_gc, mask_data_vector_3x2ptnp.ndarray

Boolean arrays to mask out data vectors for different lmax cuts in each redshift-bin.

mask_cov_wl, mask_cov_gc, mask_cov_3x2ptnp.ndarray

Boolean arrays to mask out covariances for different lmax cuts in each redshift-bin.

d_ell_bin_cut_wl, d_ell_bin_cut_xc, d_ell_bin_cut_gcnp.ndarray

Delta ell or bin width required for covariance computation.

ells_wl_max, ells_gc_maxnp.ndarray

Scale-cuts in the form appropriate for our plotting scripts.

galaxy_distribution(z)

Calculate the unnormalized galaxy distribution at a given redshift.

Parameters:

zfloat

The redshift at which to calculate the galaxy distribution.

Returns:

float

The unnormalized galaxy distribution at the given redshift.

get_norm_galaxy_distrib()

Returns the normalized source and lens galaxy distributions for each redshift value in each redshift bin. This function calculates the normalized galaxy distribution n(z) and the photo-z error for each redshift bin. The galaxy distribution is normalized using the trapezoidal rule for numerical integration.

Returns:

tuple
A tuple containing two numpy arrays:
  • norm_nz (numpy.ndarray): The normalized galaxy distribution for each redshift bin. Shape: (zbin_integr, nbin).

  • norm_nz (numpy.ndarray): The same normalized galaxy distribution, returned twice as the source distribution is equal to the lens distribution in Euclid. Shape: (zbin_integr, nbin).

photo_z_distribution(z, bin, tracer='s')

Calculate the photo-z error distribution for a given redshift and bin. It follows Eqs. (112, 113, 115) in https://arxiv.org/pdf/1910.09273.

Parameters:

zfloat

The redshift at which to calculate the photo-z error.

binint

The redshift bin index.

Returns:

float

The photo-z error distribution at the given redshift and bin.

class MGLensing.specs.LSSTSetUp(config: dict)

Bases: object

A class to set up the LSST survey specifications and configurations.

Attributes:
survey_namestr

Name of the survey, default is ‘LSST’.

observablestr

Observable configuration from the input config.

zminfloat

Minimum redshift value.

zmaxfloat

Maximum redshift value.

fskyfloat

Fraction of the sky covered by the survey.

gal_per_sqarcmnfloat

Number of galaxies per square arcminute.

gal_per_sqarcmn_sfloat

Number of source galaxies per square arcminute.

gal_per_sqarcmn_lfloat

Number of lens galaxies per square arcminute.

rms_shearfloat

Root mean square of the shear.

nbinint

Number of redshift bins.

z_bin_center_snp.ndarray

Centers of the source redshift bins.

z_bin_center_lnp.ndarray

Centers of the lens redshift bins.

eta_z_snp.ndarray

Normalized source galaxy distribution as a function of redshift.

eta_z_lnp.ndarray

Normalized lens galaxy distribution as a function of redshift.

zz_integrnp.ndarray

Array of redshift values used for integration.

zbin_integrint

Number of redshift bins used for integration.

noisedict

Dictionary containing noise values for different combinations of lensing and galaxy-galaxy correlations.

aa_integrnp.ndarray

Array of scale factors corresponding to the redshift values used for integration.

lminint

Minimum multipole value.

lbinint

Number of multipole bins.

lmaxfloat

Maximum multipole value.

ellnp.ndarray

Array of multipole values.

ell_bin_edgesnp.ndarray

Edges of the multipole bins.

d_ell_binnp.ndarray

Differences between consecutive multipole bin edges.

l_wl_bin_centersnp.ndarray

Centers of the multipole bins.

lum_funcnp.ndarray

Luminosity function data.

likelihoodstr

Likelihood configuration from the input config.

lmax_wl_valsnp.ndarray or float

Maximum scale-cuts for weak lensing.

lmax_gc_valsnp.ndarray or float

Maximum scale-cuts for galaxy clustering.

l_wlnp.ndarray

Binned ell-values for weak lensing.

l_xcnp.ndarray

Binned ell-values for cross-correlation.

l_gcnp.ndarray

Binned ell-values for galaxy clustering.

nell_wlint

Number of ell-bins for weak lensing.

nell_xcint

Number of ell-bins for cross-correlation.

nell_gcint

Number of ell-bins for galaxy clustering.

ells_wlnp.ndarray

All integer ell-values from lmin to lmax for weak lensing.

ells_gcnp.ndarray

All integer ell-values from lmin to lmax for galaxy clustering.

ell_jumpint

Equals to lmax_gc, as we assume that lmax_gc < lmax_wl; required for likelihood with determinants.

mask_data_vector_wlnp.ndarray

Boolean array to mask out data vectors for weak lensing.

mask_data_vector_gcnp.ndarray

Boolean array to mask out data vectors for galaxy clustering.

mask_data_vector_3x2ptnp.ndarray

Boolean array to mask out data vectors for 3x2pt.

mask_cov_wlnp.ndarray

Boolean array to mask out covariances for weak lensing.

mask_cov_gcnp.ndarray

Boolean array to mask out covariances for galaxy clustering.

mask_cov_3x2ptnp.ndarray

Boolean array to mask out covariances for 3x2pt.

d_ell_bin_cut_wlnp.ndarray

Delta ell or bin width required for covariance computation for weak lensing.

d_ell_bin_cut_xcnp.ndarray

Delta ell or bin width required for covariance computation for cross-correlation.

d_ell_bin_cut_gcnp.ndarray

Delta ell or bin width required for covariance computation for galaxy clustering.

ells_wl_maxnp.ndarray

Scale-cuts for weak lensing in the form appropriate for plotting scripts.

ells_gc_maxnp.ndarray

Scale-cuts for galaxy clustering in the form appropriate for plotting scripts.

get_norm_galaxy_distrib(file_name_l, file_name_s)

Reads the source and lens galaxy normalized distributions from a npy file and compresses them to the required number of redshifts.

get_norm_galaxy_distrib_sacc(file_name)

Reads the source and lens galaxy normalized distributions from a sacc file and compresses them to the required number of redshifts.

MGLensing.specs.check_length(scale_cuts_info, nbin_s, nbin_l)

Check the length of scale cuts information based on the type and number of bins.

Parameters:

scale_cuts_infodict

Dictionary containing scale cuts information with keys ‘type’, ‘max_WL’, and ‘max_GC’.

nbinint

Number of bins.

Raises:

ValueError

If the length of ‘max_WL’ or ‘max_GC’ does not match the expected number of bins.

MGLensing.specs.from_keff_to_lmax(n, k_eff, z_mod, params_dic)

Calculate lmax for given effective wavenumbers and redshift. Always for a lower photo-z: e.g., bin 2-1 or bin 4-1 will take k_eff for bin 1 to compute ell_max.

Parameters:

n (int): The number of bins. k_eff (list of float): The effective wavenumbers for each bin in h/Mpc. z_mod (list of float): The redshift, peak of the kernel, for each bin. params_dic (dict): Dictionary containing cosmological parameters.

Returns:

list of float: The calculated lmax values for each bin combination.

MGLensing.specs.get_luminosity_func(file_name)

Reads the luminosity function data from a file and returns an interpolation function.

Parameters:

file_namestr

The path to the file containing the luminosity function data.

Returns:

function

An interpolation function that takes redshift values and returns the corresponding luminosity values.

MGLensing.specs.get_noise(nbins, gal_per_sqarcmn)

Calculate the noise for a given number of redshift bins and galaxy density.

Parameters:

nbinsint

The number of redshift bins.

gal_per_sqarcmnfloat

The number of galaxies per square arcminute.

Returns:

float

The noise value for the given number of redshift bins and galaxy density.

MGLensing.specs.get_rcom(params_dic, z_max)

Calculate the comoving distance to a given redshift z_max.

Parameters:

params_dic (dict): Dictionary containing cosmological parameters.

Expected keys are ‘Omega_m’, ‘w0’, and ‘wa’. Defaults are used if keys are not present: ‘Omega_m’ defaults to 0.31, ‘w0’ defaults to -1.0, ‘wa’ defaults to 0.0.

z_max (float): The maximum redshift value to calculate the comoving distance for.

Returns:

float: The comoving distance to the given redshift z_max in units of Mpc/h.

MGLensing.specs.max_ells_for_plots(n1, n2, flat_array)
MGLensing.specs.reduce_len_by_averaging(arr_, target_len=400)

Reduces the length of an array by averaging its elements to match the target length.

Parameters:

arrlist or numpy.ndarray

The input array to be reduced.

target_lenint, optional

The desired length of the output array. Default is z_bins_for_integration.

Returns:

numpy.ndarray

The reduced array with the specified target length.

MGLensing.specs.setup_const_lmax(obj, likelihood)

Sets up the maximum multipole moments (lmax) for weak lensing (wl) and galaxy clustering (gc) based on the provided likelihood type. It also configures the ell bins, masks, and delta ells for covariance computation.

Parameters:

objobject

An object containing various attributes related to ell bins and lmax values.

likelihoodstr

The type of likelihood (‘determinants’ or other) to determine the setup process.

Returns:

None

MGLensing.specs.setup_lmax(obj)

Sets up the maximum multipole moments (lmax) for different probes in the given object. The function computes masks for data vectors and covariance matrices for weak lensing (wl) and galaxy clustering (gc) probes.

Parameters:

objobject

The object containing the necessary attributes for setting up lmax.

Attributes used from obj:

  • l_wl_bin_centers

  • d_ell_bin

  • ell_bin_edges

  • lmax_wl_vals

  • lmax_gc_vals

  • nbin

Returns:

None

MGLensing.specs.validate_and_setup_lmax(obj, scale_cuts_info, likelihood, lmin, lmax, zz_mod_wl, zz_mod_gg)

Validates and sets up the lmax values for weak lensing (WL) and galaxy clustering (GC) based on the provided scale cuts information.

Parameters:

objobject

The object containing the necessary attributes for setting up lmax values.

scale_cuts_infodict

Dictionary containing scale cuts information with keys: - ‘type’ (str): Type of scale cut (‘const_lmax’, ‘lmax’, or ‘kmax’). - ‘max_WL’ (list): Maximum l values for weak lensing. - ‘max_GC’ (list): Maximum l values for galaxy clustering. - ‘cosmo’ (dict, optional): Cosmological parameters required for ‘kmax’ type.

likelihoodstr

The likelihood approach (‘binned’ or other).

lminint

Minimum l value.

lmaxint

Maximum l value.

zz_mod_wlarray

Redshift modification array for weak lensing.

zz_mod_ggarray

Redshift modification array for galaxy clustering.

Raises:

ValueError

If any validation checks fail, such as: - lmax exceeding the provided maximum value. - Invalid scale cut type. - Incompatible likelihood approach for varied lmax. - lmax_gc being greater than lmax_wl in ‘const_lmax’ type.