You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spiketrains can contain spikes with spiketimes <= spiketrain.t_stop. The Synchrotool can only annotate Spikes with a spike time <= spiketrain.t_stop - (0.5/sampling_rate). If the spike time is larger you get an IndexError.
To Reproduce
Create a neo.spiketrain with a spike at t_stop
Access the Sychrotool
Use Synchrotool.annotate_synchrofacts() or Synchrotool.delete_synchrofacts()
Hi, thanks for the report. I believe this is very similar to Issue NeuralEnsemble#493 .
Indeed it is, @jo460464 already found the relevant code in the complexity class, where the t_stop bin is excluded and therefore leads to a failure.
def _epoch_no_spread(self):
"""
Get an epoch object of the complexity distribution with `spread` = 0
"""
left_edges = self.time_histogram.times
durations = self.bin_size * np.ones(self.time_histogram.shape)
if self.sampling_rate:
# ensure that spikes are not on the bin edges
bin_shift = .5 / self.sampling_rate
left_edges -= bin_shift
# Ensure that an epoch does not start before the minimum t_start.
# Note: all spike trains share the same t_start and t_stop.
if left_edges[0] < self.t_start:
left_edges[0] = self.t_start
durations[0] -= bin_shift
else:
warnings.warn('No sampling rate specified. '
'Note that using the complexity epoch to get '
'precise spike times can lead to rounding errors.')
complexity = self.time_histogram.magnitude.flatten()
complexity = complexity.astype(np.uint16)
epoch = neo.Epoch(left_edges,
durations=durations,
array_annotations={'complexity': complexity})
return epoch
Shifting the bins by half a sampling period leaves events at t_stop to be out of bounds.
Jonas and I will start working on a fix which we could maybe discuss next elephant meeting
Describe the bug
Spiketrains can contain spikes with spiketimes <= spiketrain.t_stop. The Synchrotool can only annotate Spikes with a spike time <= spiketrain.t_stop - (0.5/sampling_rate). If the spike time is larger you get an IndexError.
To Reproduce
Expected behavior
Annotate all spikes with the correct complexity
Environment
neo
python package version: 0.12.0elephant
python package version: 0.13.0The text was updated successfully, but these errors were encountered: