mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 20:13:41 +02:00
fixed seed added to tests
This commit is contained in:
parent
1b63f5dd3b
commit
bb9790acd7
4 changed files with 12 additions and 1 deletions
|
@ -9,6 +9,8 @@ from scipy.odr import ODR, Model, Data, RealData
|
||||||
import pyerrors as pe
|
import pyerrors as pe
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
np.random.seed(0)
|
||||||
|
|
||||||
def test_standard_fit():
|
def test_standard_fit():
|
||||||
dim = 10 + int(30 * np.random.rand())
|
dim = 10 + int(30 * np.random.rand())
|
||||||
x = np.arange(dim)
|
x = np.arange(dim)
|
||||||
|
|
|
@ -11,6 +11,8 @@ from scipy.odr import ODR, Model, Data, RealData
|
||||||
import pyerrors as pe
|
import pyerrors as pe
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
np.random.seed(0)
|
||||||
|
|
||||||
def test_matrix_functions():
|
def test_matrix_functions():
|
||||||
dim = 3 + int(4 * np.random.rand())
|
dim = 3 + int(4 * np.random.rand())
|
||||||
print(dim)
|
print(dim)
|
||||||
|
|
|
@ -6,6 +6,8 @@ import copy
|
||||||
import pyerrors as pe
|
import pyerrors as pe
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
np.random.seed(0)
|
||||||
|
|
||||||
def test_dump():
|
def test_dump():
|
||||||
value = np.random.normal(5, 10)
|
value = np.random.normal(5, 10)
|
||||||
dvalue = np.abs(np.random.normal(0, 1))
|
dvalue = np.abs(np.random.normal(0, 1))
|
||||||
|
|
|
@ -2,7 +2,9 @@ import numpy as np
|
||||||
import pyerrors as pe
|
import pyerrors as pe
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
def test_find_root():
|
np.random.seed(0)
|
||||||
|
|
||||||
|
def test_root_linear():
|
||||||
|
|
||||||
def root_function(x, d):
|
def root_function(x, d):
|
||||||
return x - d
|
return x - d
|
||||||
|
@ -12,3 +14,6 @@ def test_find_root():
|
||||||
my_root = pe.roots.find_root(my_obs, root_function)
|
my_root = pe.roots.find_root(my_obs, root_function)
|
||||||
|
|
||||||
assert np.isclose(my_root.value, value)
|
assert np.isclose(my_root.value, value)
|
||||||
|
difference = my_obs - my_root
|
||||||
|
assert all(np.isclose(0.0, difference.deltas['t']))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue