RawWrite¶
- class spicelib.RawWrite(plot_name=None, fastacces=True, numtype='auto', encoding='utf_16_le')[source]¶
Bases:
objectThis class represents the RAW data file being generated. Contrary to the RawRead this class doesn’t support stepped data.
- add_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.
- Parameters:
trace (Trace) – Needs to be of the
- Returns:
Nothing
- add_traces_from_raw(other, trace_filter, **kwargs)[source]¶
Merge two RawWrite classes together resulting in a new instance
- Parameters:
other (RawRead) – an instance of the RawRead class where the traces are going to be copied from.
trace_filter (list | tuple | str) – A list of signals that should be imported into the new file
- Keyword Arguments:
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.
add_tag – a simpler way to add many traces with the same name to the raw file. Use this argument to just add a suffix to trace name. This is an alternative to the rename_format parameter. If rename_format is given, this parameter is ignored.
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)[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.
- Parameters:
filename (Path | str) – filename to where the RAW file is going to be written. Make sure that the extension of the file is .RAW.
- Returns:
Nothing