diff --git a/tests/test_maps.py b/tests/test_maps.py index 959c5bf..f57e666 100644 --- a/tests/test_maps.py +++ b/tests/test_maps.py @@ -54,6 +54,6 @@ def test_pointsource(): pstd = pol.std(axis=-1) assert (pstd[:, 0] > 3.0).all() assert (pstd[:, 0] < 15.0).all() - assert (pol.std(axis=-1)[:, 1:3] > 0.01).all() - assert (pol.std(axis=-1)[:, 1:3] < 0.05).all() - assert (pol.std(axis=-1)[:, 3] == 0.0).all() + assert (pstd[:, 1:3] > 0.005).all() + assert (pstd[:, 1:3] < 0.015).all() + assert (pstd[:, 3] == 0.0).all() diff --git a/tests/test_poisson.py b/tests/test_poisson.py new file mode 100644 index 0000000..f4b40d7 --- /dev/null +++ b/tests/test_poisson.py @@ -0,0 +1,25 @@ +"""Test caput.foreground.poisson""" + +import numpy as np + +from cora.foreground.poisson import inhomogeneous_process_approx + +def test_inhomogeneous_process_approx(): + """Test inhomogeneous_process_approx""" + + # the most boringest rate function + rate = lambda s: 1000 * (5 - s) + + + + result = inhomogeneous_process_approx(5, rate) + + # Mean should be approximately 1.666 + mean = result.mean() + assert mean > 1.6 + assert mean < 1.75 + + # stdev should be approximately 1.2 + stdev = result.std() + assert stdev > 1.1 + assert stdev < 1.3