poisson_noise

sherpa.utils.poisson_noise(x, rng=None)[source] [edit on github]

Draw samples from a Poisson distribution.

Parameters:
Returns:

out – A random realisation of the input array, drawn from the Poisson distribution, as a SherpaFloat.

Return type:

scalar or array

Notes

All input vaules less than zero are replaced by zero.

Examples

When the rng parameter is left as None then the legacy Numpy random API is used:

>>> np.random.seed(17389)
>>> poisson_noise([10, 20, 5])
array([ 7.,  20.,   6.])

Note that the seed used by the legacy Numpy is not guaranteed to match the behavior of the numpy generators:

>>> rng = np.random.default_rng(17389)
>>> poisson_noise([10, 20, 5], rng=rng)
array([12., 31., 7.])