tonic.prototype.slicers#

Module Contents#

Classes#

SliceByTime

Slices an event array along fixed time window and overlap size. The number of bins depends

SliceByEventCount

Slices data and targets along a fixed number of events and overlap size. The number of bins

class tonic.prototype.slicers.SliceByTime[source]#

Bases: torchdata.datapipes.iter.IterDataPipe

Slices an event array along fixed time window and overlap size. The number of bins depends on the length of the recording. Only works on numpy event arrays that contain a ‘t’ or ‘ts’ field.

> <overlap> >| window1 | > | window2 |

Parameters:
  • time_window (int) – time for window length (same unit as event timestamps)

  • overlap (int) – overlap (same unit as event timestamps)

  • include_incomplete (bool) – include the last incomplete slice that has shorter time

source_dp: torchdata.datapipes.iter.IterDataPipe#
dt: float#
overlap: float = 0.0#
include_incomplete: bool = False#
__iter__()[source]#
class tonic.prototype.slicers.SliceByEventCount[source]#

Bases: torchdata.datapipes.iter.IterDataPipe

Slices data and targets along a fixed number of events and overlap size. The number of bins depends on the amount of events in the recording. Only works on numpy event arrays.

Parameters:
  • event_count (int) – number of events for each bin

  • overlap (int) – overlap in number of events

  • include_incomplete (bool) – include the last incomplete slice that has fewer events

source_dp: torchdata.datapipes.iter.IterDataPipe#
n: int#
overlap: int = 0#
include_incomplete: bool = False#
__iter__()[source]#