Traces#

Overview#

class mhi.psout.Trace#

An individual trace stored in the file, identified by run and call.

Trace data is returned as an array.array(), with an underlying type code specifying byte, int or float values of various precision.

A trace may have an associated domain trace, such as time or frequency.

Note

Support for complex traces requires Python >= 3.15. Neither str not blob data types are supported at this time.

Identification#

Trace.id#

Returns run handle id

Trace.call#

Returns the associated call

Trace.run#

Run trace is from

Trace.variables() → Dict[str, Any]#

Retrieve the key=value attributes stored with this object as a dictionary.

If only a single variable value is required, item["VariableName"] may be used to fetch just that value.

Data#

property Trace.domain: Trace#

The domain of the trace

Trace.datatype#

Trace datatype (int, float, …)

property Trace.data_type: DataType#

The PSOUT version data type of values contained in the trace.

This data type distinguishes the resolution of underlying data stored in the trace. Where datatype will only return the general Python type (int, float, complex, …), this attribute reveals the actual size (number of bits) used to store the data, and for integers whether or not they are signed or unsigned.

Added in version 2.0.

Trace.data#

Returns the sample values

Trace.size#

Returns the size

Trace.write_value(datum: int | float)#

Add an additional value(s) to the (current) end of the trace.

After adding a trace to a run, data can be incrementally added to the trace.

Parameters:

datum – the data value to append to the trace

Added in version 2.0.

Trace.write_values(data: bytes | Sequence[float]) → int#

Add additional values to the (current) end of the trace.

After adding a trace to a run, data can be incrementally added to the trace.

Parameters:

data – a sequence of data values to append to the trace

Added in version 2.0.