API

This part of the documentation lists the full API reference of all public classes and functions.

Signal Traces

Trace

class signalyzer.Trace(label: str = 'Trace', samples: typing.Union[typing.List[typing.Union[bool, int, float, str]], typing.Iterable[typing.Union[bool, int, float, str]], typing.Iterable[None]] = <factory>)[source]

Trace data class for time-discrete, equidistant signal samples.

label: str = 'Trace'

Label of the trace displayed in its plot.

samples: Union[List[Union[bool, int, float, str]], Iterable[Union[bool, int, float, str]], Iterable[None]]

List of the time-discrete, equidistant signal samples of the trace.

classmethod from_dict(key: str, data: Dict[str, Iterable[Union[bool, int, float, str]]], **kwargs) signalyzer.trace.Trace[source]

Returns a new trace labeled with the key, and the signal samples from the value of the data dictionary item selected by the key.

Parameters
  • key (str) – key name of the signal samples to select from the data dictionary

  • data (DataFrame) – dictionary with signal samples

  • label (str) – optional label to set instead of the key name

relabel(label: str) signalyzer.trace.Trace[source]

Returns the same trace relabeled with the new label.

Parameters

label (str) – new label to set

property label_stem: str

Returns the stem of the trace label.

repeat(times: Optional[int] = 1) Iterator[Union[bool, int, float, str]][source]

Returns an iterator repeating each signal sample of the trace n-times.

Parameters

times – number of times to repeat a sample. Default is 1.

fields() Tuple[Any, ...][source]

Returns a tuple describing the fields of the data class.

as_dict() Dict[str, Any][source]

Returns the trace data class as a dictionary.

as_tuple() tuple[Any, ...][source]

Returns the trace data class as a tuple.

