fix: array mode now works with elements defined on different ensembles

This commit is contained in:
Fabian Joswig 2021-12-07 07:36:24 +00:00
parent b0610544a8
commit df6b151c13
2 changed files with 7 additions and 8 deletions

View file

@ -29,10 +29,10 @@ def get_complex_matrix(dimension):
def test_matmul():
for dim in [4, 8]:
for dim in [4, 6]:
for const in [1, pe.cov_Obs(1.0, 0.002, 'cov')]:
my_list = []
length = 1000 + np.random.randint(200)
length = 100 + np.random.randint(200)
for i in range(dim ** 2):
my_list.append(pe.Obs([np.random.rand(length), np.random.rand(length + 1)], ['t1', 't2']))
my_array = const * np.array(my_list).reshape((dim, dim))
@ -41,7 +41,7 @@ def test_matmul():
assert e.is_zero(), t
my_list = []
length = 1000 + np.random.randint(200)
length = 100 + np.random.randint(200)
for i in range(dim ** 2):
my_list.append(pe.CObs(pe.Obs([np.random.rand(length), np.random.rand(length + 1)], ['t1', 't2']),
pe.Obs([np.random.rand(length), np.random.rand(length + 1)], ['t1', 't2'])))
@ -189,7 +189,7 @@ def test_matmul_irregular_histories():
standard_array = []
for i in range(dim ** 2):
standard_array.append(pe.Obs([np.random.normal(1.1, 0.2, length)], ['ens1']))
standard_matrix = np.array(standard_array).reshape((dim, dim)) * pe.cov_Obs(1.0, 0.002, 'cov') # * pe.pseudo_Obs(0.1, 0.002, 'qr')
standard_matrix = np.array(standard_array).reshape((dim, dim)) * pe.cov_Obs(1.0, 0.002, 'cov') * pe.pseudo_Obs(0.1, 0.002, 'qr')
for idl in [range(1, 501, 2), range(250, 273), [2, 8, 19, 20, 78]]:
irregular_array = []