summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2015-08-17 15:05:08 +0200
committerMario Mulansky <mario.mulansky@gmx.net>2015-08-17 15:05:08 +0200
commit0d7255c1fb7398720de10653efee617075c30892 (patch)
tree03bbb5c62ee8e48e6634da2387ad4a867cc6f25f /test
parentbe74318a2b269ec0c1e16981e7286679746f1a49 (diff)
fix for #14
test case and fix for Issue #14. Spike-Sync function now correctly deal with empty intervals as well.
Diffstat (limited to 'test')
-rw-r--r--test/test_empty.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_empty.py b/test/test_empty.py
index 48be25d..af7fb36 100644
--- a/test/test_empty.py
+++ b/test/test_empty.py
@@ -139,6 +139,18 @@ def test_spike_sync_empty():
assert_array_almost_equal(prof.x, [0.0, 0.2, 0.8, 1.0], decimal=15)
assert_array_almost_equal(prof.y, [0.0, 0.0, 0.0, 0.0], decimal=15)
+ # test with empty intervals
+ st1 = SpikeTrain([2.0, 5.0], [0, 10.0])
+ st2 = SpikeTrain([2.1, 7.0], [0, 10.0])
+ st3 = SpikeTrain([5.1, 6.0], [0, 10.0])
+ res = spk.spike_sync_profile(st1, st2).avrg(interval=[3.0, 4.0])
+ assert_equal(res, 1.0)
+ res = spk.spike_sync(st1, st2, interval=[3.0, 4.0])
+ assert_equal(res, 1.0)
+
+ sync_matrix = spk.spike_sync_matrix([st1, st2, st3], interval=[3.0, 4.0])
+ assert_array_equal(sync_matrix, np.ones((3, 3)) - np.diag(np.ones(3)))
+
if __name__ == "__main__":
test_get_non_empty()