bool(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to booleans.

Parameters

label (str) – optional trace label to set

int(base: Optional[int] = None, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to integers.

Parameters

label (str) – optional trace label to set

float(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to floating-points.

Parameters

label (str) – optional trace label to set

bin(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to binary literals.

Parameters

label (str) – optional trace label to set

oct(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to octal literals.

Parameters

label (str) – optional trace label to set

hex(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples converted to hexadecimal literals.

Parameters

label (str) – optional trace label to set

less(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the lesser comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the trace samples, otherwise only a subset of the signal samples is returned!

less_equal(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the lesser or equal comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

equal(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the equal comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

not_equal(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the not equal comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

greater_equal(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the greater or equal comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

greater(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the results as integers of the greater comparison between the signal samples and the operand.

Parameters

operand – iterable or number to compare with

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

add(summand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the sums of the signal samples and the summand.

Parameters

summand – iterable or number

Note

An iterable summand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

sub(subtrahend: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the differences between the signal samples and the subtrahend.

Parameters

subtrahend – iterable or number

Note

An iterable subtrahend should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

mul(factor: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the products between the signal samples and the factor.

Parameters

factor – iterable or number

Note

An iterable factor should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

div(divisor: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the quotients between the signal samples and the divisor.

Parameters

divisor – iterable or number

Note

An iterable divisor should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

Note

Zero-divisions between samples are resolved by returning zero for the samples in the new trace where the divisor is zero!

floordiv(divisor: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the integer quotients between the signal samples and the divisor.

Parameters

divisor – iterable or number

Note

An iterable divisor should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

Note

Zero-divisions between samples are resolved by returning zero for the samples in the new trace where the divisor is zero!

mod(divisor: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the remainders between the signal samples and the divisor.

Parameters

divisor – iterable or number

Note

An iterable divisor should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

Note

Zero-divisions between samples are resolved by returning zero for the samples in the new trace where the divisor is zero!

pow(exponent: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the exponentiated values for the signal samples raised to the power of the exponent.

Parameters

exponent – iterable or number

Note

An iterable exponent should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

bitwise_and(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the bitwise ANDed values of the signal samples and the operand.

Parameters

operand – iterable or number

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

bitwise_or(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the bitwise ORed values of the signal samples and the operand.

Parameters

operand – iterable or number

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

bitwise_xor(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the bitwise XORed values of the signal samples and the operand.

Parameters

operand – iterable or number

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

left_shift(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the bitwise left-shifted signal samples by the operand.

Parameters

operand – iterable or number

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

right_shift(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) signalyzer.trace.Trace[source]

Returns a new trace with the right shifted signal samples by the operand.

Parameters

operand – iterable or number

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

bits(index: int, number: int = 1, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the unpacked number of bits starting at the bit index from the signal samples of the trace.

Parameters
  • index (int) – start index of the bits to unpack [0..31]

  • number (int) – number of bits to unpack [1..32-index]. Default is 1.

  • label (str) – optional trace label to set

neg(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the negated values of the signal samples.

Parameters

label (str) – optional trace label to set

abs() signalyzer.trace.Trace[source]

Returns a new trace with the absolute values of the signal samples.

invert(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the bitwise inverted values of the signal samples.

Parameters

label (str) – optional trace label to set

round(*args, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the rounded values of the signal samples.

trunc(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the truncated values of the signal samples.

Parameters

label (str) – optional trace label to set

floor(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the floor, rounded integers of the signal samples.

Parameters

label (str) – optional trace label to set

ceil(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the ceil, rounded integers of the signal samples.

Parameters

label (str) – optional trace label to set

sign(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signum values of the signal samples of the trace.

Parameters

label (str) – optional trace label to set

zero(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for testing the signal samples to be zero or not.

Parameters

label (str) – optional trace label to set

positive(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for testing the signal samples to be positive or not.

Parameters

label (str) – optional trace label to set

negative(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for testing the signal samples to be negative or not.

Parameters

label (str) – optional trace label to set

delta(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the deltas between the consecutive signal samples.

Parameters
  • label (str) – optional trace label to set

  • preset (float) – optional preset value to compute the delta. Default is the first value in the signal samples.

enter_positive(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for checking the signal samples starts to be positive.

Parameters
  • label (str) – optional trace label to set

  • preset (float) – optional preset value to compute the delta. Default is the first value in the signal samples.

left_positive(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for checking the signal samples stops to be positive.

Parameters
  • label (str) – optional trace label to set

  • preset (float) – optional preset value to compute the delta. Default is the first value in the signal samples.

enter_negative(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for checking the signal samples starts to be negative.

Parameters
  • label (str) – optional trace label to set

  • preset (float) – optional preset value to compute the delta. Default is the first value in the signal samples.

left_negative(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the test results as integers for checking the signal samples stops to be negative.

Parameters
  • label (str) – optional trace label to set

  • preset (float) – optional preset value to compute the delta. Default is the first value in the signal samples.

accumulate(func=<built-in function add>, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the accumulated signal samples.

Parameters
  • func – function to use for the accumulation of the samples. Default is the + operator.

  • label (str) – optional trace label to set

sums_positive(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the integrated signal samples limited to positive sums.

Parameters

label (str) – optional trace label to set

sums_negative(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the integrated signal samples limited to negative sums.

Parameters

label (str) – optional trace label to set

sin(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the sines of the signal samples in radians.

Parameters

label (str) – optional trace label to set

cos(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the cosines of the signal samples in radians.

Parameters

label (str) – optional trace label to set

tan(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the tangents of the signal samples in radians.

Parameters

label (str) – optional trace label to set

asin(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the arc sines of the signal samples.

Parameters

label (str) – optional trace label to set

acos(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the arc cosines of the signal samples.

Parameters

label (str) – optional trace label to set

atan(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the arc tangents of the signal samples.

Parameters

label (str) – optional trace label to set

sinh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the hyperbolic sines of the signal samples.

Parameters

label (str) – optional trace label to set

cosh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the hyperbolic cosines of the signal samples.

Parameters

label (str) – optional trace label to set

tanh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the hyperbolic tangents of the signal samples.

Parameters

label (str) – optional trace label to set

asinh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the area hyperbolic sines of the signal samples.

Parameters

label (str) – optional trace label to set

acosh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the area hyperbolic cosines of the signal samples.

Parameters

label (str) – optional trace label to set

atanh(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the area hyperbolic tangents of the signal samples.

Parameters

label (str) – optional trace label to set

sort(*args, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the sorted signal samples \(N\) in ascending order.

winsorize(limits: Optional[Union[float, tuple[Optional[float], Optional[float]]]] = None, **kwargs)[source]

Returns a new trace with the winsorized signal samples \(N\).

The nth-lowest sample values are set to the limits[0]-th percentile sample value, and the nth-highest sample values are set to the (1.0 - limits[1])-th percentile sample value.

Parameters
  • limits

    either a pair of the percentages as floats between 0.0 and 1.0 to cut on each side of the sorted signal samples in ascending order, or the percentage for both sides.

    The value of one limit can be set to None to indicate an open interval for this side.

  • label (str) – optional trace label to set

index_of(sample: Union[bool, int, float, str]) int[source]

Returns the index of the first occurrence of the sample \(x\) in the signal samples \(N\) or -1 if no sample could be found.

Parameters

sample – sample value to look for

count(sample: Union[bool, int, float, str]) int[source]

Returns the number of occurrences of the sample \(x\) in the signal samples \(N\).

Parameters

sample – sample value to count

sum(*operands, **kwargs) Union[signalyzer.trace.Trace, float][source]

Returns either a new trace with the sums of the signal samples and the provided operands, or the sum \(\sum\limits_{i=0}^{N}{x_i}\) of the signal samples \(N\) of the trace in case no operands are provided.

An operand can be either a fix number or an array-like iterable.

Parameters
  • operands – operands to sum up with each signal sample

  • label (str) – optional trace label to set

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

min(*operands: Tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float]], **kwargs) Union[signalyzer.trace.Trace, bool, int, float, str][source]

Returns either a new trace with the minimums of the signal samples and the provided operands, or the minimum \(x_{min}\) in the signal samples \(N\) of the trace in case no operands are provided.

An operand can be either a fix number or an array-like iterable.

Parameters
  • operands – operands to compare with each signal sample

  • label (str) – optional trace label to set

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

max(*operands: Tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float]], **kwargs) Union[signalyzer.trace.Trace, bool, int, float, str][source]

Returns either a new trace with the maximus of the signal samples and the provided operands, or the maximum \(x_{max}\) in the signal samples \(N\) of the trace in case no operands are provided.

An operand can be either a fix number or an array-like iterable.

Parameters
  • operands – operands to compare with each signal sample

  • label (str) – optional trace label to set

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

range() Union[float, int][source]

Returns the range \(x_{max} - x_{min}\) of the signal samples \(N\).

midrange() Union[float, int][source]

Returns the midrange \(\frac{x_{max} + x_{min}}{2}\) of the signal samples \(N\).

average(*operands, **kwargs) Union[signalyzer.trace.Trace, float][source]

Returns either a new trace with the averages of the signal samples and the provided operands, or the average \(\overline{x}\) of the signal samples \(N\) of the trace in case no operands are provided.

An operand can be either a fix number or an array-like iterable.

Parameters
  • operands – operands to compute with each signal sample

  • label (str) – optional trace label to set

Note

An iterable operand should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

mean() Union[float, int][source]

Returns the arithmetic mean \(\overline{x}\) of the signal samples \(N\).

weighted_mean() Union[float, int][source]

Returns the linear weighted arithmetic mean \(\overline{x}_{w}\) of the signal samples \(N\).

winsor_mean(limits: Optional[Union[float, tuple[Optional[float], Optional[float]]]] = None) Union[float, int][source]

Returns the winsorized arithmetic mean \(\overline{x}_{w\alpha}\) of the signal samples \(N\).

Parameters

limits

either a pair of the percentages as floats between 0.0 and 1.0 to cut on each side of the sorted signal samples in ascending order, or the percentage for both sides.

The value of one limit can be set to None to indicate an open interval for this side.

median() Union[float, int][source]

Returns the median \(\overline{x}_{med}\) of the signal samples \(N\).

mode() Union[float, int][source]

Returns the mode \(\overline{x}_{mod}\) of the signal samples \(N\).

rms() float[source]

Returns the root-mean-square \(x_{rms}\) of the signal samples \(N\).

aad() float[source]

Returns the average absolute deviation \(D_{mean}\) of the signal samples \(N\).

mad() float[source]

Returns the median absolute deviation \(D_{median}\) of the signal samples \(N\).

variance(**kwargs) float[source]

Returns the biased sample variance \(\sigma^2\) of the signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • unbiased (bool) – optional if True computes the unbiased variance \(\sigma^2\). Default is False.

std(**kwargs) float[source]

Returns the biased sample standard deviation \(\sigma\) of the signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • unbiased (bool) – optional if True computes the unbiased standard deviation \(\sigma\). Default is False.

coefficient(**kwargs) float[source]

Returns the coefficient of variation \(c_v\) of the signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • std – optional standard deviation. Default is the biased standard deviation std of the signal samples.

  • unbiased (bool) – optional if True uses the unbiased standard deviation \(\sigma\). Default is False.

skew(**kwargs) float[source]

Returns the biased sample skew of the signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • std – optional standard deviation. Default is the biased standard deviation std of the signal samples.

  • unbiased (bool) – optional if True uses the unbiased standard deviation \(\sigma\). Default is False.

kurtosis(**kwargs) float[source]

Returns the biased sample kurtosis of the signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • std – optional standard deviation. Default is the biased standard deviation std of the signal samples.

  • unbiased (bool) – optional if True uses the unbiased standard deviation \(\sigma\). Default is False.

zscore(**kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the biased z-scored signal samples \(N\).

Parameters
  • center – optional center value. Default is the arithmetic mean of the signal samples.

  • std – optional biased standard deviation. Default is the biased standard deviation std of the signal samples.

  • label (str) – optional trace label to set

clip(lower: Optional[Union[Iterable[Union[bool, int, float, str]], bool, int, float]] = None, upper: Optional[Union[Iterable[Union[bool, int, float, str]], bool, int, float]] = None, **kwargs) signalyzer.trace.Trace[source]

Returns either a new trace with the signal samples limited between the provided lower and upper bound, or the same trace in case no bounds are provided.

A bound can be either a fix number or an array-like iterable.

Parameters
  • lower (Operand) – optional lower bound to clip at. Default is None, this means the bound is not considered.

  • upper (Operand) – optional upper bound to clip at. Default is None, this means the bound is not considered.

  • label (str) – optional trace label to set

Note

The upper bound is dominant over the lower bound.

Note

An iterable bound should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

clamp(bound: Optional[Union[Iterable[Union[bool, int, float, str]], bool, int, float]] = None, **kwargs) signalyzer.trace.Trace[source]

Returns either a new trace with the signal samples symmetrically clamped at the provided bound, or the same trace in case no bound is provided.

A bound can be either a fix number or an array-like iterable.

Parameters
  • bound (Operand) – optional bound to clamp at. Default is None, this means the bound is not considered.

  • label (str) – optional trace label to set

Note

An iterable bound should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

ramp(limits: Optional[tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float, NoneType], Union[Iterable[Union[bool, int, float, str]], bool, int, float, NoneType]]] = None, **kwargs) signalyzer.trace.Trace[source]

Returns either a new trace with the signal samples limited by the maximal allowed positive and/or negative delta limits between consecutive samples, or the same trace in case no limits are provided.

The maximal allowed positive delta limit can be either a fix number or an array-like iterable.

The maximal allowed negative delta limit can be either a fix number or an array-like iterable.

Parameters
  • limits

    optional a pair with the maximal allowed positive and negative deltas between consecutive samples.

    The value of one limit can be set to None to indicate an unlimited ramp for this side.

  • label (str) – optional trace label to set

  • preset (float) – optional preset value of the ramp. Default is the first value in the signal samples.

Note

An iterable maximal allowed positive or negative step should have at least the same length as the signal samples, otherwise only a subset of the signal samples is returned!

slew(limits: Optional[tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float, NoneType], Union[Iterable[Union[bool, int, float, str]], bool, int, float, NoneType]]], hold: Optional[Union[Iterable[Union[bool, int, float, str]], bool, int, float]] = None, **kwargs) signalyzer.trace.SlewRateLimiterTraces[source]

Slew-rate limiter over the signal samples of the trace.

The maximal allowed positive delta limit can be either a fix number or an array-like iterable.

The maximal allowed negative delta limit can be either a fix number or an array-like iterable.

The number of samples to hold the previous sample value when the one of the configured slew-rates becomes violated can be either a fix number or an array-like iterable.

Parameters
  • limits

    a pair with the maximal allowed positive and negative deltas between consecutive samples.

    The value of one limit can be set to None to indicate an unlimited ramp for this side.

  • hold (Operand) – optional number of samples to hold the previous sample value when one of the configured slew-rates becomes violated.

  • preset (float) – optional preset value of the limiter. Default is the first value in the signal samples.

  • label (str) – optional trace label to set

band_pass(dt: float, f0: float, q: float = 0.7071067811865475, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples filtered with a second-order IIR band-pass filter.

Parameters
  • dt – sampling-time of the samples (filter) in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

  • label (str) – optional trace label to set

low_pass(dt: float, f0: float, q: float = 0.7071067811865475, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples filtered with a second-order IIR low-pass filter.

Parameters
  • dt – sampling-time of the samples (filter) in seconds

  • f0 – cutoff frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

  • label (str) – optional trace label to set

high_pass(dt: float, f0: float, q: float = 0.7071067811865475, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples filtered with a second-order IIR high-pass filter.

Parameters
  • dt – sampling-time of the samples (filter) in seconds

  • f0 – cutoff frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

  • label (str) – optional trace label to set

notch(dt: float, f0: float, q: float = 0.7071067811865475, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples filtered with a second-order IIR notch filter.

Parameters
  • dt – sampling-time of the samples (filter) in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

  • label (str) – optional trace label to set

all_pass(dt: float, f0: float, q: float = 0.7071067811865475, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples filtered with a second-order IIR all-pass filter.

Parameters
  • dt – sampling-time of the samples (filter) in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

  • label (str) – optional trace label to set

dt1(ratio: Union[Iterable[Union[bool, int, float, str]], bool, int, float], gain: Union[Iterable[Union[bool, int, float, str]], bool, int, float] = 1, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples of the trace processed by the transfer function of a DT1-element.

Parameters
  • ratio (int, float) – integer ratios between damping time and sampling time, or floating-point ratios between sampling time and damping time.

  • gain (Operand) – proportional gain of the DT1-element.

  • preset (float) – optional preset value of the DT1-element. Default is the first value in the signal samples.

  • label (str) – optional trace label to set

pt1(ratio: Union[Iterable[Union[bool, int, float, str]], bool, int, float], gain: Union[Iterable[Union[bool, int, float, str]], bool, int, float] = 1, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples of the trace processed by the transfer function of a PT1-element.

Parameters
  • ratio (Operand) – integer ratio between smoothing time and sampling time, or floating-point ratio between sampling time and smoothing time.

  • gain (Operand) – proportional gain of the PT1-element.

  • preset (float) – optional preset value of the PT1-element. Default is the first value in the signal samples.

  • label (str) – optional trace label to set

exponential(alpha: float, **kwargs) signalyzer.trace.ExponentialSmoothingTraces[source]

Second-order exponential smoothing over the signal samples of the trace.

Parameters
  • alpha (float) – smoothing factor [0.0:freeze..1.0:transparent]

  • level (float) – optional initial level of the exponential smoothing. Default is the first value in the signal samples.

  • trend (float) – optional initial trend of the exponential smoothing. Default is 0.0.

  • label (str) – optional trace label to set

window(size: int, **kwargs) Iterator[Tuple[Union[bool, int, float, str], ...]][source]

Moving window generator over the signal samples of the trace.

Parameters
  • size (int) – moving window size (number of samples)

  • preset (float) – optional preset value to fill the moving window. Default is the first value in the signal samples.

moving_average(size: int, **kwargs) signalyzer.trace.MovingAverageTraces[source]

Moving average over the signal samples of the trace.

Parameters
  • size (int) – moving window size (number of samples)

  • preset (float) – optional preset value to fill the moving window. Default is the first value in the signal samples.

moving_differential(size: int, **kwargs) signalyzer.trace.Trace[source]

Moving differential over the signal samples of the trace.

Parameters
  • size (int) – moving window size (number of samples)

  • preset (float) – optional preset value to fill the moving window. Default is the first value in the signal samples.

  • label (str) – optional trace label to set

moving_regression(size: int, **kwargs) signalyzer.trace.LinearRegressionTraces[source]

Moving linear regression over the signal samples of the trace.

Parameters
  • size (int) – moving window size

  • preset (float) – optional preset value to fill the moving window. Default is the first value in the signal samples.

  • label (str) – optional trace label to set

move(number: int, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the moved signal samples by the number of samples either to the right or to the left.

A positive number moves the signal samples to the right. This means a number of the first value in signal samples is inserted at the beginning of the signal samples to move as the fill value, and the number of the last signal samples are removed from the signal samples to move.

A negative number moves the signal samples to the left. This means a number of the last value in the signal samples is appended at end of the signal samples to move as the fill value, and the number of the first signal samples are removed from the signal samples to move.

Parameters
  • number (int) – number of samples to move to the right (> 0) or to the left (< 0).

  • label (str) – optional trace label to set

  • fill (float) – optional fill value. Default is the first or last value in the signal samples.

slice(*args, **kwargs) signalyzer.trace.Trace[source]

Returns a new trace with the signal samples sliced with the built-in function slice() in the range given by the arguments args.

Parameters
  • args – optional start, stop index and step for slicing the signal samples.

  • label (str) – optional trace label to set

iter_x() Iterator[int][source]

Returns an iterator for the x-coordinates of the trace.

iter_point() Iterator[signalyzer.trace.Point2D][source]

Returns an iterator for the x,y-points of the trace.

property x_values: List[int]

Returns a list with the x-coordinates of the trace.

property y_values: List(Sample)

Returns a list with the y-coordinates of the trace.

property digital: signalyzer.trace.Digital

Returns a new digital trace with shared signal samples.

plot(index: Optional[int] = None, n: Optional[int] = None, **kwargs) plotly.graph_objs._scatter.Scatter[source]

Returns the scatter plot of the trace.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

figure(index: Optional[int] = None, n: Optional[int] = None, **kwargs) plotly.graph_objs._figure.Figure[source]

Returns a figure with the scatter plot of the trace.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

vectorize

signalyzer.vectorize(operand: Union[Iterable[Union[bool, int, float, str]], bool, int, float]) Union[List[Union[bool, int, float, str]], Iterable[Union[bool, int, float, str]], Iterable[None]][source]

Returns for an int, float, bool or number literal str operand an endless iterator, otherwise the operand is returned unchanged.

Parameters

operand – operand to vectorize

Traces

class signalyzer.Traces[source]

Base data class for a collection of traces with mutable mapping support.

labels() Tuple[str, ...][source]

Returns a tuple of the trace labels in the collection.

relabel(label: str) signalyzer.trace.Traces[source]

Relabels the all traces with in the collection by keeping the last part of the trace label unchanged and the rest replaced by the base label.

Parameters

label (str) – base label to set for the traces in the collection.

fields() Tuple[Any, ...][source]

Returns a tuple describing the fields of the data class.

as_dict() Dict[str, Any][source]

Returns the collection of traces as a dictionary.

as_tuple() tuple[Any, ...][source]

Returns the collection of traces as a tuple.

VectorTraces

class signalyzer.VectorTraces(x: signalyzer.trace.Trace = <factory>, y: signalyzer.trace.Trace = <factory>, r: typing.Optional[signalyzer.trace.Trace] = None, phi: typing.Optional[signalyzer.trace.Trace] = None, theta: typing.Optional[signalyzer.trace.Trace] = None, distance: typing.Optional[signalyzer.trace.Trace] = None, dot: typing.Optional[signalyzer.trace.Trace] = None)[source]

Collection of traces for two signal samples converted into a vector represented in polar coordinates.

x: signalyzer.trace.Trace

Trace with cartesian x-coordinates of the vector

y: signalyzer.trace.Trace

Trace with cartesian y-coordinates of the vector

r: Optional[signalyzer.trace.Trace] = None

Trace with radii of the vector

phi: Optional[signalyzer.trace.Trace] = None

Trace with angles of the vector in radians [-pi..pi]

theta: Optional[signalyzer.trace.Trace] = None

Trace with angles of the vector in degree [0..360].

distance: Optional[signalyzer.trace.Trace] = None

Trace with euclidean distances of the consecutive x,y-points.

dot: Optional[signalyzer.trace.Trace] = None

Trace with dot products of the consecutive x,y-points.

plot(index: Optional[int] = None, n: Optional[int] = None, **kwargs) plotly.graph_objs._scatterpolar.Scatterpolar[source]

Returns the scatter polar plot of the vector traces.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

polar

signalyzer.polar(x: signalyzer.trace.Trace, y: signalyzer.trace.Trace, **kwargs) Dict[str, signalyzer.trace.Trace][source]

Returns a dictionary with the traces for the two x, y signal samples converted into a vector represented in polar coordinates.

Parameters
  • x (Trace) – cartesian x-coordinate signal trace of the vector

  • y (Trace) – cartesian y-coordinate signal trace of the vector

  • label (str) – optional traces base label to set. Default is Vector.

StatisticsTraces

class signalyzer.StatisticsTraces(mean: signalyzer.trace.Trace = <factory>, weighted_mean: signalyzer.trace.Trace = <factory>, median: signalyzer.trace.Trace = <factory>, mode: signalyzer.trace.Trace = <factory>, rms: signalyzer.trace.Trace = <factory>, minimum: signalyzer.trace.Trace = <factory>, maximum: signalyzer.trace.Trace = <factory>, range: signalyzer.trace.Trace = <factory>, midrange: signalyzer.trace.Trace = <factory>, absolute_error: signalyzer.trace.Trace = <factory>, variance: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, coefficient: signalyzer.trace.Trace = <factory>, skew: signalyzer.trace.Trace = <factory>, kurtosis: signalyzer.trace.Trace = <factory>)[source]

Collection of Statistics traces for a set of signal samples statistically analyzed.

mean: signalyzer.trace.Trace

Arithmetic mean of the set (1st common moment).

weighted_mean: signalyzer.trace.Trace

Linear weighted mean of the set.

median: signalyzer.trace.Trace

Median of the set.

mode: signalyzer.trace.Trace

Mode of the set.

rms: signalyzer.trace.Trace

Root mean square of the set

minimum: signalyzer.trace.Trace

Minimum in the set.

maximum: signalyzer.trace.Trace

Maximum in the set

range: signalyzer.trace.Trace

Range of the set.

midrange: signalyzer.trace.Trace

Mid-range of the set.

absolute_error: signalyzer.trace.Trace

Empirical absolute error of the set (1st central moment).

variance: signalyzer.trace.Trace

Empirical biased sample variance of the set (2nd central moment).

deviation: signalyzer.trace.Trace

Empirical biased sample standard deviation of the set.

coefficient: signalyzer.trace.Trace

Empirical biased sample coefficient of variation of the set.

skew: signalyzer.trace.Trace

Empirical biased sample skew of the set (3rd central moment).

kurtosis: signalyzer.trace.Trace

Empirical biased sample kurtosis of the set (4th central moment).

figure(index: Optional[int] = None, n: Optional[int] = None, original: Optional[signalyzer.trace.Trace] = None, subplots: Optional[Dict[str, Any]] = None) plotly.graph_objs._figure.Figure[source]

Returns a figure of subplots for the traces in the collection.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

  • original (Trace) – optional original trace to add to the plot

  • subplots (dict) – dictionary with the settings for the subplots

MovingAverageTraces

class signalyzer.MovingAverageTraces(mean: signalyzer.trace.Trace = <factory>, weighted_mean: signalyzer.trace.Trace = <factory>, median: signalyzer.trace.Trace = <factory>, mode: signalyzer.trace.Trace = <factory>, rms: signalyzer.trace.Trace = <factory>, minimum: signalyzer.trace.Trace = <factory>, maximum: signalyzer.trace.Trace = <factory>, range: signalyzer.trace.Trace = <factory>, midrange: signalyzer.trace.Trace = <factory>, absolute_error: signalyzer.trace.Trace = <factory>, variance: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, coefficient: signalyzer.trace.Trace = <factory>, skew: signalyzer.trace.Trace = <factory>, kurtosis: signalyzer.trace.Trace = <factory>)[source]

Collection of Statistics traces for signal samples processed with a simple moving average.

SetTraces

class signalyzer.SetTraces(mean: signalyzer.trace.Trace = <factory>, weighted_mean: signalyzer.trace.Trace = <factory>, median: signalyzer.trace.Trace = <factory>, mode: signalyzer.trace.Trace = <factory>, rms: signalyzer.trace.Trace = <factory>, minimum: signalyzer.trace.Trace = <factory>, maximum: signalyzer.trace.Trace = <factory>, range: signalyzer.trace.Trace = <factory>, midrange: signalyzer.trace.Trace = <factory>, absolute_error: signalyzer.trace.Trace = <factory>, variance: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, coefficient: signalyzer.trace.Trace = <factory>, skew: signalyzer.trace.Trace = <factory>, kurtosis: signalyzer.trace.Trace = <factory>)[source]

Collection of Statistics traces for the combined set of multiple signal samples.

classmethod from_traces(*operands: Tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float]], **kwargs) signalyzer.trace.SetTraces[source]

Returns the collection of Statistics traces computed over the combined sets of the operands.

An operand can be either a number or an array-like iterable.

Parameters
  • operands – operands to compute the statistics with

  • label (str) – optional traces base label to set

Note

All iterable operands must have the same length, otherwise only a subset of the operand values is returned!

combine

signalyzer.combine(*operands: Tuple[Union[Iterable[Union[bool, int, float, str]], bool, int, float]], **kwargs) Dict[str, signalyzer.trace.Trace][source]

Returns a dictionary with the traces for the statistics results computed over the combined sets of operands.

An operand can be either a number or an array-like iterable.

Parameters
  • operands – operands to compute the statistics with

  • label (str) – optional trace label stem to set

Note

All iterable operands must have the same length, otherwise only a subset of the operand values is returned!

SlewRateLimiterTraces

class signalyzer.SlewRateLimiterTraces(level: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, active: signalyzer.trace.Trace = <factory>)[source]

Collection of SlewRateLimiter traces for signal samples processed with a slew-rate limiter.

level: signalyzer.trace.Trace

Slew-rate limited signal level value.

deviation: signalyzer.trace.Trace

Signal deviation.

active: signalyzer.trace.Trace

Slew-rate limiter active (0: signal unlimited, 1: signal limited).

figure(index: Optional[int] = None, n: Optional[int] = None, original: Optional[signalyzer.trace.Trace] = None, subplots: Optional[Dict[str, Any]] = None) plotly.graph_objs._figure.Figure[source]

Returns a figure of subplots for the traces.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

  • original (Trace) – optional original trace to add to the plot

  • subplots (dict) – dictionary with the settings for the subplots

ExponentialSmoothingTraces

class signalyzer.ExponentialSmoothingTraces(forecast: signalyzer.trace.Trace = <factory>, forecast_sign: signalyzer.trace.Trace = <factory>, level: signalyzer.trace.Trace = <factory>, level_sign: signalyzer.trace.Trace = <factory>, prognosis1: signalyzer.trace.Trace = <factory>, prognosis2: signalyzer.trace.Trace = <factory>, prognosis: signalyzer.trace.Trace = <factory>, smoothed1: signalyzer.trace.Trace = <factory>, smoothed2: signalyzer.trace.Trace = <factory>, trend: signalyzer.trace.Trace = <factory>, trend_sign: signalyzer.trace.Trace = <factory>, trend_inflection: signalyzer.trace.Trace = <factory>, error: signalyzer.trace.Trace = <factory>, correction: signalyzer.trace.Trace = <factory>, absolute_error: signalyzer.trace.Trace = <factory>, variance: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, skew: signalyzer.trace.Trace = <factory>, kurtosis: signalyzer.trace.Trace = <factory>)[source]

Collection of ExponentialSmoothing traces for signal samples processed with a 2nd-order exponential smoothing.

forecast: signalyzer.trace.Trace

Signal forecast value.

forecast_sign: signalyzer.trace.Trace

Sign of the signal forecast (-1: negative, 0: zero, 1: positive).

level: signalyzer.trace.Trace

Signal level value.

level_sign: signalyzer.trace.Trace

Sign of the signal level (-1: negative, 0: zero, 1: positive).

prognosis1: signalyzer.trace.Trace

Signal prognosis value for the first-order exponential smoothing.

prognosis2: signalyzer.trace.Trace

Signal prognosis value for the second-order exponential smoothing.

prognosis: signalyzer.trace.Trace

Signal prognosis value of the exponential smoothing.

smoothed1: signalyzer.trace.Trace

First-order exponentially smoothed signal value.

smoothed2: signalyzer.trace.Trace

Second-order exponentially smoothed signal value.

trend: signalyzer.trace.Trace

Signal prognosis trend value.

trend_sign: signalyzer.trace.Trace

Sign of the signal trend (-1: negative, 0: zero, 1: positive).

trend_inflection: signalyzer.trace.Trace

Inflection of the signal prognosis trend (1: increase, -1: decrease).

error: signalyzer.trace.Trace

Signal prognosis error.

correction: signalyzer.trace.Trace

Signal prognosis correction.

absolute_error: signalyzer.trace.Trace

Empirical absolute error of the distribution (1st central moment).

variance: signalyzer.trace.Trace

Empirical variance of the distribution (2nd central moment).

deviation: signalyzer.trace.Trace

Empirical standard deviation of the distribution.

skew: signalyzer.trace.Trace

Empirical skew of the distribution (3rd central moment).

kurtosis: signalyzer.trace.Trace

Empirical kurtosis of the distribution (4th central moment).

figure(index: Optional[int] = None, n: Optional[int] = None, original: Optional[signalyzer.trace.Trace] = None, subplots: Optional[Dict[str, Any]] = None) plotly.graph_objs._figure.Figure[source]

Returns a figure of subplots for the traces.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

  • original (Trace) – optional original trace to add to the plot

  • subplots (dict) – dictionary with the settings for the subplots

LinearRegressionTraces

class signalyzer.LinearRegressionTraces(level: signalyzer.trace.Trace = <factory>, slope: signalyzer.trace.Trace = <factory>, intercept: signalyzer.trace.Trace = <factory>, mean: signalyzer.trace.Trace = <factory>, median: signalyzer.trace.Trace = <factory>, minimum: signalyzer.trace.Trace = <factory>, maximum: signalyzer.trace.Trace = <factory>, range: signalyzer.trace.Trace = <factory>, error: signalyzer.trace.Trace = <factory>, negative_error: signalyzer.trace.Trace = <factory>, positive_error: signalyzer.trace.Trace = <factory>, absolute_error: signalyzer.trace.Trace = <factory>, variance: signalyzer.trace.Trace = <factory>, deviation: signalyzer.trace.Trace = <factory>, skew: signalyzer.trace.Trace = <factory>, kurtosis: signalyzer.trace.Trace = <factory>)[source]

Collection of LinearRegression traces for signal samples processed with a moving linear regression.

level: signalyzer.trace.Trace

Current y-coordinate of the approximated line.

slope: signalyzer.trace.Trace

Slope of the approximated line.

intercept: signalyzer.trace.Trace

Y-intercept of the approximated line.

mean: signalyzer.trace.Trace

Arithmetic mean of the y-coordinate values of the approximated line.

median: signalyzer.trace.Trace

Median of the y-coordinate values of the approximated line.

minimum: signalyzer.trace.Trace

Minimum of the y-coordinate values of the approximated line.

maximum: signalyzer.trace.Trace

Maximum of the y-coordinate values of the approximated line.

range: signalyzer.trace.Trace

Range of the y-coordinate values of the approximated line.

error: signalyzer.trace.Trace

Current error from the approximated line.

negative_error: signalyzer.trace.Trace

Maximal negative y-coordinate error from the approximated line.

positive_error: signalyzer.trace.Trace

Maximal positive y-coordinate error from the approximated line.

absolute_error: signalyzer.trace.Trace

Empirical absolute error of the distribution (1st central moment).

variance: signalyzer.trace.Trace

Empirical variance of the distribution (2nd central moment).

deviation: signalyzer.trace.Trace

Empirical standard deviation of the distribution.

skew: signalyzer.trace.Trace

Empirical skew of the distribution (3rd central moment).

kurtosis: signalyzer.trace.Trace

Empirical kurtosis of the distribution (4th central moment).

figure(index: Optional[int] = None, n: Optional[int] = None, original: Optional[signalyzer.trace.Trace] = None, subplots: Optional[Dict[str, Any]] = None) plotly.graph_objs._figure.Figure[source]

Returns a figure of subplots for the traces in the collection.

Parameters
  • index (int) – start index of the samples to plot

  • n – number of samples to plot

  • original (Trace) – optional original trace to add to the plot

  • subplots (dict) – dictionary with the settings for the subplots

Representations

2D-Point

class signalyzer.Point2D(x: int = 0.0, y: float = 0.0)[source]

2-dimensional point representation by cartesian coordinates.

x: int = 0.0

X-coordinate of the 2-dimensional point.

y: float = 0.0

Y-coordinate of the 2-dimensional point.

property r

Radius of the 2-dimensional point.

property phi

Angle of the 2-dimensional point in radians [-pi..+pi].

property theta

Angle of the 2-dimensional point in degrees [0..360].

as_vector()[source]

Returns a Vector for the 2-dimensional point.

as_dict() Dict[str, Any][source]

Returns the 2-dimensional point as a dictionary.

as_tuple() tuple[Any, ...][source]

Returns the 2-dimensional point as a tuple.

3D-Point

class signalyzer.Point3D(x: int = 0.0, y: float = 0.0, z: float = 0.0)[source]

3-dimensional point representation by cartesian coordinates.

x: int = 0.0

X-coordinate of the 3-dimensional point.

y: float = 0.0

Y-coordinate of the 3-dimensional point.

z: float = 0.0

Z-coordinate of the 3-dimensional point.

property r

Radius of the 3-dimensional point.

as_dict() Dict[str, Any][source]

Returns the 3-dimensional point as a dictionary.

as_tuple() tuple[Any, ...][source]

Returns the 3-dimensional point as a tuple.

Vector

class signalyzer.Vector(r: float = 0.0, phi: float = 0.0, theta: Optional[float] = None)[source]

Vector representation by polar coordinates.

r: float = 0.0

Radius of the vector.

phi: float = 0.0

Angle of the vector in radians [-pi..+pi].

theta: Optional[float] = None

Angle of the vector in degrees [0..360].

2D-State

class signalyzer.State2D(name: str, x: int, y: int, color: str = 'Black')[source]

State represented by a 2-dimensional node.

name: str

Name of the state

x: int

X-coordinate of the node

y: int

Y-coordinate of the node

color: str = 'Black'

Color of the node

3D-State

class signalyzer.State3D(name: str, x: int, y: int, z: int, color: str = 'Black')[source]

State represented by a 3-dimensional node.

name: str

Name of the state

x: int

X-coordinate of the state node

y: int

Y-coordinate of the state node

z: int

Z-coordinate of the state node

color: str = 'Black'

Color of the node

Signal Processing

Statistics

class signalyzer.Statistics(mean: float = 0.0, weighted_mean: float = 0.0, median: float = 0.0, mode: float = 0.0, rms: float = 0.0, minimum: float = 0.0, maximum: float = 0.0, range: float = 0.0, midrange: float = 0.0, absolute_error: float = 0.0, variance: float = 0.0, deviation: float = 0.0, coefficient: float = 0.0, skew: float = 0.0, kurtosis: float = 0.0)[source]

Statistics results.

mean: float = 0.0

Arithmetic mean of the set (1st common moment)

weighted_mean: float = 0.0

Weighted mean of the set

median: float = 0.0

Median of the set

mode: float = 0.0

Mode of the set

rms: float = 0.0

Root mean square of the set

minimum: float = 0.0

Minimum in the set

maximum: float = 0.0

Maximum in the set

range: float = 0.0

Range of the set

midrange: float = 0.0

Mid-range of the set

absolute_error: float = 0.0

Empirical absolute error of the set (1st central moment).

variance: float = 0.0

Empirical biased sample variance of the set (2nd central moment).

deviation: float = 0.0

Empirical biased sample standard deviation of the set.

coefficient: float = 0.0

Empirical biased sample coefficient of variation of the set.

skew: float = 0.0

Empirical biased sample skew of the set (3rd central moment).

kurtosis: float = 0.0

Empirical biased sample kurtosis of the set (4th central moment).

Slew-Rate Limiter

class signalyzer.SlewRateLimiter(level: float = 0.0, deviation: float = 0.0, active: int = 0)[source]

Slew-rate limiter results.

level: float = 0.0

Slew-rate limited signal level value.

deviation: float = 0.0

Signal deviation.

active: int = 0

Slew-rate limiter active (0: signal unlimited, 1: signal limited).

Exponential Smoothing

class signalyzer.ExponentialSmoothing(forecast: float = 0.0, forecast_sign: float = 0, level: float = 0.0, level_sign: float = 0.0, prognosis1: float = 0.0, prognosis2: float = 0.0, prognosis: float = 0.0, smoothed1: float = 0.0, smoothed2: float = 0.0, trend: float = 0.0, trend_sign: float = 0.0, trend_inflection: float = 0.0, error: float = 0.0, correction: float = 0.0, absolute_error: float = 0.0, variance: float = 0.0, deviation: float = 0.0, skew: float = 0.0, kurtosis: float = 0.0)[source]

2nd-order exponential smoothing results.

forecast: float = 0.0

Signal forecast value.

forecast_sign: float = 0

Sign of the signal level (-1: negative, 0: zero, 1: positive).

level: float = 0.0

Signal level value.

level_sign: float = 0.0

Sign of the signal level (-1: negative, 0: zero, 1: positive).

prognosis1: float = 0.0

Signal prognosis value for the first-order exponential smoothing.

prognosis2: float = 0.0

Signal prognosis value for the second-order exponential smoothing.

prognosis: float = 0.0

Signal prognosis value of the exponential smoothing.

smoothed1: float = 0.0

First-order exponentially smoothed signal value.

smoothed2: float = 0.0

Second-order exponentially smoothed signal value.

trend: float = 0.0

Signal prognosis trend value.

trend_sign: float = 0.0

Sign of the signal trend (-1: negative, 0: zero, 1: positive).

trend_inflection: float = 0.0

Inflection of the signal prognosis trend (1: increase, -1: decrease).

error: float = 0.0

Signal prognosis error.

correction: float = 0.0

Signal prognosis correction.

absolute_error: float = 0.0

Empirical absolute error of the distribution (1st central moment).

variance: float = 0.0

Empirical variance of the distribution (2nd central moment).

deviation: float = 0.0

Empirical standard deviation of the distribution.

skew: float = 0.0

Empirical skew of the distribution (3rd central moment).

kurtosis: float = 0.0

Empirical kurtosis of the distribution (4th central moment).

Linear Regression

class signalyzer.LinearRegression(level: float = 0.0, slope: float = 0.0, intercept: float = 0.0, mean: float = 0.0, median: float = 0.0, minimum: float = 0.0, maximum: float = 0.0, range: float = 0.0, error: float = 0.0, negative_error: float = 0.0, positive_error: float = 0.0, absolute_error: float = 0.0, variance: float = 0.0, deviation: float = 0.0, skew: float = 0.0, kurtosis: float = 0.0)[source]

Linear regression results.

level: float = 0.0

Current y-coordinate of the approximated line.

slope: float = 0.0

Slope of the approximated line.

intercept: float = 0.0

Y-intercept of the approximated line.

mean: float = 0.0

Arithmetic mean of the y-coordinate values of the approximated line.

median: float = 0.0

Median of the y-coordinate values of the approximated line.

minimum: float = 0.0

Minimum of the y-coordinate values of the approximated line.

maximum: float = 0.0

Maximum of the y-coordinate values of the approximated line.

range: float = 0.0

Range of the y-coordinate values of the approximated line.

error: float = 0.0

Current error from the approximated line.

negative_error: float = 0.0

Maximal negative y-coordinate error from the approximated line.

positive_error: float = 0.0

Maximal positive y-coordinate error from the approximated line.

absolute_error: float = 0.0

Empirical absolute error of the distribution (1st central moment).

variance: float = 0.0

Empirical variance of the distribution (2nd central moment).

deviation: float = 0.0

Empirical standard deviation of the distribution.

skew: float = 0.0

Empirical skew of the distribution (3rd central moment).

kurtosis: float = 0.0

Empirical kurtosis of the distribution (4th central moment).

Filtering

class signalyzer.IIRFilter(b0: float, b1: float, b2: float, a1: float, a2: float, s1: float = 0.0, s2: float = 0.0)[source]

The IIRFilter class is a factory for a second-order recursive linear infinite impulse response filter, also known as SOS-IIR filter.

The transfer function \(H(z)\) with normalized filter coefficients of a second-order IIR filter is defined as follows:

\(H(z) = \frac{b_0 + b_1 \cdot z^{-1} + b_2 \cdot z^{-2}} {1 + a_1 \cdot z^{-1} + a_2 \cdot z^{-2}}\)

b0: float

Normalized feedforward filter coefficient

b1: float

Normalized feedforward filter coefficient (1st-order)

b2: float

Normalized feedforward filter coefficient (2nd-order)

a1: float

Normalized feedback filter coefficient (1st-order)

a2: float

Normalized feedback filter coefficient (2nd-order)

s1: float = 0.0

Sum of the 1st-feedback stage of the SOS-IIR filter

s2: float = 0.0

Sum of the 2nd-feedback stage of the SOS-IIR filter

classmethod band_pass(dt: float, f0: float, q: float = 0.7071067811865475) signalyzer.trace.IIRFilter[source]

Creates a digital second-order IIR band-pass filter with normalized filter coefficients for the given sampling-time dt, center frequency f0 and quality factor q of the filter.

Parameters
  • dt – sampling-time of the filter in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

classmethod low_pass(dt: float, f0: float, q: float = 0.7071067811865475) signalyzer.trace.IIRFilter[source]

Creates a digital second-order IIR low-pass filter with normalized filter coefficients for the given sampling-time dt, cutoff frequency f0 and quality factor q of the filter.

Parameters
  • dt – sampling-time of the filter in seconds

  • f0 – cutoff frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

classmethod high_pass(dt: float, f0: float, q: float = 0.7071067811865475) signalyzer.trace.IIRFilter[source]

Creates a digital second-order IIR high-pass filter with normalized filter coefficients for the given sampling-time dt, cutoff frequency f0 and quality factor q of the filter.

Parameters
  • dt – sampling-time of the filter in seconds

  • f0 – cutoff frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

classmethod notch(dt: float, f0: float, q: float = 0.7071067811865475) signalyzer.trace.IIRFilter[source]

Creates a digital second-order IIR notch filter with normalized filter coefficients for the given sampling-time dt, center frequency f0 and quality factor q of the filter.

Parameters
  • dt – sampling-time of the filter in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

classmethod all_pass(dt: float, f0: float, q: float = 0.7071067811865475) signalyzer.trace.IIRFilter[source]

Creates a digital second-order IIR all-pass filter with normalized filter coefficients for the given sampling-time dt, center frequency f0 and quality factor q of the filter.

Parameters
  • dt – sampling-time of the filter in seconds

  • f0 – center frequency of the filter in Hertz

  • q – inverse of bandwidth factor of the filter

clear()[source]

Clears the sum value of the feedback stages of the SOS-IIR filter.

compute(x: float) float[source]

Computes for the sample \(x\) the SOS-IIR filter equation in canonical form with the configured normalized filter coefficients.

Parameters

x – sample value to compute

State Machines

Statemachine

class signalyzer.Statemachine(states: typing.Dict[int, typing.Union[str, signalyzer.statemachine.State2D, signalyzer.statemachine.State3D]], signal: signalyzer.trace.Trace = <factory>, labels: typing.List = <factory>, matrix: typing.List[typing.List[int]] = <factory>)[source]

statemachine data class to evaluate the state transitions between states of a statemachine.

A state of the statemachine is defined by a tuple pair, consisting of a unique integer number of the state, and the label of the state.

The states of a statemachine must define a consecutive, ascending interval of integer numbers.

states: Dict[int, Union[str, signalyzer.statemachine.State2D, signalyzer.statemachine.State3D]]

States of the statemachine

signal: signalyzer.trace.Trace

Signal trace with the state numbers

labels: List

List with the state labels of the statemachine

matrix: List[List[int]]

Matrix with the counted transitions between the states

classmethod create(states: Union[int, Iterable[str, State2D, State3D]], start: Optional[int] = 0, **kwargs) Statemachine[source]

Creates either a statemachine with the number of states without labeling them, or a statemachine with states from an iterable containing the labels or representations of the states to create.

Parameters
  • states – number of states or a list with the labels or representations for the states to create

  • start (int) – start number for the states to create Default is 0.

property numbers

List with the state numbers of the statemachine.

fields() Tuple[Any, ...][source]

Returns a tuple describing the fields of the data class.

zeroed_matrix() List[List[int, ...]][source]

Returns the zeroed transition matrix of the statemachine.

zeroed_counters() Dict[tuple[int, ...], int][source]

Returns the dictionary with the zeroed state transition counters of the statemachine.

evaluate(signal: Optional[signalyzer.trace.Trace] = None) signalyzer.statemachine.Statemachine[source]

Counts the state transitions between the states of the statemachine in the signal.

The samples of the signal must contain only integer numbers defined by the states of the state machine.

Parameters

signal – optional a new signal to evaluate

flatten() Iterator[source]

Returns an iterator to flatten the state transition matrix into a list.

data() List[List[str, int, ...]][source]

Returns the data table with the counted state transitions between the states of the statemachine.

table(**kwargs) plotly.graph_objs._figure.Figure[source]

Returns a table figure for the state transition matrix of the statemachine.

plot(**kwargs) plotly.graph_objs._heatmap.Heatmap[source]

Returns a heatmap plot for the state transition matrix of the statemachine.

heatmap(**kwargs) plotly.graph_objs._figure.Figure[source]

Returns a heatmap figure for the state transition matrix of the statemachine.

flowchart(**kwargs) plotly.graph_objs._sankey.Sankey[source]

Returns a sankey flow-chart plot for the state transition matrix of the statemachine.

Converters

as_traces

signalyzer.as_traces(samples: List[Dict[str, Any]]) Dict[str, List[Any]][source]

Converts the list of samples into the trace format.