Exemple #1
0
def test_merge_spike_trains():
    # first load the data
    spike_trains = spk.load_spike_trains_from_txt(TEST_DATA, edges=(0, 4000))

    merged_spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])
    # test if result is sorted
    assert ((merged_spikes.spikes == np.sort(merged_spikes.spikes)).all())
    # check merging
    check_merged_spikes(merged_spikes.spikes,
                        [spike_trains[0].spikes, spike_trains[1].spikes])

    merged_spikes = spk.merge_spike_trains(spike_trains)
    # test if result is sorted
    assert ((merged_spikes.spikes == np.sort(merged_spikes.spikes)).all())
    # check merging
    check_merged_spikes(merged_spikes.spikes,
                        [st.spikes for st in spike_trains])
Exemple #2
0
def test_merge_empty_spike_trains():
    # first load the data
    spike_trains = spk.load_spike_trains_from_txt(TEST_DATA, edges=(0, 4000))
    # take two non-empty trains, and one empty one
    empty = spk.SpikeTrain([],[spike_trains[0].t_start,spike_trains[0].t_end])
    merged_spikes = spk.merge_spike_trains([spike_trains[0], empty, spike_trains[1]])
    # test if result is sorted
    assert((merged_spikes.spikes == np.sort(merged_spikes.spikes)).all())
def test_merge_spike_trains():
    # first load the data
    spike_trains = spk.load_spike_trains_from_txt("test/PySpike_testdata.txt",
                                                  edges=(0, 4000))

    merged_spikes = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])
    # test if result is sorted
    assert((merged_spikes.spikes == np.sort(merged_spikes.spikes)).all())
    # check merging
    check_merged_spikes(merged_spikes.spikes, [spike_trains[0].spikes,
                                               spike_trains[1].spikes])

    merged_spikes = spk.merge_spike_trains(spike_trains)
    # test if result is sorted
    assert((merged_spikes.spikes == np.sort(merged_spikes.spikes)).all())
    # check merging
    check_merged_spikes(merged_spikes.spikes,
                        [st.spikes for st in spike_trains])
Exemple #4
0
""" merge.py

Simple example showing the merging of two spike trains.

Copyright 2014, Mario Mulansky <*****@*****.**>

Distributed under the BSD License
"""

from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

import pyspike as spk

# first load the data, ending time = 4000
spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000)

merged_spike_train = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])

print(merged_spike_train.spikes)

plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o')
plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x')
plt.plot(merged_spike_train.spikes,
         2*np.ones_like(merged_spike_train), 'o')

plt.show()
Exemple #5
0
""" merge.py

Simple example showing the merging of two spike trains.

Copyright 2014, Mario Mulansky <*****@*****.**>

Distributed under the BSD License
"""

from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

import pyspike as spk

# first load the data, ending time = 4000
spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000)

merged_spike_train = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])

print(merged_spike_train.spikes)

plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o')
plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x')
plt.plot(merged_spike_train.spikes,
         2*np.ones_like(merged_spike_train), 'o')

plt.show()