예제 #1
0
def test_functions():
    rec, sort = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0)

    firing_rates = compute_firing_rates(sort, seed=0)[0]
    num_spikes = compute_num_spikes(sort, seed=0)[0]
    isi = compute_isi_violations(sort, seed=0)[0]
    presence = compute_presence_ratios(sort, seed=0)[0]
    amp_cutoff = compute_amplitude_cutoffs(sort, rec, seed=0)[0]
    max_drift, cum_drift = compute_drift_metrics(sort, rec, seed=0, memmap=False)[0]
    silh = compute_silhouette_scores(sort, rec, seed=0)[0]
    iso = compute_isolation_distances(sort, rec, seed=0)[0]
    l_ratio = compute_l_ratios(sort, rec, seed=0)[0]
    dprime = compute_d_primes(sort, rec, seed=0)[0]
    nn_hit, nn_miss = compute_nn_metrics(sort, rec, seed=0)[0]
    snr = compute_snrs(sort, rec, seed=0)[0]
    metrics = compute_metrics(sort, rec, return_dict=True, seed=0)

    assert np.allclose(metrics['firing_rate'][0], firing_rates)
    assert np.allclose(metrics['num_spikes'][0], num_spikes)
    assert np.allclose(metrics['isi_viol'][0], isi)
    assert np.allclose(metrics['amplitude_cutoff'][0], amp_cutoff)
    assert np.allclose(metrics['presence_ratio'][0], presence)
    assert np.allclose(metrics['silhouette_score'][0], silh)
    assert np.allclose(metrics['isolation_distance'][0], iso)
    assert np.allclose(metrics['l_ratio'][0], l_ratio)
    assert np.allclose(metrics['d_prime'][0], dprime)
    assert np.allclose(metrics['snr'][0], snr)
    assert np.allclose(metrics['max_drift'][0], max_drift)
    assert np.allclose(metrics['cumulative_drift'][0], cum_drift)
    assert np.allclose(metrics['nn_hit_rate'][0], nn_hit)
    assert np.allclose(metrics['nn_miss_rate'][0], nn_miss)
예제 #2
0
def test_thresh_num_spikes():
    rec, sort = se.example_datasets.toy_example(duration=10,
                                                num_channels=4,
                                                seed=0)
    s_threshold = 25

    sort_ns = threshold_num_spikes(sort, s_threshold, 'less')
    new_ns = compute_num_spikes(sort_ns, rec.get_sampling_frequency())

    assert np.all(new_ns >= s_threshold)
예제 #3
0
def test_thresh_num_spikes():
    rec, sort = se.example_datasets.toy_example(dump_folder='test', dumpable=True, duration=10, num_channels=4, K=10,
                                                seed=0)
    s_threshold = 25

    sort_ns = threshold_num_spikes(sort, s_threshold, 'less')
    new_ns = compute_num_spikes(sort_ns, sort.get_sampling_frequency())

    assert np.all(new_ns >= s_threshold)
    check_dumping(sort_ns)
    shutil.rmtree('test')
예제 #4
0
def test_functions():
    rec, sort = se.example_datasets.toy_example(duration=10, num_channels=4)

    firing_rates = compute_firing_rates(sort)
    num_spikes = compute_num_spikes(sort)
    isi = compute_isi_violations(sort)
    presence = compute_presence_ratios(sort)

    amp_cutoff = compute_amplitude_cutoffs(sort, rec)

    max_drift, cum_drift = compute_drift_metrics(sort, rec)
    silh = compute_silhouette_scores(sort, rec)
    iso = compute_isolation_distances(sort, rec)
    l_ratio = compute_l_ratios(sort, rec)
    dprime = compute_d_primes(sort, rec)
    nn_hit, nn_miss = compute_nn_metrics(sort, rec)

    snr = compute_snrs(sort, rec)