Observations

The following functions provide functionality for simulating observational effects of surveys.

Redshift distribution

glass.gaussian_nz(z, mean, sigma, *, norm=None)[source]

Gaussian redshift distribution.

The redshift follows a Gaussian distribution with the given mean and standard deviation.

If mean or sigma are array_like, their axes will be the leading axes of the redshift distribution.

Parameters:
Returns:

The redshift distribution at the given z values.

Return type:

ndarray[Any, dtype[float64]]

glass.smail_nz(z, z_mode, alpha, beta, *, norm=None)[source]

Redshift distribution following Smail et al. (1994).

The redshift follows the Smail et al. [1] redshift distribution.

Parameters:
  • z (ndarray[Any, dtype[float64]]) – Redshift values of the distribution.

  • z_mode (ndarray[Any, dtype[float64]]) – Mode of the redshift distribution, must be positive.

  • alpha (ndarray[Any, dtype[float64]]) – Power law exponent (z/z0)^alpha, must be positive.

  • beta (ndarray[Any, dtype[float64]]) – Log-power law exponent exp[-(z/z0)^beta], must be positive.

  • norm (ndarray[Any, dtype[float64]] | None) – If given, the normalisation of the distribution.

Returns:

The redshift distribution at the given z values.

Return type:

ndarray[Any, dtype[float64]]

Notes

The probability distribution function \(p(z)\) for redshift \(z\) is given by Amara & Refregier [2] as

\[p(z) \sim \left(\frac{z}{z_0}\right)^\alpha \exp\left[-\left(\frac{z}{z_0}\right)^\beta\right] \;,\]

where \(z_0\) is matched to the given mode of the distribution.

References

  • [1] Smail I., Ellis R. S., Fitchett M. J., 1994, MNRAS, 270, 245

  • [2] Amara A., Refregier A., 2007, MNRAS, 381, 1018

glass.fixed_zbins(zmin, zmax, *, nbins=None, dz=None)[source]

Tomographic redshift bins of fixed size.

This function creates contiguous tomographic redshift bins of fixed size. It takes either the number or size of the bins.

Parameters:
  • zmin (float) – Extent of the redshift binning.

  • zmax (float) – Extent of the redshift binning.

  • nbins (int | None) – Number of redshift bins. Only one of nbins and dz can be given.

  • dz (float | None) – Size of redshift bin. Only one of nbins and dz can be given.

Returns:

A list of redshift bin edges.

Raises:

ValueError – If both nbins and dz are given.

Return type:

list[tuple[float, float]]

glass.equal_dens_zbins(z, nz, nbins)[source]

Equal density tomographic redshift bins.

This function subdivides a source redshift distribution into nbins tomographic redshift bins with equal density.

Parameters:
  • z (ndarray[Any, dtype[float64]]) – The source redshift distribution. Must be one-dimensional.

  • nz (ndarray[Any, dtype[float64]]) – The source redshift distribution. Must be one-dimensional.

  • nbins (int) – Number of redshift bins.

Returns:

A list of redshift bin edges.

Return type:

list[tuple[float, float]]

glass.tomo_nz_gausserr(z, nz, sigma_0, zbins)[source]

Tomographic redshift bins with a Gaussian redshift error.

This function takes a _true_ overall source redshift distribution z, nz and returns tomographic source redshift distributions for the tomographic redshift bins given by zbins. It is assumed that sources are assigned a tomographic redshift bin with a Gaussian error [1]. The standard deviation of the Gaussian depends on redshift and is given by sigma(z) = sigma_0*(1 + z).

Parameters:
  • z (ndarray[Any, dtype[float64]]) – The true source redshift distribution. Must be one-dimensional.

  • nz (ndarray[Any, dtype[float64]]) – The true source redshift distribution. Must be one-dimensional.

  • sigma_0 (float) – Redshift error in the tomographic binning at zero redshift.

  • zbins (list[tuple[float, float]]) – List of redshift bin edges.

Returns:

The tomographic redshift bins convolved with a gaussian error. Array has a shape (nbins, len(z))

Return type:

ndarray[Any, dtype[float64]]

See also

equal_dens_zbins

produce equal density redshift bins

fixed_zbins

produce redshift bins of fixed size

References

  • [1] Amara A., Réfrégier A., 2007, MNRAS, 381, 1018.

    doi:10.1111/j.1365-2966.2007.12271.x

Visibility

glass.vmap_galactic_ecliptic(nside, galactic=(30, 90), ecliptic=(20, 80))[source]

Visibility map masking galactic and ecliptic plane.

This function returns a visibility map that blocks out stripes for the galactic and ecliptic planes. The location of the stripes is set with optional parameters.

Parameters:
  • nside (int) – The NSIDE parameter of the resulting HEALPix map.

  • galactic (tuple[float, float]) – The location of the galactic plane in the respective coordinate system.

  • ecliptic (tuple[float, float]) – The location of the ecliptic plane in the respective coordinate system.

Returns:

A HEALPix visibility map.

Raises:
  • TypeError – If the galactic argument is not a pair of numbers.

  • TypeError – If the ecliptic argument is not a pair of numbers.

Return type:

ndarray[Any, dtype[float64]]