-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
This Bug was originally discovered by @skrausse , thank you for reporting.
Describe the bug
When trying to use the delete_synchrofacts
method from Synchrotool
class in spike_train_synchrony.py
, in specific cases an IndexError is raised.
To Reproduce
- Install elephant and neo
- Run the following minimal example:
# fix synchrotool
import elephant, neo
import quantities as pq
from elephant import spike_train_synchrony
import elephant.spike_train_generation as stg
import numpy as np
np.random.seed(1) # set random seed 2 for no error
SPP = stg.StationaryPoissonProcess(50 * pq.Hz, t_start=0 * pq.ms,
t_stop=1000*pq.ms)
test_sts = SPP.generate_n_spiketrains(2)
sampling_rate = 30000*pq.Hz
test_obj = spike_train_synchrony.Synchrotool(
test_sts, sampling_rate=sampling_rate, spread=2)
test_obj.delete_synchrofacts(threshold=2, in_place=True)
Gives the following error messages: (if np.random.seed(1)
, if the random seed is set to 2 , no error is raised)
Traceback (most recent call last):
test_obj.delete_synchrofacts(threshold=2, in_place=True)
elephant/spike_train_synchrony.py", line 325, in delete_synchrofacts
self.annotate_synchrofacts()
elephant/spike_train_synchrony.py", line 407, in annotate_synchrofacts
complexity_per_spike = epoch_complexities[spike_to_epoch_idx]
IndexError: index 91 is out of bounds for axis 0 with size 91
Expected behavior
Index should not be out of bounds
Environment
- OS (e.g., Linux):Ubuntu 20.04.4 LTS (64-bit)
- How you installed elephant (
conda
,pip
, source): pip, source - Python version: 3.8
neo
python package version: 0.10.2elephant
python package version: 0.11.0quantities
: 0.13.0numpy
: 1.22.3
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior