def clarity(time, signal, fs, bands=None):
    band_type = _check_band_type(bands)

    if band_type is 'octave':
        low = octave_low(bands[0], bands[-1])
        high = octave_high(bands[0], bands[-1])
    elif band_type is 'third':
        low = third_low(bands[0], bands[-1])
        high = third_high(bands[0], bands[-1])

    c = np.zeros(bands.size)
    for band in range(bands.size):
        filtered_signal = bandpass(signal, low[band],high[band],
                                                 fs, order=8)
        h2 = filtered_signal**2.0
        t = int((time/1000.0)*fs + 1)
        c[band] = 10.0*np.log10((np.sum(h2[:t])/np.sum(h2[t:])))
    return c
Clarity :math:`C_i` determined from an impulse response.
dataset/ETHPy150Open python-acoustics/python-acoustics/acoustics/room.py/clarity