SimulationResults¶
- class pystclient.clients.SimulationResults(session: Session, measurements: list[Measurements], project_id: Annotated[str | UUID, PlainSerializer(func=str, return_type=str, when_used=always)], index: int = 0)¶
Bases:
Iterator[list[QueryResult]]Iterator that pages through simulation measurement results in configurable time steps.
Wraps a list of
Measurementsand exposes an iterator interface that queries the STC API for result data one time window at a time. Usestep()to configure the window size andreset()to restart iteration from a different measurement index or with different variables.- __init__(session: Session, measurements: list[Measurements], project_id: Annotated[str | UUID, PlainSerializer(func=str, return_type=str, when_used=always)], index: int = 0) None¶
Methods
__init__(session, measurements, project_id)Return the total number of measurement records available for iteration.
query_variables(query_variables)Replace the set of variables included in subsequent query results.
reset([index, query_variables])Restart iteration from the beginning of a specific measurement record.
step(t)Configure the time window size used when paging through results.
Attributes
Access the underlying measurement records used by this iterator.
- measurement_size() int¶
Return the total number of measurement records available for iteration.
- Returns:
Number of measurement records
- query_variables(query_variables: list[QueryVariable]) None¶
Replace the set of variables included in subsequent query results.
Instance IDs are resolved automatically from instance names when not already set on the provided
QueryVariableobjects.- Parameters:
query_variables – Variables to include in future query results
- reset(index: int = 0, query_variables: list[QueryVariable] | None = None) None¶
Restart iteration from the beginning of a specific measurement record.
Resets the internal time cursor to the start of the measurement at the given
indexand optionally narrows the query to a specific set of variables. Call this to re-iterate over the same or a different measurement without creating a newSimulationResultsobject.- Parameters:
index – Zero-based index of the measurement record to iterate over, by default 0
query_variables – Specific variables to include in query results. If
None,included. (all variables from the measurement are)
- step(t: timedelta) None¶
Configure the time window size used when paging through results.
Each call to
next()will return data for a window of this duration. The default step is 15 minutes.- Parameters:
t – Duration of each query time window
- property measurements: list[Measurements]¶
Access the underlying measurement records used by this iterator.
- Returns:
All measurement records associated with this simulation result set
- project_id: Annotated[str | UUID, PlainSerializer(func=str, return_type=str, when_used=always)]¶
- session: Session¶