Runs#
Overview#
Identification#
- Run.id#
Returns run handle id
- Run.file#
File run is from
Traces#
- Run.num_traces#
Returns number of traces
- Run.trace(ident: int | Call) Trace#
Return a trace from this run identified by index or call.
- Parameters:
ident – the index or call of the trace
- Run.trace_list(width: int = 0, file: ~typing.TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None#
Print all of the traces held within this run.
- Run.call(*args, sep: str = '') Trace#
Retrieve a trace from this run for the given call path.
- Parameters:
path – The call path, as names or ids
sep – A delimiter string, used when single string argument is given
Examples:
trace = run.call("Root/Main/AC Voltage/Record/1", sep="/") trace = run.call("Root", "Main", "AC Voltage", "Record", 1)
Note
A path segment composed entirely of digits is converted to an integer and used as a call id.
- Run.trace_paths(path: str = '**', sep: str = '') Iterable[Tuple[Trace, str]]#
Retrieve the traces and paths from this run which match the given call path.
- Parameters:
path – The call path to find traces
sep – A delimiter string (optional)
Example:
for trace, path in run.trace_paths("**/[@Source='Trace']"): print(path, trace)
- Run.add_trace(call_path: str | Call, *, sep: str = '', domain: Trace | None = None, data_type: DataType = DataType.DEFAULT, data: bytes | Sequence[float] | None = None, **kwargs) Trace#
Add a new trace to the run for the given call.
Either the
dataor thedata_typemust be specified. Ifdata_typeis not given, thedatais scanned to determine an appropriate type. If thedata_typeis given, the trace’s data can be added later, either incrementally or all at once.A
domain(such as “time”) must be specified when the trace is added, or the trace will not have a corresponding domain. (A trace without a domain is usually used as the domain for other traces.)- Parameters:
call_path – The node in the call tree the trace corresponds to.
sep – A call_path delimiter string (optional)
domain – The independent axis (time, frequency, …) for the trace
data_type – The types of values stored in the trace (UINT16, REAL64, …)
data – The trace data
kwargs – Additional name/value pairs to store with the trace
Added in version 2.0.
- Run.add_pscad_domain(call: Call, *, unit: str = '', data_type: DataType = DataType.DEFAULT, data: bytes | Sequence[float] | None = None) Trace#
Add a PSCAD-flavour domain trace to the run for the given call.
Either the
dataor thedata_typemust be specified. Ifdata_typeis not given, thedatais scanned to determine an appropriate type. If thedata_typeis given, the trace’s data can be added later, either incrementally or all at once.- Parameters:
call – The node in the call tree the trace corresponds to.
unit – The unit for the trade axis, such as “secs”.
data_type – The types of values stored in the trace (UINT16, REAL64, …).
data – The trace data.
Added in version 2.0.
- Run.add_pscad_trace(call: Call, group: str = '', *, unit: str = '', min: float = nan, max: float = nan, domain: Trace | None = None, data_type: DataType = DataType.DEFAULT, data: bytes | Sequence[float] | None = None) Trace#
Add a PSCAD-flavour trace to the run for the given call.
Either the
dataor thedata_typemust be specified. Ifdata_typeis not given, thedatais scanned to determine an appropriate type. If thedata_typeis given, the trace’s data can be added later, either incrementally or all at once.- Parameters:
call – The node in the call tree the trace corresponds to.
group – A description used to group traces together
unit – The unit for the trade axis, such as “secs” (optional)
min – Minimum value of the trace, for plotting (optional)
max – Maximum value of the trace, for plotting (optional)
domain – The independent axis (time, frequency, …) for the trace
data_type – The types of values stored in the trace (UINT16, REAL64, …).
data – The trace data.
Added in version 2.0.