| |
- builtins.object
-
- vcorelib.math.analysis.average.MovingAverage
- vcorelib.math.analysis.buffer.FloatBuffer
-
- vcorelib.math.analysis.average.MovingSum
- vcorelib.math.analysis.rate.RateTracker
- vcorelib.math.analysis.rate.limiter.RateLimiter
- vcorelib.math.analysis.weighted.WeightedAverage
- vcorelib.math.time.Timer
- builtins.tuple(builtins.object)
-
- vcorelib.math.unit.UnitSystem
class FloatBuffer(builtins.object) |
|
FloatBuffer(depth: int = 10, initial: float = 0.0) -> None
A class implementing a simple circular buffer for floats. |
|
Methods defined here:
- __call__(self, value: float) -> float
- Insert an element into the buffer and return the oldest value (that
gets overwritten).
- __init__(self, depth: int = 10, initial: float = 0.0) -> None
- Initialize this instance.
- reset(self, initial: float = 0.0) -> None
- Reset the buffer.
- resize(self, depth: int, initial: float = 0.0) -> None
- Set a new depth for this buffer average and reset the values.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class MovingAverage(builtins.object) |
|
MovingAverage(depth: int = 10, initial: float = 0.0) -> None
A class for managing a moving average of floats. |
|
Methods defined here:
- __call__(self, value: float) -> float
- Add a new value to the dataset and get the average.
- __init__(self, depth: int = 10, initial: float = 0.0) -> None
- Initialize this moving average.
- reset(self, initial: float = 0.0) -> None
- Reset the average value.
- resize(self, depth: int, initial: float = 0.0) -> None
- Set a new depth for this moving average and reset the value.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class RateLimiter(builtins.object) |
|
RateLimiter(period_ns: int, **kwargs) -> None
A class for limiting the rate of runtime work. |
|
Methods defined here:
- __call__(self, time_ns: int = None, task: Callable[[], NoneType] = None) -> bool
- Query the limiter to determine if the current time would allow a
governed task to run.
- __init__(self, period_ns: int, **kwargs) -> None
- Initialize this rate-limiter.
Readonly properties defined here:
- rate_hz
- Get the underlying rate that this limiter is governing. This is useful
to determine if the rate limitation is or isn't impacting the rate of
some task.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class RateTracker(builtins.object) |
|
RateTracker(**kwargs) -> None
A class for managing rate information for some data channel. |
|
Methods defined here:
- __call__(self, time_ns: int = None, value: float = 1.0) -> float
- Submit new data to the rate tracker. If this function is called with
default arguments, the returned value will reflect the rate that this
method is being called in hertz.
- __init__(self, **kwargs) -> None
- Initialize this rate tracker.
- measure(self, value: float = 1.0, timer: vcorelib.math.time.Timer = <vcorelib.math.time.Timer object at 0x7f7f560cd850>) -> Iterator[NoneType]
- Track the time that the caller's context takes.
- poll(self, time_ns: int = None) -> float
- Siphon accumulated time and update rate tracking.
- reset(self) -> None
- Reset this rate tracker.
- with_dt(self, delta_s: float, value: float = 1.0) -> None
- Update this rate by directly providing the delta-time value.
Readonly properties defined here:
- value
- An accessor for the underlying value.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class Timer(builtins.object) |
|
Timer() -> None
A class for measuring and logging how long events take. |
|
Methods defined here:
- __init__(self) -> None
- Initialize this timer.
- log(self, log: Union[logging.Logger, logging.LoggerAdapter[Any]], message: str, *args, level: int = 20, reminder: bool = False, **kwargs) -> Iterator[NoneType]
- Log how long the caller's context took to execute.
- measure_ns(self) -> Iterator[int]
- Compute the time that the caller's context takes, provides an integer
token that can be used to query for the result afterwards.
- result(self, token: int) -> int
- Get the timer result.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
|
class UnitSystem(builtins.tuple) |
|
UnitSystem(prefixes: Sequence[str], divisor: int)
A pairing of prefixes defining a unit, and the amount that indicates the
multiplicative step-size between them. |
|
- Method resolution order:
- UnitSystem
- builtins.tuple
- builtins.object
Methods defined here:
- __getnewargs__(self)
- Return self as a plain tuple. Used by copy and pickle.
- __repr__(self)
- Return a nicely formatted representation string
- _asdict(self)
- Return a new dict which maps field names to their values.
- _replace(self, /, **kwds)
- Return a new UnitSystem object replacing specified fields with new values
Class methods defined here:
- _make(iterable) from builtins.type
- Make a new UnitSystem object from a sequence or iterable
Static methods defined here:
- __new__(_cls, prefixes: Sequence[str], divisor: int)
- Create new instance of UnitSystem(prefixes, divisor)
Data descriptors defined here:
- prefixes
- Alias for field number 0
- divisor
- Alias for field number 1
Data and other attributes defined here:
- __annotations__ = {'divisor': <class 'int'>, 'prefixes': typing.Sequence[str]}
- __match_args__ = ('prefixes', 'divisor')
- __orig_bases__ = (<function NamedTuple>,)
- _field_defaults = {}
- _fields = ('prefixes', 'divisor')
Methods inherited from builtins.tuple:
- __add__(self, value, /)
- Return self+value.
- __contains__(self, key, /)
- Return bool(key in self).
- __eq__(self, value, /)
- Return self==value.
- __ge__(self, value, /)
- Return self>=value.
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __getitem__(self, key, /)
- Return self[key].
- __gt__(self, value, /)
- Return self>value.
- __hash__(self, /)
- Return hash(self).
- __iter__(self, /)
- Implement iter(self).
- __le__(self, value, /)
- Return self<=value.
- __len__(self, /)
- Return len(self).
- __lt__(self, value, /)
- Return self<value.
- __mul__(self, value, /)
- Return self*value.
- __ne__(self, value, /)
- Return self!=value.
- __rmul__(self, value, /)
- Return value*self.
- count(self, value, /)
- Return number of occurrences of value.
- index(self, value, start=0, stop=9223372036854775807, /)
- Return first index of value.
Raises ValueError if the value is not present.
Class methods inherited from builtins.tuple:
- __class_getitem__(...) from builtins.type
- See PEP 585
|
class WeightedAverage(builtins.object) |
|
WeightedAverage(depth: int = 10) -> None
A class implementing a weighted average. |
|
Methods defined here:
- __call__(self, value: float, weight: float = 1.0) -> None
- Update tracking, doesn't compute weighted average.
- __init__(self, depth: int = 10) -> None
- Initialize this weighted average.
- average(self) -> float
- Compute the overall weighted average.
- reset(self) -> None
- Reset the average.
Readonly properties defined here:
- depth
- This average's depth.
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
| |