RawWrite

class PyLTSpice.raw.raw_write.RawWrite(plot_name=None, fastacces=True, numtype='auto', encoding='utf_16_le')[source]

Bases: object

This class represents the RAW data file being generated. Contrary to the RawRead this class doesn’t support stepped data.

add_trace(trace: Trace)[source]

Adds a trace to the RAW file. The trace needs to have the same size as trace 0 (‘time’, ‘frequency’, etc..) The first trace added defines the X-Axis and therefore the type of RAW file being generated. If no plot name was defined, it will automatically assign a name. :param trace: Needs to be of the :type trace: :return: Nothing :rtype: None

add_traces_from_raw(other: RawRead, trace_filter: Union[list, tuple, str], **kwargs)[source]

(Not fully implemented)

Merge two RawWrite classes together resulting in a new instance :param other: an instance of the RawRead class where the traces are going to be copied from. :type other: RawRead :param trace_filter: A list of signals that should be imported into the new file :type trace_filter: list, Tuple, or just a string for one trace

Parameters:
  • force_axis_alignment – If two raw files don’t have the same axis, an attempt is made to sync the two

  • admissible_error – maximum error allowed in the sync between the two axis

  • rename_format – when adding traces with the same name, it is possible to define a rename format. For example, if there are two traces named N001 in order to avoid duplicate names the rename format can be defined as “{}_{kwarg_name} where kwarg_name is passed as a keyword argument of this function. If just one trace is being added, this can be used to simply give the new name.

  • step – by default only step 0 is added from the second raw. It is possible to add other steps, by using this keyword parameter. This is useful when we want to “flatten” the multiple step runs into the same view.

Keyword:

minimum_timestep: This parameter forces the two axis to sync using a minimum time step. That is, all time increments that are less than this parameter will be suppressed.

Returns:

Nothing

get_trace(trace_ref)[source]

Retrieves the trace with the requested name (trace_ref).

Parameters:

trace_ref (str) – Name of the trace

Returns:

An object containing the requested trace

Return type:

DataSet subclass

save(filename: str)[source]

Saves the RAW file into a file. The file format is always binary. Text based RAW output format is not supported in this version. :param filename: filename to where the RAW file is going to be written. Make sure that the extension of the file is .RAW.

Returns:

Nothing

Return type:

None