mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
520d506c5c
11 changed files with 143 additions and 143 deletions
|
@ -129,7 +129,7 @@ def test_m_eff():
|
|||
with pytest.warns(RuntimeWarning):
|
||||
my_corr.m_eff('sinh')
|
||||
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_corr.m_eff('unkown_variant')
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ def test_m_eff_negative_values():
|
|||
assert m_eff_log[padding + 1] is None
|
||||
m_eff_cosh = my_corr.m_eff('cosh')
|
||||
assert m_eff_cosh[padding + 1] is None
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_corr.m_eff('logsym')
|
||||
|
||||
|
||||
|
@ -155,7 +155,7 @@ def test_correlate():
|
|||
my_corr = pe.correlators.Corr([pe.pseudo_Obs(10, 0.1, 't'), pe.pseudo_Obs(0, 0.05, 't')])
|
||||
corr1 = my_corr.correlate(my_corr)
|
||||
corr2 = my_corr.correlate(my_corr[0])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(TypeError):
|
||||
corr3 = my_corr.correlate(7.3)
|
||||
|
||||
|
||||
|
@ -176,9 +176,9 @@ def test_fit_correlator():
|
|||
assert fit_res[0] == my_corr[0]
|
||||
assert fit_res[1] == my_corr[1] - my_corr[0]
|
||||
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(TypeError):
|
||||
my_corr.fit(f, "from 0 to 3")
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_corr.fit(f, [0, 2, 3])
|
||||
|
||||
|
||||
|
@ -256,11 +256,11 @@ def test_prange():
|
|||
corr = pe.correlators.Corr(corr_content)
|
||||
|
||||
corr.set_prange([2, 4])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
corr.set_prange([2])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(TypeError):
|
||||
corr.set_prange([2, 2.3])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
corr.set_prange([4, 1])
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ def test_grid_dirac():
|
|||
'SigmaYZ',
|
||||
'SigmaZT']:
|
||||
pe.dirac.Grid_gamma(gamma)
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.dirac.Grid_gamma('Not a gamma matrix')
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ def test_epsilon_tensor():
|
|||
(1, 1, 3) : 0.0}
|
||||
for key, value in check.items():
|
||||
assert pe.dirac.epsilon_tensor(*key) == value
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.dirac.epsilon_tensor(0, 1, 3)
|
||||
|
||||
|
||||
|
@ -59,5 +59,5 @@ def test_epsilon_tensor_rank4():
|
|||
(1, 2, 3, 1) : 0.0}
|
||||
for key, value in check.items():
|
||||
assert pe.dirac.epsilon_tensor_rank4(*key) == value
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.dirac.epsilon_tensor_rank4(0, 1, 3, 4)
|
||||
|
|
|
@ -61,9 +61,9 @@ def test_Obs_exceptions():
|
|||
my_obs.plot_rep_dist()
|
||||
with pytest.raises(Exception):
|
||||
my_obs.plot_piechart()
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(TypeError):
|
||||
my_obs.gamma_method(S='2.3')
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_obs.gamma_method(tau_exp=2.3)
|
||||
my_obs.gamma_method()
|
||||
my_obs.details()
|
||||
|
@ -199,7 +199,7 @@ def test_gamma_method_no_windowing():
|
|||
assert np.isclose(np.sqrt(np.var(obs.deltas['ens'], ddof=1) / obs.shape['ens']), obs.dvalue)
|
||||
obs.gamma_method(S=1.1)
|
||||
assert obs.e_tauint['ens'] > 0.5
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
obs.gamma_method(S=-0.2)
|
||||
|
||||
|
||||
|
@ -490,12 +490,12 @@ def test_reweighting():
|
|||
r_obs2 = r_obs[0] * my_obs
|
||||
assert r_obs2.reweighted
|
||||
my_covobs = pe.cov_Obs(1.0, 0.003, 'cov')
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.reweight(my_obs, [my_covobs])
|
||||
my_obs2 = pe.Obs([np.random.rand(1000)], ['t2'])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.reweight(my_obs, [my_obs + my_obs2])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.reweight(my_irregular_obs, [my_obs])
|
||||
|
||||
|
||||
|
@ -505,10 +505,10 @@ def test_merge_obs():
|
|||
merged = pe.merge_obs([my_obs1, my_obs2])
|
||||
diff = merged - my_obs2 - my_obs1
|
||||
assert diff == -(my_obs1.value + my_obs2.value) / 2
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.merge_obs([my_obs1, my_obs1])
|
||||
my_covobs = pe.cov_Obs(1.0, 0.003, 'cov')
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.merge_obs([my_obs1, my_covobs])
|
||||
|
||||
|
||||
|
@ -531,11 +531,11 @@ def test_correlate():
|
|||
assert corr1 == corr2
|
||||
|
||||
my_obs3 = pe.Obs([np.random.rand(100)], ['t'], idl=[range(2, 102)])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.correlate(my_obs1, my_obs3)
|
||||
|
||||
my_obs4 = pe.Obs([np.random.rand(99)], ['t'])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.correlate(my_obs1, my_obs4)
|
||||
|
||||
my_obs5 = pe.Obs([np.random.rand(100)], ['t'], idl=[range(5, 505, 5)])
|
||||
|
@ -544,10 +544,10 @@ def test_correlate():
|
|||
assert my_obs5.idl == corr3.idl
|
||||
|
||||
my_new_obs = pe.Obs([np.random.rand(100)], ['q3'])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.correlate(my_obs1, my_new_obs)
|
||||
my_covobs = pe.cov_Obs(1.0, 0.003, 'cov')
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
pe.correlate(my_covobs, my_covobs)
|
||||
r_obs = pe.reweight(my_obs1, [my_obs1])[0]
|
||||
with pytest.warns(RuntimeWarning):
|
||||
|
@ -774,7 +774,7 @@ def test_gamma_method_irregular():
|
|||
my_obs.gm()
|
||||
idl += [range(1, 400, 4)]
|
||||
my_obs = pe.Obs([dat for i in range(len(idl))], ['%s|%d' % ('A', i) for i in range(len(idl))], idl=idl)
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_obs.gm()
|
||||
|
||||
# check cases where tau is large compared to the chain length
|
||||
|
@ -1122,7 +1122,7 @@ def test_jackknife():
|
|||
|
||||
assert np.allclose(tmp_jacks, my_obs.export_jackknife())
|
||||
my_new_obs = my_obs + pe.Obs([full_data], ['test2'])
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(ValueError):
|
||||
my_new_obs.export_jackknife()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue