CorrHOD.weights#

CorrHOD.weights.sky_fraction(ra, dec, nside=256)[source][source]#

Computes the fraction of the sky covered by the survey.

Parameters:
  • ra (array_like) – Right ascension of the galaxies in degrees.

  • dec (array_like) – Declination of the galaxies in degrees.

  • nside (int, optional) – The nside parameter of the HEALPix map. Defaults to 256.

Returns:

fsky – The fraction of the sky covered by the survey.

Return type:

float

CorrHOD.weights.comoving_volume(cosmo, z_min, z_max, area: Optional[float] = None, fsky: Optional[float] = None)[source][source]#

Computes the comoving volume associated to the redshift bin [z_min, z_max].

Parameters:
  • cosmo – Cosmology object that can be used to compute the comoving distance. It must have a method comoving_radial_distance(z) that returns the comoving distance at redshift z.

  • z_min (float or array_like) – The minimum redshift of the redshift bin. (Can be an array, in which case the output is an array) Must be of the same format as z_max and same length if it is an array.

  • z_max (float or array_like) – The maximum redshift of the redshift bin. (Can be an array, in which case the output is an array) Must be of the same format as z_min and same length if it is an array.

  • area (float, optional) – The area of the survey in square degrees. Defaults to None.

  • fsky (float, optional) – The fraction of the sky covered by the survey. Can be provided instead of area. Defaults to None.

Returns:

comov_vol – Comoving volume associated to the redshift bin [z_min, z_max]. The output has the same format as z_min and z_max.

Return type:

float or array_like

CorrHOD.weights.ScottsBinEdges(data) ndarray[source][source]#

Computes the bin edges for a histogram using Scott’s rule. Scott’s rule is a rule of thumb for choosing the bin width of a histogram. It is based on the standard deviation of the data and is a function of the sample size. It is a good compromise when no other information is known about the data.

Parameters:

data (array_like) – The data we want to bin.

Returns:

edges – The edges of the bins. Length nbins + 1.

Return type:

ndarray

Notes

Scott’s rule defines the bin width as dx = 3.5 * sigma / n**(1/3), where sigma is the standard deviation of the data and n is the sample size. (The factor of 3.5 comes from a 24*np.sqrt(np.pi) factor at the power of 1/3).

CorrHOD.weights.n_z(z, cosmo, edges: Optional[list] = None, area: Optional[float] = None, fsky: Optional[float] = None) InterpolatedUnivariateSpline[source][source]#

Computes the number density of galaxies in the data in the given redshift bin.

Parameters:
  • z (array_like) – The redshift of the galaxies in the data.

  • cosmo – Cosmology object that can be used to compute the comoving distance. It must have a method comoving_radial_distance(z) that returns the comoving distance at redshift z.

  • edges (list, optional) – The edges of the bins used to compute the number density. If set to None, the edges are computed using Scott’s rule. Defaults to None.

  • area (float, optional) – The area of the survey in square degrees. Defaults to None.

  • fsky (float, optional) – The fraction of the sky covered by the survey. Can be provided instead of area. Defaults to None.

Returns:

n_func – The number density as a function of redshift. It can be called as n_func(z) to get the number density at redshift z.

Return type:

InterpolatedUnivariateSpline

Notes

The number density is computed as n(z) = N(z) / V(z), where N(z) is the number of galaxies in the redshift bin [z_min, z_max] and V(z) is the comoving volume associated to the redshift bin [z_min, z_max].

CorrHOD.weights.w_fkp(z_data, z_random, cosmo, edges: Optional[list] = None, area: Optional[float] = None, fsky: Optional[float] = None, P0: float = 7000)[source][source]#

Computes the FKP weights for the data, and returns a column containing the FKP weights. (If cuts need to be applied, they should be applied before calling this function.)

Parameters:
  • z_data (array_like) – The redshift of the galaxies in the data.

  • z_random (array_like) – The redshift of the galaxies in the randoms.

  • cosmo – Cosmology object that can be used to compute the comoving distance. It must have a method comoving_radial_distance(z) that returns the comoving distance at redshift z.

  • edges (list, optional) – The edges of the bins used to compute the number density. If set to None, the edges are computed using Scott’s rule. Defaults to None.

  • area (float, optional) – The area of the survey in square degrees. Defaults to None.

  • fsky (float, optional) – The fraction of the sky covered by the survey. Can be provided instead of area. Defaults to None.

  • P0 (float, optional) – The power spectrum normalization (TODO : Check this definition). Defaults to 7000 for the BGS.

Returns:

  • weight_data (array_like) – The FKP weights for the data for the respective galaxies in z_data.

  • weight_random (array_like) – The FKP weights for the data for the respective galaxies in z_random.

CorrHOD.weights.get_quantiles_weight(density, randoms_weights, nquantiles=10)[source][source]#

Gets the weights of the quantiles of the density.

Parameters:
  • density (array_like) – The density of the data.

  • randoms_weights (array_like) – The weights of the randoms.

  • nquantiles (int, optional) – The number of quantiles to use. Defaults to 10.