|
@@ -1,16 +1,39 @@
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
-import pytest
|
|
|
-from interneuron_polarity.application import fib
|
|
|
+import numpy as np
|
|
|
+from interneuron_polarity.analysis.spike_trains import spikecounts
|
|
|
|
|
|
__author__ = "Paul Pfeiffer"
|
|
|
__copyright__ = "Paul Pfeiffer"
|
|
|
__license__ = "mit"
|
|
|
|
|
|
|
|
|
-def test_fib():
|
|
|
- assert fib(1) == 1
|
|
|
- assert fib(2) == 1
|
|
|
- assert fib(7) == 13
|
|
|
- with pytest.raises(AssertionError):
|
|
|
- fib(-10)
|
|
|
+def test_spikecounts_vanilla_case():
|
|
|
+ spike_trains = {
|
|
|
+ 0: np.array([0.9, 2.5]),
|
|
|
+ 1: np.array([0.5, 1.5])
|
|
|
+ }
|
|
|
+
|
|
|
+ t_start = 0
|
|
|
+ t_end = 3
|
|
|
+ dt = 1
|
|
|
+
|
|
|
+ expected_spikecounts = np.array([[1, 0, 1], [1, 1, 0]])
|
|
|
+ actual_spikecounts = spikecounts(spike_trains, dt, t_start, t_end)
|
|
|
+
|
|
|
+ np.testing.assert_equal(actual_spikecounts, expected_spikecounts)
|
|
|
+
|
|
|
+def test_spikecounts_at_the_bin_edges():
|
|
|
+ spike_trains = {
|
|
|
+ 0: np.array([0, 1]),
|
|
|
+ 1: np.array([2, 3])
|
|
|
+ }
|
|
|
+
|
|
|
+ t_start = 0
|
|
|
+ t_end = 3
|
|
|
+ dt = 1
|
|
|
+
|
|
|
+ expected_spikecounts = np.array([[1, 1, 0], [0, 0, 2]])
|
|
|
+ actual_spikecounts = spikecounts(spike_trains, dt, t_start, t_end)
|
|
|
+
|
|
|
+ np.testing.assert_equal(actual_spikecounts, expected_spikecounts)
|