Skip to content

Commit

Permalink
Merge pull request #481 from LAAC-LSCP/cmdline/automated-import
Browse files Browse the repository at this point in the history
Cmdline/automated import tests and docs
  • Loading branch information
LoannPeurey authored Jul 9, 2024
2 parents 45d9b22 + ee8b8c1 commit b36d41c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
20 changes: 19 additions & 1 deletion docs/source/annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Importation
Single annotation importation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Annotations can be imported one by one or in bulk. Annotation
Annotations can be imported one by one, in bulk or through the automated command. Annotation
importation does the following :

1. Convert all input annotations from their original format (e.g. rttm,
Expand Down Expand Up @@ -62,6 +62,24 @@ Use this to do bulk importation of many annotation files.
The input dataframe ``/path/to/dataframe.csv`` must have one entry per
annotation to import, according to the format specified at :ref:`format-input-annotations`.

Automated importation
^^^^^^^^^^^^^^^^^^^^^

The automated method is mostly used for automated annotations. It is made to assume a certain number of parameters on importation, which allows us to perform the usual importations we are doing without additional input. The command will assume the following:
- the annotation files will cover the entirety of the audio they annotate (equivalent to range_onset 0 and range_offset <duration of rec>)
- the annotation files will have timestamps that are not offset compare to the recording (equivalent to time_seek 0)
- the annotation files will be named exactly like the recording they annotate (including the folder they are in) except for the extension, which depends on the format (equivalent to recording_filename = annotation_filename + extension)
- the format used is the same for all the files and needs to be given in the call, it determines the extension for all the annotation files
- the set to import is the same for all files, must be given in the call

.. clidoc::

child-project automated-import . --help

::

# import the vtc set by using the vtc_rttm format, all annotation files will need to be with extension ``.rttm``
child-project automated-import . --set vtc --format vtc_rttm

Rename a set of annotations
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ numpy==1.26.4; python_version >= '3.10'
pandas==1.3.5; python_version <= '3.10'
pandas==2.2.1; python_version >= '3.11'
panoptes-client==1.6.1
pillow<10.4.0 # this is constrained as matplotlib versions used fail on pillow > 10.3.0
praat-parselmouth==0.4.3
pyannote.core==5.0.0
pydub==0.25.1
Expand Down
16 changes: 16 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ def test_import_annotations(project):
)
assert exit_code == 0


def test_import_automated(project):
stdout, stderr, exit_code = cli(
[
"child-project",
"automated-import",
PATH,
"--set",
"vtc_rttm",
"--format",
"vtc_rttm",
]
)
assert exit_code == 0


def test_compute_durations(project):
stdout, stderr, exit_code = cli(
[
Expand Down

0 comments on commit b36d41c

Please sign in to comment.