import datetime
import typing
from .base import Type
from .time import TimeRange
from ..base import Property
[docs]
class Metric(Type):
"""Metric type"""
title: str = Property(doc='Name of the metric')
value: typing.Any = Property(doc='Value of the metric')
generator: typing.Any = Property(doc='Generator used to create the metric')
[docs]
class PlottingMetric(Metric):
"""Metric which is to be visualised as plot, value should be a pyplot
figure"""
[docs]
class SingleTimeMetric(Metric):
"""Metric for a specific timestamp"""
timestamp: datetime.datetime = Property(
default=None, doc="Timestamp of the state. Default None.")
[docs]
class TimeRangeMetric(Metric):
""" Metric for a range of times (e.g. for example an entire run)"""
time_range: TimeRange = Property(
default=None,
doc="Time range over which metric assessment will be conducted over. Default is None")
[docs]
class TimeRangePlottingMetric(TimeRangeMetric, PlottingMetric):
"""Plotting metric covering a period of time"""
[docs]
class SingleTimePlottingMetric(SingleTimeMetric, PlottingMetric):
"""Plotting metric covering a specific timestamp"""