Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion elephant/spike_train_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ def run_p(spiketrain_j: neo.core.SpikeTrain,
tiled_spikes_j = np.isclose(
spiketrain_j.times.magnitude[:, np.newaxis],
spiketrain_i.times.magnitude,
atol=dt.item())
atol=dt.item(), rtol=0)
# Determine which spikes in spiketrain_j satisfy the time window
# condition.
tiled_spike_indices = np.any(tiled_spikes_j, axis=1)
Expand Down
9 changes: 9 additions & 0 deletions elephant/test/test_spike_train_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,15 @@ def test_sttc_unsorted_spiketimes(self):
sttc_sorted_E8_B3 = sc.sttc(spiketrain_E8,
spiketrain_B3, dt=0.10 * pq.s)
self.assertAlmostEqual(sttc_unsorted_E8_B3, sttc_sorted_E8_B3)

def test_sttc_window_independent_of_spike_time(self):
"""Two spikes 5.1 ms apart should not be coincident for dt = 5 ms at any
spike time."""

for t in [1., 20.]:
st1 = neo.SpikeTrain([t], units='s', t_stop=40.)
st2 = neo.SpikeTrain([t + 0.0051], units='s', t_stop=40.)
self.assertAlmostEqual(sc.sttc(st1, st2, dt=5 * pq.ms), -0.00025)

def test_sttc_validation_test(self):
"""This test checks the results of elephants implementation of
Expand Down