-
Notifications
You must be signed in to change notification settings - Fork 9
/
parameters_reconstruct_all.py
78 lines (62 loc) · 1.76 KB
/
parameters_reconstruct_all.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/python
#-----------------------------------------------------------------------------
# File Name : funcs.py
# Purpose:
#
# Author: Emre Neftci
#
# Creation Date : 24-04-2013
# Last Modified : Sat 30 Nov 2013 04:07:35 PM PST
#
# Copyright : (c)
# Licence : GPLv2
#-----------------------------------------------------------------------------
import numpy as np
import brian_no_units
from brian.globalprefs import *
set_global_preferences(useweave=True)
from brian import *
n_classes = 10
N_v = N_inputs =784
N_c = N_class = 40
N_h = N_hidden =500
n_c_unit = N_c/n_classes
t_sim = 1.0 #seconds
dcmt =5000 #duty cyle in multiples of t_ref
#----------------------------------------- Neuron parameters
t_ref = 0.004 # second
bias_input_rate = 1000. #Hz
beta = 2.04371561e+09
gamma = np.exp(9.08343441e+00)
tau_noise = .001
tau_rec = t_ref
theta = .1 # volt
cm = 1e-12 #farad
beta_fi = 1./cm/theta
sigma = 1.e-9 #amp
cal_i_lk = 0.0e-10
g_leak = 1e-9
dt = 0.00005
n_samples = t_sim/(dcmt*t_ref)+1
wnsigma = 4.24e-11
t_burn_percent = 10.
tau_learn = 0.01
deltaT = ((0.49-t_burn_percent/100)*dcmt*t_ref)
eta = 0e-3
epsilon = eta/beta*t_ref**2*(dcmt*t_ref)/deltaT
epsilon_bias = eta/beta*t_ref*(1./bias_input_rate)*(dcmt*t_ref)/deltaT
deltaA = eta/beta/tau_learn*(dcmt*t_ref)/deltaT*t_ref**2
deltaAbias = eta/beta/tau_learn*(dcmt*t_ref)/deltaT*t_ref*(1./bias_input_rate)
i_inj = (- np.log(float(gamma))
- np.log(float(t_ref))
)/beta #amp
def exp_prob_beta_gamma(dt, beta, g_leak, gamma, t_ref):
def func(V):
return np.random.rand( len(V) ) < (1-np.exp(-np.exp(V*beta*g_leak+np.log(gamma))*float(dt)))
return func
sigm = lambda x: 1./(1+exp(-x))
#helper parameters
Bu = 10.0
wb = 10.5
N_helper=100
defaultclock.dt= dt