crowsetta.formats.bbox.raven.Raven#

class crowsetta.formats.bbox.raven.Raven(df: DataFrame, annot_path: Path, annot_col: str, audio_path=None)[source]#

Bases: object

Class that represents txt annotation files from Raven (https://ravensoundsoftware.com/software/), created by exporting a Selection Table.

name#

Shorthand name for annotation format: ‘raven’.

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 Raven txt file from which annotations were loaded.

Type:

str, pathlib.Path

audio_path#

Path to audio file that the Raven txt file annotates.

Type:

str. pathlib.Path

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

Method generated by attrs for class Raven.

Methods

__init__(df, annot_path, annot_col[, audio_path])

Method generated by attrs for class Raven.

from_file(annot_path[, annot_col, audio_path])

Load annotations from a Raven annotation file, created by exporting a Selection Table.

to_annot()

Convert this Raven annotation to a crowsetta.Annotation.

to_bbox()

Convert this Raven annotation to a list of crowsetta.Bbox instances.

to_file(annot_path)

Make a txt file that can be read by Raven from this annotation

Attributes

df

annot_path

annot_col

audio_path

COLUMNS_MAP

ext

name

classmethod from_file(annot_path: str | bytes | PathLike | Path, annot_col: str = 'Annotation', audio_path: str | bytes | PathLike | Path | None = None) Self[source]#

Load annotations from a Raven annotation file, created by exporting a Selection Table.

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

  • annot_col (str) – Name of column that contains annotations.

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

Examples

>>> example = crowsetta.data.get('raven')
>>> raven = crowsetta.formats.bbox.Raven.from_file(example.annot_path)
to_annot() Annotation[source]#

Convert this Raven annotation to a crowsetta.Annotation.

Returns:

annot

Return type:

crowsetta.Annotation

Examples

>>> example = crowsetta.data.get('raven')
>>> raven = crowsetta.formats.bbox.Raven.from_file(example.annot_path)
>>> annot = raven.to_annot()
to_bbox() List[BBox][source]#

Convert this Raven annotation to a list of crowsetta.Bbox instances.

Returns:

bboxes – A list of crowsetta.BBox instances.

Return type:

list

Examples

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

Make a txt file that can be read by Raven from this annotation

Parameters:

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