threeML.random_variates module

class threeML.random_variates.RandomVariates(input_array, value=None)[source]

Bases: numpy.ndarray

A subclass of np.array which is meant to contain samples for one parameter. This class contains methods to easily compute properties for the parameter (errors and so on)

property average

Returns average value


Returns the equal tail interval, i.e., an interval centered on the median of the distribution with the same probability on the right and on the left of the mean.

If the distribution of the parameter is Gaussian and cl=0.68, this is equivalent to the 1 sigma confidence interval.


cl – confidence level (0 < cl < 1)


(low_bound, hi_bound)


Returns the Highest Posterior Density interval (HPD) for the parameter, for the given credibility level.

NOTE: the returned interval is the HPD only if the posterior is not multimodal. If it is multimodal, you should probably report the full posterior, not only an interval.


cl – credibility level (0 < cl < 1)


(low_bound, hi_bound)

property median

Returns median value

property samples
property std

Returns sample std value

property value
property var

Returns sample variance value