Esempio n. 1
0
    def test_lists(self):
        train_size = 100
        n = 10
        senders = list(np.random.randint(n, size=train_size * n))
        times = list(np.random.rand(train_size * n))
        sp = PopulationSpikes(n, senders, times)

        # try to retrieve spike trains
        for nIdx in range(n):
            train = sp[nIdx]
            assert train is not None

        # Try to run all the methods, None should raise an exception
        sp.avg_firing_rate(0, 1)
        sp.sliding_firing_rate(0, 1, 0.05, 0.1)
        sp.windowed((0, 1))
        sp.raster_data()
        sp.spike_train_difference(list(range(n)))
Esempio n. 2
0
 def test_empty(self):
     for N in range(0, 4):
         pop = PopulationSpikes(N, [], [])
         r, rt = pop.sliding_firing_rate(0, 1, .1, .2)
         assert np.all(r == 0)