-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.py
43 lines (29 loc) · 998 Bytes
/
scratch.py
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 5 20:54:35 2016
@author: boldingd
"""
import SnnBase
import Stdp
pulsar = SnnBase.Pulsar(30.0, 3.0) # 15 mag, 3Hz
rando = SnnBase.NaiveRandomSpiker(15, 2.0) # 50 mag, 1Hz avg
n1 = SnnBase.SpikingNeuron(60.0, 50.0, 0.0, 2.0) # thresh / mag / eql / tau
cr = SnnBase.Counter("n1 counter")
n1.add_spike_listener(cr)
syn_pulsar_n1 = Stdp.StdpSynapse(0.001, 1.0, 0.4, 1.6) # delay / efficiency / min / max
pulsar.add_synapse(syn_pulsar_n1)
syn_pulsar_n1.add_target(n1)
n1.add_spike_listener(syn_pulsar_n1)
sr = SnnBase.Sampler(syn_pulsar_n1, frequency = 40.0, name = "syn")
syn_rando_n1 = SnnBase.Synapse(0.001, 1.0) # delay / efficiency
rando.add_synapse(syn_rando_n1)
syn_rando_n1.add_target(n1)
entities = [ pulsar, rando, n1, cr, syn_pulsar_n1, syn_rando_n1, sr ]
print("running")
try:
SnnBase.run_simulation(20.0, 1.0 / 2000.0, entities)
except Exception as e:
print("Blammo:\n\t" + str(e))
cr.report()
sr.report()
print("done")