File: input.py

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (26 lines) | stat: -rw-r--r-- 640 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""
Tests of input features
"""

from brian2 import *
from brian2.tests.features import FeatureTest, InaccuracyError


class SpikeGeneratorGroupTest(FeatureTest):
    category = "Input"
    name = "SpikeGeneratorGroup"
    tags = ["SpikeMonitor", "run", "SpikeGeneratorGroup"]

    def run(self):
        N = 10
        numspikes = 1000
        i = arange(numspikes) % N
        t = linspace(0, 1, numspikes) * (100 * ms)
        G = SpikeGeneratorGroup(N, i, t)
        self.M = M = SpikeMonitor(G)
        run(100 * ms)

    def results(self):
        return {"i": self.M.i[:], "t": self.M.t[:]}

    compare = FeatureTest.compare_arrays