Postprocessing Utilities ligo.skymap.postprocess.util

Postprocessing utilities for HEALPix sky maps.

ligo.skymap.postprocess.util.find_greedy_credible_levels(p, ranking=None)[source]

Find the greedy credible levels of a (possibly multi-dimensional) array.

Parameters:
pnp.ndarray

The input array, typically a HEALPix image.

rankingnp.ndarray, optional

The array to rank in order to determine the greedy order. The default is p itself.

Returns:
clsnp.ndarray

An array with the same shape as p, with values ranging from 0 to p.sum(), representing the greedy credible level to which each entry in the array belongs.

ligo.skymap.postprocess.util.interp_greedy_credible_levels(x, xp, fp, right=None)[source]

Perform linear interpolation suitable for finding credible levels.

The linear interpolation is performed with the boundary condition that \(f(x) = 0\).

Examples

>>> xp = [1, 2, 3, 4, 5]
>>> fp = [0.2, 0.4, 0.6, 0.8, 1.0]
>>> interp_greedy_credible_levels([0, 0.5, 1.0, 1.5, 2.0], xp, fp)
array([0. , 0.1, 0.2, 0.3, 0.4])
ligo.skymap.postprocess.util.smooth_ud_grade(m, nside, nest=False)[source]

Resample a sky map to a new resolution using bilinear interpolation.

Parameters:
mnp.ndarray

The input HEALPix array.

nestbool, default=False

Indicates whether the input sky map is in nested rather than ring-indexed HEALPix coordinates (default: ring).

Returns:
new_mnp.ndarray

The resampled HEALPix array. The sum of m is approximately preserved.