An array of events (class `Event`) `[t1, t2, t3]` can be transformed into an array of epochs (class `Epoch`), `[(t1, t2), (t2, t3)]`. It would be useful to add this as a method `Event.to_epoch()` Example: ```python >>> import numpy as np >>> from neo import Epoch, Event, Segment >>> seg = Segment(name="test") >>> event = Event(times=np.array([5.0, 12.0, 23.0, 45.0]), units="ms", labels=np.array(["A", "B", "C", "D"])) >>> event.segment = seg >>> epoch = event.to_epoch() >>> epoch.times array([5.0, 12.0, 23.0]) * ms >>> epoch.durations array([7.0, 11.0, 22.0]) * ms >>> epoch.labels array(['A-B', 'B-C', 'C-D']) >>> epoch.segment.name "test" ```
Activity
JuliaSprenger commentedon Jan 9, 2018
some example code exists already here: https://web.gin.g-node.org/INT/multielectrode_grasp/src/master/code/neo_utils.py
apdavison commentedon Oct 22, 2018
Replaced #404 by #586
zm711 commentedon Feb 10, 2024
This appears to be closed by #586. Reopen if I am wrong.