RawRead Trace

class PyLTSpice.raw_classes.Trace(name, whattype, datalen, axis, numerical_type='real')[source]

Bases: DataSet

This class is used to represent a trace. It derives from DataSet and implements the additional methods to support STEPed simulations. This class is constructed by the get_trace() command. Data can be accessed through the [] and len() operators, or by the get_wave() method. If numpy is available the get_wave() method will return a numpy array.

get_len(step: int = 0) int[source]

Returns the length of the axis. :param step: Optional parameter the step index. :type step: int :return: The number of data points :rtype: int

get_point(n: int, step: int = 0)[source]

Implementation of the [] operator.

Parameters:
  • n (int) – item in the array

  • step (int) – Optional step number

Returns:

float value of the item

Return type:

float

get_point_at(t, step: int = 0)[source]

Get a point from the trace at the point specified by the /t/ argument. If the point doesn’t exist on the axis, the data is interpolated using a linear regression between the two adjacent points. :param t: point in the axis where to find the point. :type t: float, float32(numpy) or float64(numpy) :param step: step index :type step: int

get_wave(step: int = 0)[source]

Returns the data contained in this object. For stepped simulations an argument must be passed specifying the step number. If no steps exist, the argument must be left blank. To know whether stepped data exist, the user can use the get_raw_property(‘Flags’) method.

If numpy is available the get_wave() method will return a numpy array.

Parameters:

step (int) – To be used when stepped data exist on the RAW file.

Returns:

a List or numpy array (if installed) containing the data contained in this object.

Return type:

list or numpy.array