Definition (definition)

Produce survey definition and specifications for processing and analysing cosmological data.

generate_mask_by_sky_fraction(coord_system)

Generate mask function given the sky fraction corresponding to a spherical cap (rather than a wedge).

generate_mask_from_map(coord_system[, ...])

Generate mask function from a veto mask map.

generate_selection_by_distribution(...[, ...])

Generate selection function based on a probability distribution suitably rescale horizontally and vectically.

generate_selection_from_samples(...)

Generate selection function interpolated from normalised selection function samples at sample coodinates.

generate_selection_samples(...[, ...])

Generate selection function samples from redshift samples.


harmonia.surveyor.definition.generate_mask_by_sky_fraction(coord_system, sky_fraction=1.0, box_shift=None)[source]

Generate mask function given the sky fraction corresponding to a spherical cap (rather than a wedge).

Parameters:
  • coord_system ({‘cartesian’, ‘spherical’, ‘sky’}) – Coordinate system of the generated mask function. If ‘sky’, the returned function can accept either 2-d or 3-d coordinates.

  • sky_fraction (float, optional) – Sky coverage, 0 < sky_fraction <= 1.

  • box_shift (float, array_like or None, optional) – Passed as box_centre to to_box_coords() so that the resulting mask function accepts Cartesian coordinates with origin at a box corner. Ignored unless coord_system is ‘cartesian’.

Returns:

mask_function – A mask function accepting coord_system as its coordinate system and returning boolean values.

Return type:

callable

harmonia.surveyor.definition.generate_mask_from_map(coord_system, mask_map=None, nside=None, mask_map_file=None, box_shift=None, ret_nside=False)[source]

Generate mask function from a veto mask map.

Parameters:
  • coord_system ({‘cartesian’, ‘spherical’, ‘sky’}) – Coordinate system of the generated mask function. If ‘sky’, the returned function can accept either 2-d or 3-d coordinates.

  • mask_map (numpy.ndarray or None, optional) – A veto array corresponding to pixels in a healpy mask map with parameter nside (default is None). Ignored if a healpy-generated .fits file for the mask map is provided.

  • nside (int or None, optional) – ‘NSIDE’ parameter of the healpy mask map (default is None). Ignored if a healpy-generated .fits file for the mask map is provided.

  • mask_map_file (str or pathlib.Path) – healpy-generated .fits file for the mask map. Must contain the ‘NSIDE’ parameter in its header.

  • box_shift (float, array_like or None, optional) – Passed as box_centre to to_box_coords() so that the resulting mask function accepts Cartesian coordinates with origin at a box corner. Ignored unless coord_system is ‘cartesian’.

  • ret_nside (bool, optional) – If True (default is False), return the nside parameter from mask_map read in.

Returns:

mask_function – A mask function accepting coord_system as its coordinate system and returning boolean values.

Return type:

callable

harmonia.surveyor.definition.generate_selection_by_distribution(coord_scale, distribution, peak, scale=None, location=None, shape=None)[source]

Generate selection function based on a probability distribution suitably rescale horizontally and vectically.

Notes

If the generated selection function detects 3-d input coordinate arrays, it would assume the coordinates are the Cartesian; otherwise it assumes the coordinates are the radial coordinate.

Parameters:
  • coord_scale (float) – Coordinate scale of the selection function, e.g. the maximum comoving radius of a catalogue.

  • peak (float) – Peak value of the selection function used for renormalising the probability density function by its maximum value.

  • distribution ({‘gaussian’, ‘gamma’}) – Distribution to use, either ‘gaussian’ or ‘gamma’.

  • scale, location, shape (float or None, optional) – Scale, location and shape parameter of the distribution. For a normal distribution, scale is the standard deviation and location is the mean in units of coord_scale; for a gamma distribution, see scipy.stats.gamma.

Returns:

Normalised selection function of the same coordinate as the sample coordinates.

Return type:

callable

harmonia.surveyor.definition.generate_selection_by_cut(low_end, high_end)[source]

Generate selection function at a constant value by a cut.

Notes

If the generated selection function detects 3-d input coordinate arrays, it would assume the coordinates are the Cartesian; otherwise it assumes the coordinates are the radial coordinate.

Parameters:

low_end, high_end (float) – Low and high end of the cut in some selection coordinate.

Returns:

Constant cut selection function.

Return type:

callable

harmonia.surveyor.definition.generate_selection_samples(selection_coordinate, coord_scale, redshift_samples, cosmo, sky_fraction=1.0, bins=None)[source]

Generate selection function samples from redshift samples.

The selection function is normalised by the mean number density inferred from the samples and the sky fraction.

Parameters:
  • selection_coordinate ({‘z’, ‘r’}) – Coordinate of the generated selection function, either redshift ‘z’ or comoving distance ‘r’.

  • coord_scale (float) – Coordinate scale used to rescale the selection coordinates, e.g. the maximum comoving radius of the catalogue to which the selection function is applied.

  • redshift_samples (float, array_like) – Redshift samples.

  • cosmo (nbodykit.cosmology.cosmology.Cosmology) – Cosmological model providing the redshift-to-distance conversion and thus normalisation of the selection function by volume.

  • sky_fraction (float, optional) – The sky coverage of redshift samples as a fraction used to normalise the selection function (default is 1.), 0 < sky_fraction <= 1.

  • bins (int, str or None, optional) – Number of bins or binning scheme used to generate the selection function samples (see numpy.histogram_bin_edges()). If None (default), Scott’s rule for binning is used.

Returns:

samples, coords – Normalised (dimensionless) selection function samples and corresponding coordinates.

Return type:

numpy.ndarray

harmonia.surveyor.definition.generate_selection_from_samples(sample_selections, sample_coords)[source]

Generate selection function interpolated from normalised selection function samples at sample coodinates.

Notes

If the generated selection function detects 3-d input coordinate arrays, it would assume the coordinates are the Cartesian; otherwise it assumes the coordinates are the radial coordinate.

Parameters:

sample_selections, sample_coords (float numpy.ndarray) – Selection function samples and coordinates.

Returns:

Normalised selection function of the same coordinate as the sample coordinates.

Return type:

callable