neuralset.base.TimedArray

class neuralset.base.TimedArray(*, frequency: float, start: float, data: ndarray | None = None, duration: float | None = None, aggregation: Literal['sum', 'mean'] = 'sum', header: dict[str, Any] | None = None)[source][source]

Numpy array annotated with time metadata.

Carries frequency, start, duration, and an optional header dict for domain-specific attributes (channel names, electrode positions, space info). Time is always the last dimension (when frequency > 0).

Design rationale

Attaching frequency and start to the array lets extractors handle time slicing uniformly — whether the data is a time series (frequency > 0, slicing by sample indices) or a single static representation (frequency == 0, no time dimension). Slicing and += handle time alignment automatically (resampling and shifting to a common grid). Data can be backed by memmap for fast access without loading full arrays into memory.

overlap(start: float, duration: float) _TA[source][source]

Returns the sub TimedArray overlapping with the provided start and duration In case of lack of overlap, a timed array with 0 duration and empty data on the time dimension will be returned.

with_start(start: float) _TA[source][source]

Return a lightweight copy sharing the data array with a new start time.