Set Traces#
The set trace collection is used to store the resulting signal
traces produced by the signal statistics
analysis for each combined set of the provided sets of signal
samples.
Create the Trace Collection#
You can create a set trace collection from multiple traces, iterables,
iterators and/or numbers by calling the class method from_traces()
with the sets of signal samples which shall be combined and
statistically analyzed.
>>> # create a set trace collection from traces, iterables, iterators, numbers
>>> traces = SetTraces.from_traces(
... Trace('Signal', [1, 2, 3]),
... Trace('Signal', [-3, -2, -1]),
... [1, 0, -1],
... range(3),
... 0)
>>> traces
SetTraces(mean=Trace(label='SetTrace:mean',
samples=[-0.2, 0.2, 0.6]),
weighted_mean=Trace(label='SetTrace:weighted_mean',
samples=[-0.13333333333333333, 0.13333333333333333, 0.4]),
median=Trace(label='SetTrace:median',
samples=[0, 0, 0]),
mode=Trace(label='SetTrace:mode',
samples=[1, 0, -1]),
rms=Trace(label='SetTrace:rms',
samples=[1.4832396974191326, 1.3416407864998738, 1.7320508075688772]),
minimum=Trace(label='SetTrace:minimum',
samples=[-3, -2, -1]),
maximum=Trace(label='SetTrace:maximum',
samples=[1, 2, 3]),
range=Trace(label='SetTrace:range',
samples=[4, 4, 4]),
midrange=Trace(label='SetTrace:midrange',
samples=[-1.0, 0.0, 1.0]),
absolute_error=Trace(label='SetTrace:absolute_error',
samples=[5.6000000000000005, 5.2, 7.6]),
variance=Trace(label='SetTrace:variance',
samples=[2.1599999999999993, 1.7600000000000002, 2.6399999999999997]),
deviation=Trace(label='SetTrace:deviation',
samples=[1.4696938456699067, 1.32664991614216, 1.624807680927192]),
coefficient=Trace(label='SetTrace:coefficient',
samples=[-7.348469228349533, 6.6332495807108005, 2.7080128015453204]),
skew=Trace(label='SetTrace:skew',
samples=[-1.1642636431747204, -0.37003665016361925, 0.3804646084815739]),
kurtosis=Trace(label='SetTrace:kurtosis',
samples=[2.8127572016460904, 2.21694214876033, 1.4421487603305787]))
Important
All iterables should have the same length, otherwise only a subset is returned!
Note
The linear weighted mean is computed with the order of the provided traces to combine. The lowest weight has the first trace the highest weight has the last trace.
Empty Collection#
You can create a set trace collection without samples
by calling the SetTraces class.
>>> # create an empty set trace collection
>>> traces = SetTraces()
>>> traces
SetTraces(mean=Trace(label='Trace', samples=[]),
weighted_mean=Trace(label='Trace', samples=[]),
median=Trace(label='Trace', samples=[]),
mode=Trace(label='Trace', samples=[]),
rms=Trace(label='Trace', samples=[]),
minimum=Trace(label='Trace', samples=[]),
maximum=Trace(label='Trace', samples=[]),
range=Trace(label='Trace', samples=[]),
midrange=Trace(label='Trace', samples=[]),
absolute_error=Trace(label='Trace', samples=[]),
variance=Trace(label='Trace', samples=[]),
deviation=Trace(label='Trace', samples=[]),
coefficient=Trace(label='Trace', samples=[]),
skew=Trace(label='Trace', samples=[]),
kurtosis=Trace(label='Trace', samples=[]))
Number of Traces#
You can get the number of the traces in the SetTraces collection
with the built-in function len().
>>> # number of traces in the collection
>>> len(traces)
15
Names of the Traces#
You can get the list with the names of the traces in the
SetTraces collection.
A list with the key names of the traces is returned.
>>> # key names of the traces in the collection
>>> list(traces)
['mean',
'weighted_mean',
'median',
'mode',
'rms',
'minimum',
'maximum',
'range',
'midrange',
'absolute_error',
'variance',
'deviation',
'coefficient',
'skew',
'kurtosis']
>>> # key names of the traces in the collection
>>> list(traces.keys())
['mean',
'weighted_mean',
'median',
'mode',
'rms',
'minimum',
'maximum',
'range',
'midrange',
'absolute_error',
'variance',
'deviation',
'coefficient',
'skew',
'kurtosis']
Mean Trace#
You can get the arithmetic mean Trace with the
mean attribute from the SetTraces
collection.
The Trace with the arithmetic mean samples
is returned.
>>> # mean trace by attribute
>>> traces.mean
Trace(label='Trace', samples=[])
>>> # mean trace by key
>>> traces['mean']
Trace(label='Trace', samples=[])
Weighted Mean Trace#
You can get the linear weighted mean Trace with the
weighted_mean attribute from the
SetTraces collection.
The Trace with the linear weighted mean samples
is returned.
>>> # linear weighted mean trace by attribute
>>> traces.weighted_mean
Trace(label='Trace', samples=[])
>>> # linear weighted mean trace by key
>>> traces['weighted_mean']
Trace(label='Trace', samples=[])
Median Trace#
You can get the median Trace with the
median attribute from the SetTraces
collection.
The Trace with the median samples
is returned.
>>> # median trace by attribute
>>> traces.median
Trace(label='Trace', samples=[])
>>> # median trace by key
>>> traces['median']
Trace(label='Trace', samples=[])
Mode Trace#
You can get the mode Trace with the
mode attribute from the SetTraces
collection.
The Trace with the mode samples
is returned.
>>> # mode trace by attribute
>>> traces.mode
Trace(label='Trace', samples=[])
>>> # mode trace by key
>>> traces['mode']
Trace(label='Trace', samples=[])
Root Mean Square Trace#
You can get the root mean square Trace with the
rms attribute from the SetTraces
collection.
The Trace with the root mean square samples
is returned.
>>> # root mean square (rms) trace by attribute
>>> traces.rms
Trace(label='Trace', samples=[])
>>> # root mean square (rms) trace by key
>>> traces['rms']
Trace(label='Trace', samples=[])
Minimum Trace#
You can get the minimum Trace with the
minimum attribute from the SetTraces
collection.
The Trace with the minimum samples is returned.
>>> # minimum trace by attribute
>>> traces.minimum
Trace(label='Trace', samples=[])
>>> # minimum trace by key
>>> traces['minimum']
Trace(label='Trace', samples=[])
Maximum Trace#
You can get the maximum Trace with the
maximum attribute from the SetTraces
collection.
The Trace with the maximum samples is returned.
>>> # maximum trace by attribute
>>> traces.maximum
Trace(label='Trace', samples=[])
>>> # maximum trace by key
>>> traces['maximum']
Trace(label='Trace', samples=[])
Range Trace#
You can get the range Trace with the
maximum attribute from the SetTraces
collection.
The Trace with the range samples is returned.
>>> # range trace by attribute
>>> traces.range
Trace(label='Trace', samples=[])
>>> # range trace by key
>>> traces['range']
Trace(label='Trace', samples=[])
Mid-Range Trace#
You can get the midrange Trace with the
midrange attribute from the SetTraces
collection.
The Trace with the midrange samples
is returned.
>>> # mid-range trace by attribute
>>> traces.midrange
Trace(label='Trace', samples=[])
>>> # mid-range trace by key
>>> traces['midrange']
Trace(label='Trace', samples=[])
Absolute Error Trace#
You can get the absolute error Trace with the
absolute_error attribute from the
SetTraces collection.
The Trace with the absolute error samples is returned.
>>> # absolute error trace by attribute
>>> traces.absolute_error
Trace(label='Trace', samples=[])
>>> # absolute error trace by key
>>> traces['absolute_error']
Trace(label='Trace', samples=[])
Variance Trace#
You can get the variance Trace with the
variance attribute from the SetTraces
collection.
The Trace with the variance samples is returned.
>>> # variance trace by attribute
>>> traces.variance
Trace(label='Trace', samples=[])
>>> # variance trace by key
>>> traces['variance']
Trace(label='Trace', samples=[])
Standard Deviation Trace#
You can get the standard deviation Trace with the
deviation attribute from the SetTraces
collection.
The Trace with the standard deviation samples
is returned.
>>> # standard deviation trace by attribute
>>> traces.deviation
Trace(label='Trace', samples=[])
>>> # standard deviation trace by key
>>> traces['deviation']
Trace(label='Trace', samples=[])
Coefficient of Variation Trace#
You can get the coefficient of variation Trace with the
coefficient attribute from the SetTraces
collection.
The Trace with the coefficient of variation samples
is returned.
>>> # coefficient of variation trace by attribute
>>> traces.coefficient
Trace(label='Trace', samples=[])
>>> # coefficient of variation trace by key
>>> traces['coefficient']
Trace(label='Trace', samples=[])
Skew Trace#
You can get the skew Trace with the
skew attribute from the SetTraces
collection.
The Trace with the skew samples is returned.
>>> # biased skew trace by attribute
>>> traces.skew
Trace(label='Trace', samples=[])
>>> # biased skew trace by key
>>> traces['skew']
Trace(label='Trace', samples=[])
Kurtosis Trace#
You can get the kurtosis Trace with the
kurtosis attribute from the SetTraces
collection.
The Trace with the kurtosis samples is returned.
>>> # biased kurtosis trace by attribute
>>> traces.kurtosis
Trace(label='Trace', samples=[])
>>> # biased kurtosis trace by key
>>> traces['kurtosis']
Trace(label='Trace', samples=[])
Figure#
You can visualize the trace collection with a figure containing the subplots of
the traces in the collection by calling the method
figure().
>>> figure = SetTraces.from_traces(
... Trace('Signal', [1, 2, 3]),
... Trace('Signal', [-3, -2, -1]),
... [1, 0, -1],
... range(3),
... 0).figure()
(Source code, html)