Skip to content

TimeSeries

TimeSeries(values, time_step, time_index=0)

Time series data.

Args

  • values (dict[str, Sequence[complex]]): Values in the time series as a dictionary mapping names to the sequence of values corresponding to consecutive time steps.
  • time_step (float): Time step between consecutive values in the time series.
  • time_index (int): Starting index of the time series. The time series starts at time t = time_index * time_step.

Example

The time series data can be indexed by port name or time index:

>>> data = pf.TimeSeries(
... {"P0@0": [0, 1, 2, 3], "T1": [-1, -2, -3]}, 1e-10, 5
... )
>>> data["T1"] # note missing values filled with zeros
array([-1.+0.j, -2.+0.j, -3.+0.j, 0.+0.j])
>>> data[6] # time_index == 5, so index 6 means the 2nd value
{'P0@0': (1+0j), 'T1': (-2+0j)}
MethodDescription
copyCreate a copy of this time_series.

copy(self)

Create a copy of this time_series.

Returns

New copy.

AttributeDescription
propertiesProperties: Object properties.
time_indexint: Starting index in the time series.
time_stepfloat: Time step dt in the time series (read only).
timesndarray: Times in the time series (read only).
valuesdict[str, ndarray]: Values in the time series (read only).

Properties: Object properties.

int: Starting index in the time series.

float: Time step dt in the time series (read only).

ndarray: Times in the time series (read only).

dict[str, ndarray]: Values in the time series (read only).