This documentation is for astroML version 0.2

This page

Links

astroML Mailing List

GitHub Issue Tracker

Videos

Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)

Citing

If you use the software, please consider citing astroML.

11.6.8. astroML.stats.bivariate_normal

astroML.stats.bivariate_normal(mu=[0, 0], sigma_1=1, sigma_2=1, alpha=0, size=None, return_cov=False)

Sample points from a 2D normal distribution

Parameters :

mu : array-like (length 2)

The mean of the distribution

sigma_1 : float

The unrotated x-axis width

sigma_2 : float

The unrotated y-axis width

alpha : float

The rotation counter-clockwise about the origin

size : tuple of ints, optional

Given a shape of, for example, (m,n,k), m*n*k samples are generated, and packed in an m-by-n-by-k arrangement. Because each sample is N-dimensional, the output shape is (m,n,k,N). If no shape is specified, a single (N-D) sample is returned.

return_cov : boolean, optional

If True, return the computed covariance matrix.

Returns :

out : ndarray

The drawn samples, of shape size, if that was provided. If not, the shape is (N,).

In other words, each entry out[i,j,...,:] is an N-dimensional value drawn from the distribution.

cov : ndarray

The 2x2 covariance matrix. Returned only if return_cov == True.

Notes

This function works by computing a covariance matrix from the inputs, and calling np.random.multivariate_normal(). If the covariance matrix is available, this function can be called directly.