mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
feat: Warning added when trying to estimate a covariance matrix from
observables with too few samples.
This commit is contained in:
parent
cec0ec83d7
commit
5dd365a997
1 changed files with 5 additions and 0 deletions
|
@ -1354,6 +1354,11 @@ def covariance(obs, visualize=False, correlation=False, **kwargs):
|
|||
'''
|
||||
|
||||
length = len(obs)
|
||||
|
||||
max_samples = np.max([o.N for o in obs])
|
||||
if max_samples <= length:
|
||||
warnings.warn(f"The dimension of the covariance matrix ({length}) is larger or equal to the number of samples ({max_samples}). This will result in a rank deficient matrix.", RuntimeWarning)
|
||||
|
||||
cov = np.zeros((length, length))
|
||||
for i in range(length):
|
||||
for j in range(i, length):
|
||||
|
|
Loading…
Add table
Reference in a new issue