elephant icon indicating copy to clipboard operation
elephant copied to clipboard

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

Open Moritz-Alexander-Kern opened this issue 7 months ago • 1 comments

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

  • added include_t_stop as a new optional boolean parameter to the Synchrotool class constructor. If set to True, the spikes close to t_stop of the spike train are included in the analysis.
  • added description of the new parameter to the Synchrotool class docstring.

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()

Moritz-Alexander-Kern avatar Jul 17 '24 07:07 Moritz-Alexander-Kern