InverseCDFSampler#

class gammapy.utils.random.InverseCDFSampler(pdf, axis=None, random_state=0)[source]#

Bases: object

Inverse CDF sampler.

It determines a set of random numbers and calculate the cumulative distribution function.

Parameters
pdfMap

Map of the predicted source counts.

axisint

Axis along which sampling the indexes.

random_state{int, ‘random-seed’, ‘global-rng’, RandomState}

Defines random number generator initialisation. Passed to get_random_state.

Methods Summary

sample(size)

Draw sample from the given PDF.

sample_axis()

Sample along a given axis.

Methods Documentation

sample(size)[source]#

Draw sample from the given PDF.

Parameters
sizeint

Number of samples to draw.

Returns
indextuple of ndarray

Coordinates of the drawn sample.

sample_axis()[source]#

Sample along a given axis.

Returns
indextuple of ndarray

Coordinates of the drawn sample.