neuralset.segments.Segment¶
- class neuralset.segments.Segment(start: float, duration: float, timeline: str, _trigger_idx: int | None = None, _store_id: ~uuid.UUID = <factory>, _store_ref: ~neuralset.segments._EventStore | None = None, _cache_key: tuple[float, float, str] | None = None, _cached_events: list[~neuralset.events.etypes.Event] = <factory>)[source][source]¶
A time window on a single timeline, backed by a shared event store.
Created by
list_segments()(or viaSegmenter) — not meant to be instantiated directly. Each segment references an internal event store that holds all events; overlapping events are resolved on access vians_events.Segments are mutable: changing
startordurationchanges which eventsns_eventsreturns (useful for jittering).The underlying event data is snapshotted at creation time — later modifications to the source DataFrame have no effect.
- copy(offset: float = 0.0, duration: float | None = None) Segment[source][source]¶
Create a copy of the current segment with optional offset and duration.
- property events: DataFrame[source]¶
Events occurring within the segment.
- Returns:
DataFrame containing all events in this segment, with the original indices preserved.
- Return type:
pd.DataFrame
- property ns_events: list[Event][source]¶
Events overlapping this segment’s
[start, start + duration)window.The result is cached and automatically invalidated when
start,duration, ortimelinechanges.