ltbio.processing.formaters#

Overview#

Submodules#

Classes#

Normalizer

Pipeline Unit that normalizes Timeseries.

Segmenter

This PipelineUnit can segment one Timeseries at a time.

Contents#

class ltbio.processing.formaters.Normalizer(method='mean', name: str = '')#

Bases: ltbio.pipeline.PipelineUnit.SinglePipelineUnit

digraph inheritanced23039c5e3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "Normalizer" [URL="Normalizer/index.html#ltbio.processing.formaters.Normalizer.Normalizer",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Unit that normalizes Timeseries."]; "SinglePipelineUnit" -> "Normalizer" [arrowsize=0.5,style="setlinewidth(0.5)"]; "PipelineUnit" [URL="../../pipeline/PipelineUnit/index.html#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SinglePipelineUnit" [URL="../../pipeline/PipelineUnit/index.html#ltbio.pipeline.PipelineUnit.SinglePipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Single Pipeline Unit is any agent that can act (use, process or make changes) to a collection (usually of Timeseries)."]; "PipelineUnit" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Pipeline Unit that normalizes Timeseries.

ART_PATH = 'resources/pipeline_media/segmenter.png'#
PIPELINE_INPUT_LABELS#
PIPELINE_OUTPUT_LABELS#
apply(timeseries: ltbio.biosignals.Timeseries)#
class ltbio.processing.formaters.Segmenter(window_length: datetime.timedelta, overlap_length: datetime.timedelta = timedelta(seconds=0), name=None)#

Bases: ltbio.pipeline.PipelineUnit.SinglePipelineUnit

digraph inheritancead73061199 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "PipelineUnit" [URL="../../pipeline/PipelineUnit/index.html#ltbio.pipeline.PipelineUnit.PipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Pipeline Units are the building blocks of Pipelines."]; "ABC" -> "PipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Segmenter" [URL="Segmenter/index.html#ltbio.processing.formaters.Segmenter.Segmenter",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="This PipelineUnit can segment one Timeseries at a time."]; "SinglePipelineUnit" -> "Segmenter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SinglePipelineUnit" [URL="../../pipeline/PipelineUnit/index.html#ltbio.pipeline.PipelineUnit.SinglePipelineUnit",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Single Pipeline Unit is any agent that can act (use, process or make changes) to a collection (usually of Timeseries)."]; "PipelineUnit" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "SinglePipelineUnit" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

This 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.’)