NeuralEnsemble / elephant

Elephant is the Electrophysiology Analysis Toolkit
http://www.python-elephant.org
BSD 3-Clause "New" or "Revised" License
202 stars 92 forks source link

[ENH] add include_t_stop flag to Synchrotool class, Issue 493 #637

Open Moritz-Alexander-Kern opened 4 months ago

Moritz-Alexander-Kern commented 4 months ago

This PR adresses #493.

New feature: include_t_stop flag in Synchrotool class

This pull request introduces a new feature to the Synchrotool class by adding the include_t_stop flag. This allows users to include the end of the spike train (t_stop) in the analysis, ensuring that any spikes close to t_stop are properly annotated.

Summary of changes

Examples

The following minimal example should not longer raise an index out of bounds error:

import neo
import numpy as np
import quantities as pq
from elephant.spike_train_synchrony import Synchrotool

sampling_rate = 1/pq.ms
st = neo.SpikeTrain(np.arange(0, 11)*pq.ms, t_start=0*pq.ms, t_stop=10*pq.ms)

synchrotool_instance = Synchrotool([st, st], sampling_rate, spread=0, include_t_stop=True)
synchrotool_instance.annotate_synchrofacts()
coveralls commented 4 months ago

Coverage Status

coverage: 88.278% (-0.1%) from 88.401% when pulling 1bc87524083acd97260deb42cfe2b715b8052070 on INM-6:fix/index_error_synchrotool_493 into 123ca040b11a5961643c4de080df89af9b1fcd24 on NeuralEnsemble:master.