summaryrefslogtreecommitdiff
path: root/test/test_function.py
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2015-05-17 17:50:39 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2015-05-17 17:50:39 +0200
commita61a14295e28e6e95fa510693a11ae8c78a552ab (patch)
tree9d0194163e2ce6727603fde241c03b470339dad1 /test/test_function.py
parent8841138b74242ed9eb77c972c76e9a617778a79a (diff)
return correct values at exact spike times
pwc and pwl function object return the average of the left and right limit as function value at the exact spike times.
Diffstat (limited to 'test/test_function.py')
-rw-r--r--test/test_function.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/test_function.py b/test/test_function.py
index 8ad4b17..92d378d 100644
--- a/test/test_function.py
+++ b/test/test_function.py
@@ -26,13 +26,14 @@ def test_pwc():
assert_equal(f(0.0), 1.0)
assert_equal(f(0.5), 1.0)
assert_equal(f(1.0), 0.25)
+ assert_equal(f(2.0), 0.5)
assert_equal(f(2.25), 1.5)
assert_equal(f(2.5), 2.25/2)
assert_equal(f(3.5), 0.75)
assert_equal(f(4.0), 0.75)
- assert_array_equal(f([0.0, 0.5, 1.0, 2.25, 2.5, 3.5, 4.0]),
- [1.0, 1.0, 0.25, 1.5, 2.25/2, 0.75, 0.75])
+ assert_array_equal(f([0.0, 0.5, 1.0, 2.0, 2.25, 2.5, 3.5, 4.0]),
+ [1.0, 1.0, 0.25, 0.5, 1.5, 2.25/2, 0.75, 0.75])
xp, yp = f.get_plottable_data()
@@ -129,13 +130,15 @@ def test_pwl():
# function values
assert_equal(f(0.0), 1.0)
assert_equal(f(0.5), 1.25)
+ assert_equal(f(1.0), 0.5)
+ assert_equal(f(2.0), 1.1/2)
assert_equal(f(2.25), 1.5)
- assert_equal(f(2.5), 0.75)
+ assert_equal(f(2.5), 2.25/2)
assert_equal(f(3.5), 0.75-0.5*1.0/1.5)
assert_equal(f(4.0), 0.25)
- assert_array_equal(f([0.0, 0.5, 2.25, 2.5, 3.5, 4.0]),
- [1.0, 1.25, 1.5, 0.75, 0.75-0.5*1.0/1.5, 0.25])
+ assert_array_equal(f([0.0, 0.5, 1.0, 2.0, 2.25, 2.5, 3.5, 4.0]),
+ [1.0, 1.25, 0.5, 0.55, 1.5, 2.25/2, 0.75-0.5/1.5, 0.25])
xp, yp = f.get_plottable_data()