sample_distribution#

atompy.sample_distribution(edges, values, size)[source]#

Sample a distribution described by edges and values.

Parameters:
edgesndarray, shape(n+1,)

The bin edges from the input distribution. Monotonically increasing.

valuesndarray, shape(n,)

The correpsonding values. Must be >=0 everywhere.

sizeint

Size of the output sample distribution.

Returns:
samplendarray, shape(size,)

A sample ranging from edges[0] to edges[-1] with a distribution corresponding to values.

Notes

See also Sample a random distribution.