jams.util.import_lab

jams.util.import_lab(namespace, filename, infer_duration=True, **parse_options)[source]

Load a .lab file as an Annotation object.

.lab files are assumed to have the following format:

TIME_START\tTIME_END\tANNOTATION

By default, .lab files are assumed to have columns separated by one or more white-space characters, and have no header or index column information.

If the .lab file contains only two columns, then an empty duration field is inferred.

If the .lab file contains more than three columns, each row’s annotation value is assigned the contents of last non-empty column.

Parameters:
namespace : str

The namespace for the new annotation

filename : str

Path to the .lab file

infer_duration : bool

If True, interval durations are inferred from (start, end) columns, or difference between successive times.

If False, interval durations are assumed to be explicitly coded as (start, duration) columns. If only one time column is given, then durations are set to 0.

For instantaneous event annotations (e.g., beats or onsets), this should be set to False.

parse_options : additional keyword arguments

Passed to pandas.DataFrame.read_csv

Returns:
annotation : Annotation

The newly constructed annotation object

See also

pandas.DataFrame.read_csv