mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 14:50:25 +01:00
test: added additional tests for non-overlapping configurations.
This commit is contained in:
parent
b3d030abf3
commit
f6df9d02f5
1 changed files with 53 additions and 0 deletions
|
@ -1038,6 +1038,7 @@ def test_hash():
|
|||
assert hash(obs) != hash(o1)
|
||||
assert hash(o1) != hash(o2)
|
||||
|
||||
|
||||
def test_gm_alias():
|
||||
samples = np.random.rand(500)
|
||||
|
||||
|
@ -1049,3 +1050,55 @@ def test_gm_alias():
|
|||
|
||||
assert np.isclose(tt1.dvalue, tt2.dvalue)
|
||||
|
||||
|
||||
def test_overlapping_missing_cnfgs():
|
||||
length = 200000
|
||||
|
||||
l_samp = np.random.normal(2.87, 0.5, length)
|
||||
s_samp = np.random.normal(7.87, 0.7, length // 2)
|
||||
|
||||
o1 = pe.Obs([l_samp], ["test"])
|
||||
o2 = pe.Obs([s_samp], ["test"], idl=[range(1, length, 2)])
|
||||
|
||||
a2 = pe.Obs([s_samp], ["alt"])
|
||||
t1 = o1 + o2
|
||||
t1.gm(S=0)
|
||||
|
||||
t2 = o1 + a2
|
||||
t2.gm(S=0)
|
||||
assert np.isclose(t1.dvalue, t2.dvalue, rtol=0.01)
|
||||
|
||||
|
||||
def test_non_overlapping_missing_cnfgs():
|
||||
length = 100000
|
||||
|
||||
xsamp = np.random.normal(1.0, 1.0, length)
|
||||
|
||||
|
||||
full = pe.Obs([xsamp], ["ensemble"], idl=[range(0, length)])
|
||||
full.gm()
|
||||
|
||||
even = pe.Obs([xsamp[0:length:2]], ["ensemble"], idl=[range(0, length, 2)])
|
||||
odd = pe.Obs([xsamp[1:length:2]], ["ensemble"], idl=[range(1, length, 2)])
|
||||
|
||||
average = (even + odd) / 2
|
||||
average.gm(S=0)
|
||||
assert np.isclose(full.dvalue, average.dvalue, rtol=0.01)
|
||||
|
||||
|
||||
def test_non_overlapping_product():
|
||||
length = 100000
|
||||
|
||||
samples = np.random.normal(0.93, 0.5, length)
|
||||
|
||||
e = pe.Obs([samples[0:length:2]], ["ensemble"], idl=[range(0, length, 2)])
|
||||
o = pe.Obs([samples[1:length:2]], ["ensemble"], idl=[range(1, length, 2)])
|
||||
prod1 = e * o
|
||||
prod1.gm(S=0)
|
||||
|
||||
e2 = pe.Obs([samples[0:length:2]], ["even"])
|
||||
o2 = pe.Obs([samples[1:length:2]], ["odd"])
|
||||
prod2 = e2 * o2
|
||||
prod2.gm(S=0)
|
||||
|
||||
assert np.isclose(prod1.dvalue, prod2.dvalue, rtol=0.01)
|
||||
|
|
Loading…
Add table
Reference in a new issue