-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(foreground.poisson): fix cumulative_trapezoid call (#60)
* fix(foreground.poisson): fix cumulative_trapezoid call The first parameter is y (the values to intregrate), the second, optional, parameter is x, the axis of integration. Also use the `initial` parameter to prepend a zero the result, removing the need to pre-initialise the output array. * tests
- Loading branch information
1 parent
f0e5334
commit 488cf0b
Showing
4 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,3 +37,7 @@ nosetests.xml | |
.mr.developer.cfg | ||
.project | ||
.pydevproject | ||
|
||
#Editor rubble | ||
*~ | ||
.*.sw* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""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 |