ltbio.processing.filters#

Overview#

Submodules#

Classes#

BandType

str(object=’’) -> str

ConvolutionOperation

str(object=’’) -> str

FrequencyDomainFilter

Describes the design of a digital frequency-domain filter and holds the ability to apply that filter to any array of samples.

FrequencyResponse

str(object=’’) -> str

TimeDomainFilter

Describes the design of a digital time-domain filter and holds the ability to apply that filter to any array of samples.

Contents#

class ltbio.processing.filters.BandType#

Bases: str, enum.Enum

digraph inheritance0621256cd9 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BandType" [URL="FrequencyDomainFilter/index.html#ltbio.processing.filters.FrequencyDomainFilter.BandType",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"]; "Enum" -> "BandType" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Enum" [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="Generic enumeration."]; }

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

BANDPASS = 'Band-pass'#
BANDSTOP = 'Band-stop'#
HIGHPASS = 'High-pass'#
LOWPASS = 'Low-pass'#
class ltbio.processing.filters.ConvolutionOperation#

Bases: str, enum.Enum

digraph inheritanceb2285da0bb { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "ConvolutionOperation" [URL="TimeDomainFilter/index.html#ltbio.processing.filters.TimeDomainFilter.ConvolutionOperation",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"]; "Enum" -> "ConvolutionOperation" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Enum" [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="Generic enumeration."]; }

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

GAUSSIAN = 'Gaussian'#
HAMMING = 'Hamming'#
HANN = 'Hann'#
KAISER = 'Kaiser'#
MEDIAN = 'Median'#
PARZEN = 'Parzen'#
class ltbio.processing.filters.FrequencyDomainFilter(fresponse: FrequencyResponse, band_type: BandType, cutoff: float | Tuple[float, float], order: int, name: str = None, **options)#

Bases: ltbio.processing.filters.Filter.Filter

digraph inheritance62f6e418c3 { 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"]; "Filter" [URL="Filter/index.html#ltbio.processing.filters.Filter.Filter",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="It acts as the Visitor class in the Visitor Design Pattern."]; "SinglePipelineUnit" -> "Filter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Filter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FrequencyDomainFilter" [URL="FrequencyDomainFilter/index.html#ltbio.processing.filters.FrequencyDomainFilter.FrequencyDomainFilter",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="Describes the design of a digital frequency-domain filter and holds the ability to apply that filter to any array of samples."]; "Filter" -> "FrequencyDomainFilter" [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)"]; }

Describes the design of a digital frequency-domain filter and holds the ability to apply that filter to any array of samples. It acts as a concrete visitor in the Visitor Design Pattern.

To instantiate, give:
  • fresponse: The frequency response of the filter. Choose one from FrequencyResponse enumeration.

  • band_type: Choose whether it should low, high, or band pass or reject a band of the samples’ spectrum. Choose one from BandType enumeration.

  • order: The order of the filter (in int).

  • cutoff: The cutoff frequency at 3 dB (for lowpass and highpass) or a tuple of two cutoffs (for bandpass or bandstop) (in Hertz, float).

property last_denominator_coefficients: numpy.array#
property last_numerator_coefficients: numpy.array#
plot_bode(show: bool = True, save_to: str = None)#
class ltbio.processing.filters.FrequencyResponse#

Bases: str, enum.Enum

digraph inheritance06214b16da { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Enum" [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="Generic enumeration."]; "FrequencyResponse" [URL="FrequencyDomainFilter/index.html#ltbio.processing.filters.FrequencyDomainFilter.FrequencyResponse",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"]; "Enum" -> "FrequencyResponse" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

BESSEL = 'IIR Bessel'#
BUTTER = 'IIR Butterworth'#
CHEBY1 = 'IIR Chebyshev 1'#
CHEBY2 = 'IIR Chebyshev 2'#
ELLIP = 'IIR Elliptic'#
FIR = 'Finite Impulse Response (FIR)'#
class ltbio.processing.filters.TimeDomainFilter(operation: ConvolutionOperation, window_length: datetime.timedelta, overlap_length: datetime.timedelta = timedelta(seconds=0), name: str = None, **options)#

Bases: ltbio.processing.filters.Filter.Filter

digraph inheritance713abc97e3 { 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"]; "Filter" [URL="Filter/index.html#ltbio.processing.filters.Filter.Filter",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="It acts as the Visitor class in the Visitor Design Pattern."]; "SinglePipelineUnit" -> "Filter" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "Filter" [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)"]; "TimeDomainFilter" [URL="TimeDomainFilter/index.html#ltbio.processing.filters.TimeDomainFilter.TimeDomainFilter",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="Describes the design of a digital time-domain filter and holds the ability to apply that filter to any array of samples."]; "Filter" -> "TimeDomainFilter" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

Describes the design of a digital time-domain filter and holds the ability to apply that filter to any array of samples. It acts as a concrete visitor in the Visitor Design Pattern.

To instantiate, give:
  • operation: The operation to apply to each window. Choose one from TimeOperation enumeration.

  • window_length: The length of the window (in timedelta).

  • overlap_window: The length of the overlap between window slides (in timedelta). Default: 0 seconds.