bugfix lists of precisions
@@ -10,6 +10,7 @@ either the residuals (temporal based precision matrix) or of the measurements
from collections.abc import Iterable
import numpy as np
+
def sample_covariance(matrix):
"""
computes the sample covariance matrix from a 2d-array
@@ -66,7 +67,6 @@ def sample_covariance_3d(tensor):
einsum_tensor = np.stack(einsum_superset, axis=0)
xt_x_mean = np.mean(einsum_tensor, axis=0)
s_mean = np.mean(xt_x_mean, axis=0)
-
return s_mean, xt_x_mean
@@ -154,8 +154,8 @@ def prec_from_residuals(residuals, dof=None):
"""
cov = cov_from_residuals(residuals=residuals, dof=dof)
- prec = np.zeros(cov.shape)
if not isinstance(cov, np.ndarray) or len(cov.shape) > 2:
+ prec = [None] * len(cov)
for i in range(len(cov)):
prec[i] = np.linalg.inv(cov[i])
else:
