From 209a2215dcb073ea9b649e0b6fcec8bdcf43bf02 Mon Sep 17 00:00:00 2001 From: "Pedro R. Pinheiro" <71903680+Pedro-RP@users.noreply.github.com> Date: Sat, 5 Dec 2026 22:01:54 +0100 Subject: [PATCH 1/2] applying STTC fix --- elephant/spike_train_correlation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) From 89e032999755d632a32acf93146de6f50988dcda Mon Sep 17 00:00:00 2001 From: "Pedro R. Pinheiro" <71903680+Pedro-RP@users.noreply.github.com> Date: Sat, 5 Dec 2026 22:04:55 +0100 Subject: [PATCH 2/2] adding a new STTC test --- elephant/test/test_spike_train_correlation.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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