Skip to content

Events

jabs.behavior.events package.

BehaviorEvents

Structure for interacting with behavioral event data.

Creates a run-length encoded representation of event data, and provides tools for deleting bouts and interpolation.

Parameters:

Name Type Description Default
starts ndarray

starting index of events

required
durations ndarray

duration of events (in frames)

required
states ndarray

states of events

required

durations property

Integers indicating the duration of events.

starts property

Integers indicating the frame where an event starts.

states property

Values of the state for each event.

delete_bouts(indices_to_remove)

Helper function to delete events from bout data.

Parameters:

Name Type Description Default
indices_to_remove

event indices to delete

required

Returns:

Type Description
None

Bouts object that has been modified to interpolate within deleted events

Notes

Interpolation on an odd number will result with the "previous" state getting 1 more frame compared to "next" state

from_vector(vector) classmethod

Constructs an event object from vector data.

Parameters:

Name Type Description Default
vector ndarray

state vector of behavioral events

required

Returns: BehaviorEvent object

to_vector()

Converts this RLE-encoded data back into a vector.

Returns:

Type Description
ndarray

The encoded state vector

ClassLabels

Bases: IntEnum

Enumeration for class labels in behavioral event data.

behavior_events

BehaviorEvents

Structure for interacting with behavioral event data.

Creates a run-length encoded representation of event data, and provides tools for deleting bouts and interpolation.

Parameters:

Name Type Description Default
starts ndarray

starting index of events

required
durations ndarray

duration of events (in frames)

required
states ndarray

states of events

required

durations property

Integers indicating the duration of events.

starts property

Integers indicating the frame where an event starts.

states property

Values of the state for each event.

delete_bouts(indices_to_remove)

Helper function to delete events from bout data.

Parameters:

Name Type Description Default
indices_to_remove

event indices to delete

required

Returns:

Type Description
None

Bouts object that has been modified to interpolate within deleted events

Notes

Interpolation on an odd number will result with the "previous" state getting 1 more frame compared to "next" state

from_vector(vector) classmethod

Constructs an event object from vector data.

Parameters:

Name Type Description Default
vector ndarray

state vector of behavioral events

required

Returns: BehaviorEvent object

to_vector()

Converts this RLE-encoded data back into a vector.

Returns:

Type Description
ndarray

The encoded state vector

ClassLabels

Bases: IntEnum

Enumeration for class labels in behavioral event data.