selection_functions

class selfisys.selection_functions.LognormalSelection(L=None, selection_params=None, survey_mask_path=None, local_select_path=None, size=None)[source]

Bases: object

Class to generate radial selection functions.

init_selection(reset=False)[source]

Initialise the radial selection functions.

Parameters:

reset (bool, optional) – Whether to reset the selection function.

lognormals_z_to_x(xx, mask, params, spline)[source]

Convert log-normal distributions from redshift to distance.

Parameters:
  • xx (array-like) – Comoving distances at which to evaluate the distributions.

  • mask (ndarray or None) – Survey mask C(n).

  • params (tuple of arrays) – Parameters for the distributions (ss, mm, rr).

  • spline (UnivariateSpline) – Linear interpolator for the distance-redshift relation.

Returns:

Tuple containing redshifts and list of distributions.

Return type:

tuple

multiple_lognormal(x, mask, ss, ll, rr)[source]

Compute multiple log-normal distributions.

Parameters:
  • x (ndarray) – Input array.

  • mask (ndarray or None) – Survey mask C(n).

  • ss (array_like) – Standard deviations for each distribution.

  • ll (array_like) – Means for each distribution.

  • rr (array_like) – Rescaling factors for each distribution.

Returns:

List of log-normal distributions.

Return type:

list of ndarray

multiple_lognormal_z(x, mask, ss, mm, rr)[source]

Compute multiple rescaled lognormal distributions as functions of redshift.

Parameters:
  • x (ndarray) – Input array (redshifts).

  • mask (ndarray or None) – Survey mask C(n).

  • ss (array_like) – Standard deviations of the lognormal distributions.

  • mm (array_like) – Means of the lognormal distributions.

  • rr (array_like) – Rescaling factors for each distribution.

Returns:

List of log-normal distributions.

Return type:

list of ndarray

static one_lognormal(x, std, mean, rescale=None)[source]

Rescaled log-normal distribution.

Parameters:
  • x (ndarray) – Input array.

  • std (float) – Standard deviation of the distribution.

  • mean (float) – Mean of the distribution.

  • rescale (float, optional) – Rescaling factor. If None, the distribution is normalised such that its maximum value is 1.

Returns:

Log-normal distribution evaluated at x.

Return type:

ndarray

static one_lognormal_z(x, sig2, mu, rescale=None)[source]

Compute a log-normal distribution in redshift.

Parameters:
  • x (ndarray) – Input array.

  • sig2 (float) – Variance of the distribution.

  • mu (float) – Mean of the distribution.

  • rescale (float, optional) – Rescaling factor.

Returns:

Log-normal distribution evaluated at x.

Return type:

ndarray

r_grid()[source]

Compute the grid of radial distances in the simulation box.

Returns:

3D array of radial distances from the origin.

Return type:

ndarray

Raises:

AttributeError – If the ‘size’ attribute is not defined.