ltbio.processing.formaters.Segmenter#
Overview#
Classes#
This PipelineUnit can segment one Timeseries at a time. |
Contents#
- class ltbio.processing.formaters.Segmenter.Segmenter(window_length: datetime.timedelta, overlap_length: datetime.timedelta = timedelta(seconds=0), name=None)#
Bases:
ltbio.pipeline.PipelineUnit.SinglePipelineUnitThis PipelineUnit can segment one Timeseries at a time.
- ART_PATH = 'resources/pipeline_media/segmenter.png'#
- PIPELINE_INPUT_LABELS#
- PIPELINE_OUTPUT_LABELS#
- apply(timeseries: ltbio.biosignals.Timeseries) ltbio.biosignals.Timeseries#
# FIXME: Uncomment this. if len(timeseries.segments) > 0:
adjacent = True for i in range(1, len(timeseries.segments)):
- if not timeseries.segments[i-1].adjacent(timeseries.segments[i]): # assert they’re adjacent
adjacent = False break
- if not adjacent:
x = input(f”Segments of {timeseries.name} are not adjacent. Join them? (y/n) “).lower() if x == ‘y’:
pass # go ahead
- else:
raise AssertionError(‘Framework does not support segmenting non-adjacent segments, unless you want to join them. Try indexing the time period of interest first.’)