Trace Collections#

The signalyzer package provides a Traces class in order to collect the result traces of one or more processed signal traces.

A collection of Traces is a data class with mutable mapping support to iterate over the traces within the collection or to select a Trace within the collection by its name.

Note

The Traces class is the base class for trace collections and is not intended to be used directly.

You can import the Traces class from the signalyzer package.

>>> from signalyzer import Traces

Create a Collection of Traces#

You can create an empty collection of Traces by calling the Traces class.

>>> # create an empty collection
>>> Traces()
Traces()

Number of Traces#

You can get the number of the traces in the collection of Traces with the built-in function len().

>>> # number of traces in the collection
>>> len(Traces())
0

Names of the Traces in the Collection#

You can get the list with the names of the traces in the collection of Traces.

A list with the key names of the traces is returned.

>>> # list of the key names of the traces in the collection
>>> list(Traces())
[]

You can get an iterator over the names of the traces in the collection of Traces.

>>> # name iterator of the traces
>>> Traces().keys()
KeysView(Traces())

Traces in the Collection#

You can get the list with the traces in the collection of Traces.

A list with the traces is returned.

>>> # list of the traces in the collection
>>> list(Traces().values())
[]

You can get an iterator over the traces in the collection of Traces.

>>> # trace iterator of the collection
>>> Traces().values()
ValuesView(Traces())

Items in the Collection#

You can get the list with the trace items in the collection of Traces.

A list with the name, trace items is returned.

>>> # list of the items in the collection
>>> list(Traces().items())
[]

You can get an iterator over the items in the collection of Traces.

>>> # item iterator of the collection
>>> Traces().items()
ItemsView(Traces())

Labels of the Traces in the Collection#

You can get the list with the labels of the traces in the collection of Traces by calling the method labels().

A list with the labels of the traces is returned.

>>> # list of the labels of the traces in the collection
>>> Traces().labels()
()

Convert Traces to Dictionary#

Your can convert a collection of Traces into a dict class by calling the method as_dict().

>>> Traces().as_dict()
{}

Your can convert a collection of Traces into a dict class with the function asdict() from the dataclasses module.

>>> from dataclasses import asdict
>>> asdict(Traces())
{}

Convert Traces to Tuple#

Your can convert a collection of Traces into a tuple class by calling the method as_tuple().

>>> Traces().as_tuple()
()

Your can convert a collection of Traces into a tuple class with the function astuple() from the dataclasses module.

>>> from dataclasses import astuple
>>> astuple(Traces())
()