diff --git a/elephant/spike_train_correlation.py b/elephant/spike_train_correlation.py index 908f8757c..65ded855c 100644 --- a/elephant/spike_train_correlation.py +++ b/elephant/spike_train_correlation.py @@ -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) diff --git a/elephant/test/test_spike_train_correlation.py b/elephant/test/test_spike_train_correlation.py index d1cad9547..481320298 100644 --- a/elephant/test/test_spike_train_correlation.py +++ b/elephant/test/test_spike_train_correlation.py @@ -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