dcnum.write.event_stash

Classes

EventStash

Sort events into predefined arrays for bulk access

Module Contents

class dcnum.write.event_stash.EventStash(index_offset: int, feat_nevents: list[int])[source]

Sort events into predefined arrays for bulk access

Parameters:
  • index_offset – This is the index offset at which we are working on. Normally, feat_nevents is just a slice of a larger array and index_offset defines at which position it is taken.

  • feat_nevents – List that defines how many events there are for each input frame. If summed up, this defines self.size.

events

Dictionary containing the event arrays

feat_nevents

List containing the number of events per input frame

nev_idx

Cumulative sum of feat_nevents for determining sorting offsets

size

Number of events in this stash

num_frames

Number of frames in this stash

index_offset

Global offset compared to the original data instance.

indices_for_data

Array containing the indices in the original data instance. These indices correspond to the events in events.

_tracker

Private array that tracks the progress.

is_complete()[source]

Determine whether the event stash is complete (all events added)

add_events(index, events)[source]

Add events to this stash

Parameters:
  • index (int) – Global index (from input dataset)

  • events (dict) – Event dictionary

require_feature(feat, sample_data)[source]

Create a new empty feature array in self.events and return it

Parameters:
  • feat – Feature name

  • sample_data – Sample data for one event of the feature (used to determine shape and dtype of the feature array)