mdadash.backend.kernel.utils

Common utils for use in kernel core

Functions

alert(message)

Create an alert

pause_simulation([message])

Pause the simulation

Classes

EMATrend([short_window, long_window])

Exponential Moving Average (EMA) based Trend

class mdadash.backend.kernel.utils.EMATrend(short_window: int = 12, long_window: int = 26)[source]

Bases: object

Exponential Moving Average (EMA) based Trend

This utility class computes trend value based on short and long exponential moving averages based on the respective window sizes.

update(value: float) int[source]

Update current value and return trend

Parameters:

value (float) – The current value to update

Returns:

trend – Trend value as -1, 0 or 1

Return type:

int

mdadash.backend.kernel.utils.alert(message: str) None[source]

Create an alert

A timestamp based on the current timestep is automatically added.

Parameters:

message (str) – The string message used for the alert

mdadash.backend.kernel.utils.pause_simulation(message: str = 'Paused simulation') None[source]

Pause the simulation

Pause simulation and add an alert.

Parameters:

message (str) – The string message used for the alert