Skip to content

Window Function Handler

Interface for custom window functions for PM threshold processing. Window function is a function accepting a Window - the list of measures, and returning float value.

def window_handler(window):
    Implements custom window function

    :param window: List of (*timestamp*, *value*), where
        *timestamp* - Unix timestamp of measure
        *value* - Value of measure
    :returns: float value



Returns last measured value

def last(window):
    return window[-1][1]


Difference between last and first value

def finite_difference(window):
    return window[-1][1] - window[0][1]

More Examples

Refer to core/ file for more examples