iracema.core.segment

This module contain classes used to manipulate segments and slice TimeSeries objects using them.

class iracema.core.segment.Segment(start, end)[source]

Bases: object

The objects generated from this class are used to retrieve excerpts from time-series.

Hint

This class is also available at the main package level as iracema.Segment.

Parameters
  • start (ir.Point) – Point corresponding to the start of the segment.

  • end (ir.Point) – Point corresponding to the end of the segment.

nsamples(time_series)[source]
property duration
property start_time
property end_time
generate_slice(time_series)[source]

Generate a python slice with the sample indexes that correspond to the current segment in time_series

map_indexes(time_series)[source]

Return a tuple with the indexes of time_series that correspond to the segments in the list.

class iracema.core.segment.SegmentList(segments=None)[source]

Bases: collections.abc.MutableSequence

List of segments.

Hint

This class is also available at the main package level as iracema.SegmentList.

insert(index, item)[source]

S.insert(index, value) – insert value before index

map_indexes(time_series)[source]

Return an array of tuples with the indexes of time_series that correspond to the segments in the list.

add_segment(start, end)[source]

Instantiate a segment with the given start and end and add to the list.

classmethod load_from_file(file_name)[source]

Instantiate a list of segments, loaded from a CSV file. Each line in the file must contain the position of a single point. The position must be specified in seconds.

save_to_file(file_name)[source]

Save SegmentList to a CSV file.