restrict

restrict crops data to a time window. It supports both dense time series and ragged spike arrays.

Examples

Dense time series:

cropped = rates.ephys.restrict(window=(0.0, 1.0))

Ragged spikes:

cropped = spikes.ephys.restrict(window=(-0.5, 0.5))

NumPy input:

cropped = restrict(
    rates_np,
    window=(0.0, 1.0),
    dims=("time",),
    coords={"time": time_values},
)