sample_powerlaw¶
-
gammapy.utils.random.
sample_powerlaw
(x_min, x_max, gamma, size=None, random_state='random-seed')[source]¶ Sample random values from a power law distribution.
f(x) = x ** (-gamma) in the range x_min to x_max
It is assumed that gamma is the differential spectral index.
Reference: http://mathworld.wolfram.com/RandomNumber.html
Parameters: - x_min : float
x range minimum
- x_max : float
x range maximum
- gamma : float
Power law index
- size : int, optional
Number of samples to generate
- random_state : {int, ‘random-seed’, ‘global-rng’,
RandomState
} Defines random number generator initialisation. Passed to
get_random_state
.
Returns: - x : array
Array of samples from the distribution