Skip to content

Commit

Permalink
fix checks
Browse files Browse the repository at this point in the history
  • Loading branch information
OriolAbril committed Aug 2, 2022
1 parent 69593cb commit 3d7a512
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/xarray_einstats/stats.py
Expand Up @@ -5,8 +5,8 @@

import numpy as np
import xarray as xr
from scipy import stats
from numpy.linalg import LinAlgError
from scipy import stats

from .linalg import cholesky, eigh

Expand Down Expand Up @@ -369,7 +369,7 @@ def rvs(self, mean=None, cov=None, dims=None, *, size=1, rv_dims=None, random_st
except LinAlgError:
k = len(cov[dim1])
eye = xr.DataArray(np.eye(k), dims=list(dims))
cov_chol = cholesky(cov + 1e-10*eye, dims=dims)
cov_chol = cholesky(cov + 1e-10 * eye, dims=dims)
std_norm = XrContinuousRV(stats.norm, xr.zeros_like(mean.rename({dim1: dim2})), 1)
samples = std_norm.rvs(size=size, dims=rv_dims, random_state=random_state)
return mean + xr.dot(cov_chol, samples, dims=dim2)
Expand Down

0 comments on commit 3d7a512

Please sign in to comment.