lenspack.theory.distributions module

class lenspack.theory.distributions.zdist(alpha, beta, z0, zmax=None)[source]

Bases: object

Parameterized redshift probability distribution.

Continuous model of a redshift probability distribution.

The parameterized distribution is given by

n(z) = A * [(z / z0)^alpha] * exp[-(z / z0)^beta],

where A is the normalization factor.

Parameters
  • alpha (float) – Parameters of the distribution.

  • beta (float) – Parameters of the distribution.

  • z0 (float) – Parameters of the distribution.

  • zmax (float, optional) – Maximum redshift of the distribution. If given, the function returns zero for redshifts larger than zmax, and the normalization is computed by numerical integration. If None, np.inf is used, and the normalization is given by the gamma function. Default is None.

Notes

A good fit to the MICE simulated galaxy catalog are the parameters (alpha, beta, z0) = (0.88, 1.4, 0.78).

Examples

>>> nz = zdist(0.88, 1.4, 0.78)
>>> nz.A
2.0124103366443378
>>> nz.pdf([-0.5, 0, 0.5, 1.0, 1.5])
array([0.        , 0.        , 0.79567909, 0.60772375, 0.29427866])
>>> nz = zdist(0.88, 1.4, 0.78, zmax=1.4)
>>> nz.A
2.4324379840968535
>>> nz.pdf([-0.5, 0, 0.5, 1.0, 1.5])
array([0.        , 0.        , 0.96175219, 0.73456706, 0.        ])
pdf(z)[source]

Compute the probability density at a given redshift.

Parameters

z (array_like) – Redshift values.

Returns

Probability density at each z.

Return type

float or numpy array

cdf(z)[source]

Compute the cumulative probability up to a given redshift.

Parameters

z (array_like) – Redshift values.

Returns

Cumulative probability up to each z.

Return type

float or numpy array

fit(samples, zmax=None)[source]

Fit the distribution to a set of samples.

Parameters
  • samples (array_like) – Redshift samples.

  • zmax (float, optional) – Maximum redshift cutoff of the distribution. Default is None.

Notes

The current parameters (alpha, beta, z0) will be replaced by those of the fit.