Closed jonathanjouty closed 1 year ago
The library generally assumes that any collection of Spike objects have the same t_start and t_end. For example the .._distance() functions assert on edge inequality. Edge equality is assured by load_spike_trains_from_text() and generate_poisson_input which have the edges as a required input. There are ways around this. The issue reported is that merge_spike_trains() just assumes that the edges come from the first train to be merged. Even worse, import_spike_trains_from_time_series() generates t_end separately for each train based on the last spike in the train, pretty much assuring that the edges will NOT be the same for every train. Proposed fix: A new function called reconcile_spike_trains() filters a list of Spike objects. On output, t_start and t_end are the same for each Spike, created by min/max of the spike times and input t_start/t_end. In addition, reconcile_spike_trains() can assure the times are sorted and that duplicate spike times are removed.
I encountered an issue today when using
generate_poisson_spikes
to create a series of SpikeTrains across distinct intervals, and then merging them usingmerge_spike_trains
.Currently both
t_start
andt_end
come from the first SpikeTrain supplied tomerge_spike_trains
:For my present situation
t_start
should be the minimumt_start
from the list of merged SpikeTrains, and similarlyt_end
the maximum.Question is, what should the behavior be? Does the minimum/maximum make sense for all use-cases?