Random points (glass.points)#

The glass.points module provides functionality for simulating point processes on the sphere and sampling random positions.

Sampling#

glass.points.positions_from_delta(ngal, delta, bias=None, vis=None, *, bias_model='linear', remove_monopole=False, rng=None)#

Generate positions tracing a density contrast.

The map of expected number counts is constructed from the number density, density contrast, an optional bias model, and an optional visibility map.

If remove_monopole is set, the monopole of the computed density contrast is removed. Over the full sky, the mean number density of the map will then match the given number density exactly. This, however, means that an effectively different bias model is being used, unless the monopole is already zero in the first place.

The function supports multi-dimensional input for the ngal, delta, bias, and vis parameters. Extra dimensions are broadcast to a common shape, and treated as separate populations of points. These are then sampled independently, and the results concatenated into a flat list of longitudes and latitudes. The number of points per population is returned in count as an array in the shape of the extra dimensions.

Parameters:
ngalfloat or array_like

Number density, expected number of points per arcmin2.

deltaarray_like

Map of the input density contrast. This is fed into the bias model to produce the density contrast for sampling.

biasfloat or array_like, optional

Bias parameter, is passed as an argument to the bias model.

visarray_like, optional

Visibility map for the observed points. This is multiplied with the full sky number count map, and must hence be of compatible shape.

bias_modelstr or callable, optional

The bias model to apply. If a string, refers to a function in the points module, e.g. 'linear' for linear_bias() or 'loglinear' for loglinear_bias().

remove_monopolebool, optional

If true, the monopole of the density contrast after biasing is fixed to zero.

rngGenerator, optional

Random number generator. If not given, a default RNG is used.

Returns:
lon, latarray_like

Columns of longitudes and latitudes for the sampled points.

countint or array_like

The number of sampled points. If multiple populations are sampled, an array of counts in the shape of the extra dimensions is returned.

glass.points.uniform_positions(ngal, *, rng=None)#

Generate positions uniformly over the sphere.

The function supports array input for the ngal parameter.

Parameters:
ngalfloat or array_like

Number density, expected number of positions per arcmin2.

rngGenerator, optional

Random number generator. If not given, a default RNG will be used.

Returns:
lon, latarray_like or list of array_like

Columns of longitudes and latitudes for the sampled points.

countint or list of ints

The number of sampled points. For array inputs, an array of counts with the same shape is returned.

Bias#

glass.points.effective_bias(z, bz, w)#

Effective bias parameter from a redshift-dependent bias function.

This function takes a redshift-dependent bias function \(b(z)\) and computes an effective bias parameter \(\bar{b}\) for a given window function \(w(z)\).

Parameters:
z, bzarray_like

Redshifts and values of the bias function \(b(z)\).

wRadialWindow

The radial window function \(w(z)\).

Returns:
beffarray_like

Effective bias parameter for the window.

Notes

The effective bias parameter \(\bar{b}\) is computed using the window function \(w(z)\) as the weighted average

\[\bar{b} = \frac{\int b(z) \, w(z) \, dz}{\int w(z) \, dz} \;.\]

Bias models#

glass.points.linear_bias(delta, b)#

linear bias model \(\delta_g = b \, \delta\)

glass.points.loglinear_bias(delta, b)#

log-linear bias model \(\ln(1 + \delta_g) = b \ln(1 + \delta)\)