deepof.utils.count_events

deepof.utils.count_events(binary_behavior: ndarray, counting_mode: str = 'Events', frame_rate: int = 1) int

Counts the number of continuous blocks of 1s in a binary behavior vector in different ways

Parameters:
  • binary_behavior (numpy.ndarray) – Binary 1D Array containing behavior detections.

  • counting_mode (str) – Counting mode. Options are:

  • "Frames" (-) – Counts total number of frames in all events

  • "Time" (-) – Counts total time duration of all events (requires frame_rare input)

  • "Events" (-) – Counts number of continuous blocks of 1s

  • "Transitions" (-) – Counts number of frame-to-frame transitions within the events e.g. an event of 10 frames in length would have 9 transitions.

  • frame_rate (float) – Frame rate of the recording.

Returns:

counted events

Return type:

num_events (float)