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)[source]

Sample points from a 2D normal distribution

Parameters
muarray-like (length 2)

The mean of the distribution

sigma_1float

The unrotated x-axis width

sigma_2float

The unrotated y-axis width

alphafloat

The rotation counter-clockwise about the origin

sizetuple 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_covboolean, optional

If True, return the computed covariance matrix.

Returns
outndarray

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.

covndarray

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.