def snr_clust(spike_waves, noise_waves):
    """Calculate signal-to-noise ratio.
    
    Comparing average P2P amplitude of spike cluster to noise cluster
    (randomly selected signal segments)
    
    Parameters
    ----------
    spike_waves : dict
    noise_waves : dict
    
    Returns
    -------
    snr : float
        signal-to-noise ratio
    """

    def _calc_p2p(data):
        p2p = data.max(0)-data.min(0)
        return p2p.mean()

    sp_data = spike_waves['data']
    avg_p2p_spk = _calc_p2p(sp_data)

    noise_data = noise_waves['data']
    avg_p2p_ns = _calc_p2p(noise_data)

    snr = avg_p2p_spk/avg_p2p_ns

    return snr