Merge branch 'develop' into documentation

This commit is contained in:
fjosw 2023-07-18 11:08:01 +00:00
commit 9b06620d58
2 changed files with 81 additions and 38 deletions

View file

@ -572,6 +572,27 @@ def test_corr_symmetric():
assert scorr[0] == corr[0]
def test_corr_array_ndim1_init():
y = [pe.pseudo_Obs(2 + np.random.normal(0.0, 0.1), .1, 't') for i in np.arange(5)]
cc1 = pe.Corr(y)
cc2 = pe.Corr(np.array(y))
assert np.all([o1 == o2 for o1, o2 in zip(cc1, cc2)])
def test_corr_array_ndim3_init():
y = np.array([pe.pseudo_Obs(np.random.normal(2.0, 0.1), .1, 't') for i in np.arange(12)]).reshape(3, 2, 2)
tt1 = pe.Corr(list(y))
tt2 = pe.Corr(y)
tt3 = pe.Corr(np.array([pe.Corr(o) for o in y.reshape(3, 4).T]).reshape(2, 2))
assert np.all([o1 == o2 for o1, o2 in zip(tt1, tt2)])
assert np.all([o1 == o2 for o1, o2 in zip(tt1, tt3)])
assert tt1.T == y.shape[0]
assert tt1.N == y.shape[1] == y.shape[2]
with pytest.raises(ValueError):
pe.Corr(y.reshape(6, 2, 1))
def test_two_matrix_corr_inits():
T = 4
rn = lambda : np.random.normal(0.5, 0.1)