crowsetta.formats.seq.yarden.SongAnnotationGUI#

class crowsetta.formats.seq.yarden.SongAnnotationGUI(annotations: ndarray, audio_paths: ndarray, annot_path)[source]#

Bases: object

Class that represents annotations from .mat files created by SongAnnotationGUI: yardencsGitHub/BirdSongBout

name#

Shorthand name for annotation format: 'yarden'.

Type:

str

ext#

Extension of files in annotation format: '.mat'.

Type:

str

annotations#

A numpy record array where each record is an annotation.

Type:

numpy.ndarray

audio_paths#

A numpy array where each element is a path to an audio file. Same length as annotations. Each element in annotations is the annotation for the corresponding path in audio_paths.

Type:

numpy.ndarray

annot_path#

Path to mat file from which annotations were loaded.

Type:

str, pathlib.Path

__init__(annotations: ndarray, audio_paths: ndarray, annot_path) None#

Method generated by attrs for class SongAnnotationGUI.

Methods

__init__(annotations, audio_paths, annot_path)

Method generated by attrs for class SongAnnotationGUI.

from_file(annot_path)

Load annotations from mat files created by SongAnnotationGUI: yardencsGitHub/BirdSongBout

to_annot([round_times, decimals])

Convert this annotation to a crowsetta.Annotation.

to_seq([round_times, decimals])

Convert this set of annotations to a list of crowsetta.Sequence instances.

Attributes

annotations

audio_paths

annot_path

ext

name

classmethod from_file(annot_path: str | bytes | PathLike | Path) Self[source]#

Load annotations from mat files created by SongAnnotationGUI: yardencsGitHub/BirdSongBout

Parameters:

annot_path (str, pathlib.Path) – Path to .mat file with annotations.

to_annot(round_times: bool = True, decimals: int = 3) List[Annotation][source]#

Convert this annotation to a crowsetta.Annotation.

Parameters:
  • round_times (bool) – If True, round times of onsets and offsets. Default is True.

  • decimals (int) – Number of decimals places to round floating point numbers to. Only meaningful if round_times is True. Default is 3, so that times are rounded to milliseconds.

Returns:

annots – A list of crowsetta.Annotation instances.

Return type:

list

Notes

The round_times and decimals arguments are provided to reduce differences across platforms due to floating point error, e.g. when loading annotation files and then sending them to a csv file, the result should be the same on Windows and Linux.

to_seq(round_times: bool = True, decimals: int = 3) List[Sequence][source]#

Convert this set of annotations to a list of crowsetta.Sequence instances.

We assume there is one Sequence per annotated song in the source annotations.

Parameters:
  • round_times (bool) – If True, round times of onsets and offsets. Default is True.

  • decimals (int) – Number of decimals places to round floating point numbers to. Only meaningful if round_times is True. Default is 3, so that times are rounded to milliseconds.

Returns:

seqs – A list of Sequence instances, one for each element in annotations.

Return type:

list

Notes

The round_times and decimals arguments are provided to reduce differences across platforms due to floating point error, e.g. when loading annotation files and then sending them to a csv file, the result should be the same on Windows and Linux.