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.
The deleted bout's frames are absorbed by its neighboring bouts, so the total number of encoded frames is preserved. This object is modified in place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices_to_remove
|
event indices to delete |
required |
Notes
Interpolation on an odd number of frames will result with the "next" state getting 1 more frame compared to the "previous" state.
A bout with no neighbor to absorb its frames (i.e. the only remaining bout) is left in place, since removing it would shorten the encoded vector.
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
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.
The deleted bout's frames are absorbed by its neighboring bouts, so the total number of encoded frames is preserved. This object is modified in place.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices_to_remove
|
event indices to delete |
required |
Notes
Interpolation on an odd number of frames will result with the "next" state getting 1 more frame compared to the "previous" state.
A bout with no neighbor to absorb its frames (i.e. the only remaining bout) is left in place, since removing it would shorten the encoded vector.
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 |