Toggle counter for gas boilers

    Counts the number of times the gas consumption increases with more than 3kW

    Parameters
    ----------
    ts: Pandas Series
        Gas consumption in minute resolution

    Returns
    -------
    int

def count_peaks(ts):
    """
    Toggle counter for gas boilers

    Counts the number of times the gas consumption increases with more than 3kW

    Parameters
    ----------
    ts: Pandas Series
        Gas consumption in minute resolution

    Returns
    -------
    int
    """

    on_toggles = ts.diff() > 3000
    shifted = np.logical_not(on_toggles.shift(1))
    result = on_toggles & shifted
    count = result.sum()
    return count