Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ketiltrout committed Aug 14, 2024
1 parent 06b9b0e commit 15a173f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
25 changes: 25 additions & 0 deletions tests/test_poisson.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 15a173f

Please sign in to comment.