test for noise covariance computation
@@ -365,6 +365,9 @@ class TestNoiseComputations(unittest.TestCase):
residuals = residuals - np.mean(residuals, axis=0, keepdims=True)
res_list.append(residuals)
self.res_list = res_list
+ self.dataset = rsd.Dataset(
+ self.residuals,
+ obs_descriptors={'obs': np.repeat(np.arange(10), 10)})
def test_cov(self):
from rsatoolbox.data import cov_from_residuals
@@ -382,6 +385,20 @@ class TestNoiseComputations(unittest.TestCase):
from rsatoolbox.data import prec_from_residuals
cov = prec_from_residuals(self.res_list)
+ def test_unbalanced(self):
+ from rsatoolbox.data import cov_from_unbalanced
+ cov = cov_from_unbalanced(self.dataset, 'obs')
+
+ def test_dataset(self):
+ from rsatoolbox.data import cov_from_measurements
+ cov = cov_from_measurements(self.dataset, 'obs')
+
+ def test_equal(self):
+ from rsatoolbox.data import cov_from_measurements, cov_from_unbalanced
+ cov1 = cov_from_measurements(self.dataset, 'obs')
+ cov2 = cov_from_unbalanced(self.dataset, 'obs')
+ np.testing.assert_allclose(cov1, cov2)
+
class TestSave(unittest.TestCase):
def test_dict_conversion(self):
