def bandpower(ps, mode="time"):
    """
    estimate bandpower, see https://de.mathworks.com/help/signal/ref/bandpower.html
    """
    if mode == "time":
        x = ps
        l2norm = np.linalg.norm(x) ** 2.0 / len(x)
        return l2norm
    elif mode == "psd":
        return sum(ps)
estimate bandpower, see https://de.mathworks.com/help/signal/ref/bandpower.html
evaluation/features/signal_to_noise_ratio.py