mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
tests: test for smooth_eigenvalues functionality added.
This commit is contained in:
parent
6aab72cf0e
commit
5e550f4321
1 changed files with 17 additions and 0 deletions
|
@ -736,6 +736,23 @@ def test_covariance_factorizing():
|
|||
assert np.isclose(pe.covariance([mt0, tt[1]])[0, 1], -pe.covariance(tt)[0, 1])
|
||||
|
||||
|
||||
def test_covariance_smooth_eigenvalues():
|
||||
for c_coeff in range(0, 14, 2):
|
||||
length = 14
|
||||
sm = 5
|
||||
t_fac = 1.5
|
||||
tt = pe.misc.gen_correlated_data(np.zeros(length), 1 - 0.1 ** c_coeff * np.ones((length, length)) + 0.1 ** c_coeff * np.diag(np.ones(length)), 'test', tau=0.5 + t_fac * np.random.rand(length), samples=200)
|
||||
[o.gamma_method() for o in tt]
|
||||
full_corr = pe.covariance(tt, correlation=True)
|
||||
cov = pe.covariance(tt, smooth=sm, correlation=True)
|
||||
|
||||
full_evals = np.linalg.eigh(full_corr)[0]
|
||||
sm_length = np.where(full_evals < np.mean(full_evals[:-sm]))[0][-1]
|
||||
|
||||
evals = np.linalg.eigh(cov)[0]
|
||||
assert np.all(np.isclose(evals[:sm_length], evals[0], atol=1e-8))
|
||||
|
||||
|
||||
def test_covariance_alternation():
|
||||
length = 12
|
||||
t_fac = 2.5
|
||||
|
|
Loading…
Add table
Reference in a new issue