Dataset should be of dimensions (trace, rep, samples)

def dataset_spike_counts(dset, threshold, fs):
    """Dataset should be of dimensions (trace, rep, samples)"""
    if len(dset.shape) == 3:
        results = np.zeros(dset.shape[0])
        for itrace in range(dset.shape[0]):
            results[itrace] = count_spikes(dset[itrace], threshold, fs)
        return results
    elif len(dset.shape == 2):
        return count_spikes(dset, threshold, fs)
    else:
        raise Exception("Improper data dimensions")