vak.transforms.frame_labels.transforms.ToSegments#
- class vak.transforms.frame_labels.transforms.ToSegments(labelmap: dict, n_decimals_trunc: int = 5)[source]#
Bases:
object
Transform that converts a vector of frame labels into segments in the form of onset indices, offset indices, and labels.
Finds where continuous runs of a single label start and stop in timebins, and considers each of these runs a segment.
The function returns vectors of labels and onsets and offsets in units of seconds.
- labelmap#
That maps string labels to integers. The mapping is inverted to convert back to string labels.
- Type:
- n_decimals_trunc#
Number of decimal places to keep when truncating the timebin duration calculated from the vector of times t. Default is 5.
- Type:
Methods
__init__
(labelmap[, n_decimals_trunc])