Distribution

class astropy.uncertainty.Distribution[source]

Bases: object

A scalar value or array values with associated uncertainty distribution.

This object will take its exact type from whatever the samples argument is. In general this is expected to be an Quantity or numpy.ndarray, although anything compatible with numpy.asanyarray is possible.

See also: http://docs.astropy.org/en/stable/uncertainty/

Parameters:
samples : array-like

The distribution, with sampling along the leading axis. If 1D, the sole dimension is used as the sampling axis (i.e., it is a scalar distribution).

Attributes Summary

distribution
n_samples The number of samples of this distribution.
pdf_mad(self[, out]) The median absolute deviation of this distribution.
pdf_mean(self[, dtype, out]) The mean of this distribution.
pdf_median(self[, out]) The median of this distribution.
pdf_smad(self[, out]) The median absolute deviation of this distribution rescaled to match the standard deviation for a normal distribution.
pdf_std(self[, dtype, out, ddof]) The standard deviation of this distribution.
pdf_var(self[, dtype, out, ddof]) The variance of this distribution.

Methods Summary

pdf_histogram(self, \*\*kwargs) Compute histogram over the samples in the distribution.
pdf_percentiles(self, percentile, \*\*kwargs) Compute percentiles of this Distribution.

Attributes Documentation

distribution
n_samples

The number of samples of this distribution. A single int.

pdf_mad(self, out=None) = <function Distribution.pdf_mad>[source]
pdf_mean(self, dtype=None, out=None) = <function Distribution.pdf_mean>[source]
pdf_median(self, out=None) = <function Distribution.pdf_median>[source]
pdf_smad(self, out=None) = <function Distribution.pdf_smad>[source]
pdf_std(self, dtype=None, out=None, ddof=0) = <function Distribution.pdf_std>[source]
pdf_var(self, dtype=None, out=None, ddof=0) = <function Distribution.pdf_var>[source]

Methods Documentation

pdf_histogram(self, **kwargs)[source]

Compute histogram over the samples in the distribution.

Parameters:
All keyword arguments are passed into `astropy.stats.histogram`. Note
That some of these options may not be valid for some multidimensional
distributions.
Returns:
hist : array

The values of the histogram. Trailing dimension is the histogram dimension.

bin_edges : array of dtype float

Return the bin edges (length(hist)+1). Trailing dimension is the bin histogram dimension.

pdf_percentiles(self, percentile, **kwargs)[source]

Compute percentiles of this Distribution.

Parameters:
percentile : float or array of floats or Quantity

The desired precentiles of the distribution (i.e., on [0,100]). Quantity will be converted to percent, meaning that a dimensionless_unscaled Quantity will be interpreted as a quantile.

Additional keywords are passed into `numpy.percentile`.
Returns:
percentiles : Quantity

The fracs percentiles of this distribution.