Selection

korus.selection.create_selections(conn, indices, window_ms, step_ms=None, center=False, exclusive=False, num_max=None, source_type_avoid=None, data_support=True, progress_bar=False, full_path=True)[source]

Create uniform-length selection windows on a set of annotations.

TODO: implement @source_avoid_type TODO: implement @data_support=False

Args:
conn: sqlite3.Connection

Database connection

indices: list(int)

Indices in the annotation table

window_ms: int

Window size in milliseconds.

step_ms: int

Step size in milliseconds. Used for creating temporally translated views of the same annotation. If None, at most one (1) selection will be created per annotation.

center: bool

Align the selection window temporally with the midpoint of the annotation. If False, the temporal alignment will be chosen at random (uniform distribution).

exclusive: bool

If True, the selection window is not allowed to contain anything but the annotated section of data. In other words, the selection window is not allowed extend beyond the start/end point of the annotation. In particular, this means that selections will not be created for annotations shorther than @window_ms. Default is False.

num_max: int

Create at most this many selections.

source_type_avoid: tuple, list(tuple)

Only return selections that have been verified to not contain sounds with this (source,type) label. Note that the requirement extends to all ancestral and descendant nodes in the taxonomy tree.

data_support: bool

If True, selection windows are not allow to extend beyond the start/end times of the audio files in the database. Default is True.

progress_bar: bool

Whether to display a progress bar. Default is False.

full_path: bool

Whether to include the full audio file paths in the output table. Default is True.

Returns:
sel_tbl: Pandas DataFrame

Selection table