Annotation Handlers

Koogu supports handling of annotations in these below formats.

class koogu.utils.annotations.RavenAnnotationHandler(label_column_name=None)

Class for handling Raven selection table format files.

Parameters:

label_column_name – A string (e.g., “Tags”) identifying the header of the column in the selection table file(s) from which class labels are to be extracted. If None (default), will look for a column with the header “Tags”.

load(filepath, multi_file=False)

Load annotations from filepath.

Parameters:
  • filepath – Path to a Raven selection table file.

  • multi_file – Set to True if the selection table file corresponds to multiple audio files (usually under a parent directory) instead of a single file.

Returns:

A 4-element tuple

  • Annotations’ times, as a Nx2 numpy array

  • N-length list of tags/class labels

  • N-length numpy array of channel indices (0-based)

  • None if multi_file was False. Otherwise, an N-length list of audio files corresponding to the returned annotations