Skip to content

The api.objects.Metrics class

Inherits from ABC > SimvueObject

Class for retrieving metrics stored on the server.

Methods

__init__()

Initialise a Metrics object instance.


commit()

Send updates to the server, or if offline, store locally.


count()

Return the total number of entries for this object type from the server.

Returns

int

total from server database for current user.


delete()

Metrics cannot be deleted


get(...)

Retrieve metrics from the server for a given set of runs.

Parameters
metrics list[str]
xaxis Literal['timestamp', 'step', 'time'] step - enumeration.
time - time in seconds.
timestamp - time stamp.
runs list[str]
count Optional[Annotated[int, Gt(gt=0)]] = None
offset Optional[Annotated[int, Gt(gt=0)]] = None

Yields

dict[str, dict[str, list[dict[str, float]]]

metric set object containing metrics for run.


ids(...)

Retrieve a list of all object identifiers.

Parameters
count int | None = None
offset int | None = None

Yields

str

identifiers for all objects of this type.


names()


new(...)

Create a new Metrics entry on the Simvue server.

Parameters
run str
metrics list[simvue.models.MetricSet]
offline bool = False

Returns

Metrics

metrics object


on_reconnect(...)

Action performed when mode switched from offline to online.

Parameters
id_mapping dict[str, str]

read_only(...)

Set whether this object is in read only state.

Parameters
is_read_only bool

refresh()

Refresh staging from local data if in read-only mode.


span()


to_dict()

Convert metrics object to dictionary.

Returns

dict[str, Any]

dictionary representation of metrics object.


Properties

id

The identifier for this object if applicable.

Returns

str | None


staged

Return currently staged changes to this object.

Returns

dict[str, Any] | None

the locally staged data if available.


url

The URL for accessing this object on the server.

Returns

simvue.api.url.URL | None