-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneural_encoding.py
54 lines (37 loc) · 1.3 KB
/
neural_encoding.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
44
45
46
47
48
49
50
51
52
53
54
from pymonntorch import *
import torch
import random
import math
import numpy as np
import matplotlib.pyplot as plt
from Helper import plot as plotter
net = Network(behavior={1 : TimeResolution(dt = 1)})
inputLayer = NeuronGroup(net = net, size = 256, behavior={
2 : TTFS_Encoding(input = ImagePipeline("data/bridge.tif", shape = (8, 8)), T = 40),
# 3 : CurrentBehavior(mode = "random", pw = 3),
# 7 : Trace(),
10 : EventRecorder(['spike'])
})
net.initialize()
net.simulate_iterations(100)
plotter.plot_spike_raster(ng)
net = Network(behavior={1 : TimeResolution(dt = 1)})
inputLayer = NeuronGroup(net = net, size = 256, behavior={
2 : NumericalValueEncoding(input = 156.71, T = 60, sigma = 50),
# 3 : CurrentBehavior(mode = "random", pw = 3),
# 7 : Trace(),
10 : EventRecorder(['spike'])
})
net.initialize()
net.simulate_iterations(100)
plotter.plot_spike_raster(ng)
net = Network(behavior={1 : TimeResolution(dt = 1)})
inputLayer = NeuronGroup(net = net, size = 100, behavior={
2 : PoissionGenerator(T = 40, lamda = 20),
# 3 : CurrentBehavior(mode = "random", pw = 3),
# 7 : Trace(),
10 : EventRecorder(['spike'])
})
net.initialize()
net.simulate_iterations(100)
plotter.plot_spike_raster(ng)