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.
- 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.
- relabel(label: str) signalyzer.trace.Trace [source]¶
Returns the same trace relabeled with the new label.
- Parameters
label (str) – new label to set
- 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
.
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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 signalsamples
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 signalsamples
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 signalsamples
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
- 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
- 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
- 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
- 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
- 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
- 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.
- 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
.
- 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.
- 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.
- 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.
- 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.
- 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
and1.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 signalsamples
\(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
- 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 signalsamples
\(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
- 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 signalsamples
\(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
- 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 signalsamples
\(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
- 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
and1.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\).
- 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\).
- std(**kwargs) float [source]¶
Returns the biased sample standard deviation \(\sigma\) of the signal
samples
\(N\).
- coefficient(**kwargs) float [source]¶
Returns the coefficient of variation \(c_v\) of the signal
samples
\(N\).- Parameters
- skew(**kwargs) float [source]¶
Returns the biased sample skew of the signal
samples
\(N\).- Parameters
- kurtosis(**kwargs) float [source]¶
Returns the biased sample kurtosis of the signal
samples
\(N\).- Parameters
- zscore(**kwargs) signalyzer.trace.Trace [source]¶
Returns a new trace with the biased z-scored signal
samples
\(N\).
- 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.
- 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
- 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 consecutivesamples
, 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- 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.
- moving_average(size: int, **kwargs) signalyzer.trace.MovingAverageTraces [source]¶
Moving average over the signal
samples
of the trace.
- moving_differential(size: int, **kwargs) signalyzer.trace.Trace [source]¶
Moving differential over the signal
samples
of the trace.
- moving_regression(size: int, **kwargs) signalyzer.trace.LinearRegressionTraces [source]¶
Moving linear regression over the signal
samples
of the trace.
- 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 signalsamples
is inserted at the beginning of the signalsamples
to move as the fill value, and the number of the last signalsamples
are removed from the signalsamples
to move.A negative number moves the signal
samples
to the left. This means a number of the last value in the signalsamples
is appended at end of the signalsamples
to move as the fill value, and the number of the first signalsamples
are removed from the signalsamples
to move.
- slice(*args, **kwargs) signalyzer.trace.Trace [source]¶
Returns a new trace with the signal
samples
sliced with the built-in functionslice()
in the range given by the arguments args.
- iter_point() Iterator[signalyzer.trace.Point2D] [source]¶
Returns an iterator for the x,y-points of the trace.
- property y_values: List(Sample)¶
Returns a list with the y-coordinates of the trace.
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 literalstr
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.
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.
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.
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).
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)
.
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).
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).
Representations¶
2D-Point¶
- class signalyzer.Point2D(x: int = 0.0, y: float = 0.0)[source]¶
2-dimensional point representation by cartesian coordinates.
- 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].
3D-Point¶
Vector¶
2D-State¶
3D-State¶
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.
Slew-Rate Limiter¶
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.
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.
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}}\)
- 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
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 betweenstates
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 integernumbers
.- 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
- 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.
- property numbers¶
List with the state numbers of the statemachine.
- 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 thesignal
.The
samples
of thesignal
must contain only integernumbers
defined by thestates
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.