crowsetta.formats.bbox.audbbox.AudBBox#

class crowsetta.formats.bbox.audbbox.AudBBox(df: DataFrame, annot_path: Path, audio_path=None)[source]#

Bases: object

Class that represents Audacity label tracks in extended format, exported to txt files https://manual.audacityteam.org/man/importing_and_exporting_labels.html#Extended_format_with_frequency_ranges

name#

Shorthand name for annotation format: ‘aud-bbox’.

Type:

str

ext#

Extension of files in annotation format: ‘.txt’

Type:

str

df#

with annotations loaded into it

Type:

pandas.DataFrame

annot_path#

Path to Audacity txt file from which annotations were loaded.

Type:

str, pathlib.Path

audio_path#

Path to audio file that the Audacity txt file annotates.

Type:

str. pathlib.Path

__init__(df: DataFrame, annot_path: Path, audio_path=None) None#

Method generated by attrs for class AudBBox.

Methods

__init__(df, annot_path[, audio_path])

Method generated by attrs for class AudBBox.

from_file(annot_path[, audio_path])

Load annotations from an Audacity annotation file with bounding boxes, created by exporting a Selection Table.

to_annot()

Convert this Audacity bbox annotation to a crowsetta.Annotation.

to_bbox()

Convert this Audacity extended label track annotation to a list of crowsetta.Bbox.

to_file(annot_path)

Make a txt file from this annotation in extended label track format that can be read by Audacity.

Attributes

df

annot_path

audio_path

COLUMNS_MAP

ext

name

classmethod from_file(annot_path: PathLike, audio_path: PathLike | None = None) Self[source]#

Load annotations from an Audacity annotation file with bounding boxes, created by exporting a Selection Table.

Parameters:
  • annot_path (str, pathlib.Path) – Path to a txt file exported from Audacity bbox.

  • audio_path (str, pathlib.Path) – Path to audio file that the Audacity bbox txt file annotates. Optional, defaults to None.

Examples

>>> example = crowsetta.data.get('aud-bbox')
>>> audbbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path)
to_annot() Annotation[source]#

Convert this Audacity bbox annotation to a crowsetta.Annotation.

Returns:

annot

Return type:

crowsetta.Annotation

Examples

>>> example = crowsetta.data.get('aud-bbox')
>>> audacitybbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path)
>>> annot = audacitybbox.to_annot()
to_bbox() List[BBox][source]#

Convert this Audacity extended label track annotation to a list of crowsetta.Bbox.

Returns:

bboxes – A list of crowsetta.BBox instances.

Return type:

list

Examples

>>> example = crowsetta.data.get('aud-bbox')
>>> audbbox = crowsetta.formats.bbox.AudBBox.from_file(example.annot_path)
>>> bboxes = audbbox.to_bbox()
to_file(annot_path: str | bytes | PathLike | Path) None[source]#

Make a txt file from this annotation in extended label track format that can be read by Audacity.

Parameters:

annot_path (str, pathlib.Path) – Path including filename where file should be saved. Must have extension ‘.txt’