@@ -17,106 +17,92 @@ import (
17
17
"github.com/emer/axon/v2/chans"
18
18
)
19
19
20
- type GababPlot struct {
20
+ type GABABPlot struct {
21
21
// standard chans version of GABAB
22
- GABAstd chans.GABABParams
22
+ GABAB chans.GABABParams `display:"add-fields"`
23
23
24
- // multiplier on GABAb as function of voltage
25
- GABAbv float64 `default:"0.1"`
24
+ // multiplier on GABA-B as function of voltage
25
+ Vgain float64 `default:"0.1"`
26
26
27
- // offset of GABAb function
28
- GABAbo float64 `default:"10"`
27
+ // voltage offset for GABA-B exponential function
28
+ Voff float64 `default:"10"`
29
29
30
30
// GABAb reversal / driving potential
31
- GABAberev float64 `default:"-90"`
31
+ Erev float64 `default:"-90"`
32
32
33
33
// starting voltage
34
34
Vstart float64 `default:"-90"`
35
35
36
36
// ending voltage
37
- Vend float64 `default:"0 "`
37
+ Vend float64 `default:"10 "`
38
38
39
39
// voltage increment
40
40
Vstep float64 `default:"1"`
41
41
42
42
// max number of spikes
43
- Smax int `default:"15"`
44
-
45
- // rise time constant
46
- RiseTau float64
47
-
48
- // decay time constant -- must NOT be same as RiseTau
49
- DecayTau float64
50
-
51
- // initial value of GsX driving variable at point of synaptic input onset -- decays expoentially from this start
52
- GsXInit float64
53
-
54
- // time when peak conductance occurs, in TimeInc units
55
- MaxTime float64 `edit:"-"`
56
-
57
- // time constant factor used in integration: (Decay / Rise) ^ (Rise / (Decay - Rise))
58
- TauFact float64 `edit:"-"`
43
+ Smax int `default:"30"`
59
44
60
45
// total number of time steps to take
61
46
TimeSteps int
62
47
63
48
// time increment per step
64
49
TimeInc float64
65
50
51
+ // time in msec for inputs to remain on in TimeRun
52
+ TimeIn int
53
+
54
+ // frequency of spiking inputs at start of TimeRun
55
+ TimeHz float64
56
+
66
57
Dir * tensorfs.Node `display:"-"`
67
58
Tabs lab.Tabber `display:"-"`
68
59
}
69
60
70
61
// Config configures all the elements using the standard functions
71
- func (pl * GababPlot ) Config (parent * tensorfs.Node , tabs lab.Tabber ) {
62
+ func (pl * GABABPlot ) Config (parent * tensorfs.Node , tabs lab.Tabber ) {
72
63
pl .Dir = parent .Dir ("GabaB" )
73
64
pl .Tabs = tabs
74
65
75
- pl .GABAstd .Defaults ()
76
- pl .GABAstd .GiSpike = 1
77
- pl .GABAbv = 0.1
78
- pl .GABAbo = 10
79
- pl .GABAberev = - 90
66
+ pl .GABAB .Defaults ()
67
+ pl .GABAB .GiSpike = 1
68
+ pl .Vgain = 0.1
69
+ pl .Voff = 10
70
+ pl .Erev = - 90
80
71
pl .Vstart = - 90
81
- pl .Vend = 0
82
- pl .Vstep = .01
72
+ pl .Vend = 10
73
+ pl .Vstep = 1
83
74
pl .Smax = 30
84
- pl .RiseTau = 45
85
- pl .DecayTau = 50
86
- pl .GsXInit = 1
87
- pl .TimeSteps = 200
75
+ pl .TimeSteps = 500
88
76
pl .TimeInc = .001
77
+ pl .TimeIn = 100
78
+ pl .TimeHz = 50
89
79
pl .Update ()
90
80
}
91
81
92
82
// Update updates computed values
93
- func (pl * GababPlot ) Update () {
94
- pl .TauFact = math .Pow (pl .DecayTau / pl .RiseTau , pl .RiseTau / (pl .DecayTau - pl .RiseTau ))
95
- pl .MaxTime = ((pl .RiseTau * pl .DecayTau ) / (pl .DecayTau - pl .RiseTau )) * math .Log (pl .DecayTau / pl .RiseTau )
83
+ func (pl * GABABPlot ) Update () {
84
+ pl .GABAB .Update ()
96
85
}
97
86
98
87
// GVRun plots the conductance G (and other variables) as a function of V.
99
- func (pl * GababPlot ) GVRun () { //types:add
88
+ func (pl * GABABPlot ) GVRun () { //types:add
100
89
pl .Update ()
101
90
dir := pl .Dir .Dir ("G_V" )
102
91
103
92
nv := int ((pl .Vend - pl .Vstart ) / pl .Vstep )
104
- v := 0.0
105
- g := 0.0
106
93
for vi := range nv {
107
- v = pl .Vstart + float64 (vi )* pl .Vstep
108
- g = float64 (pl .GABAstd .Gbar ) * ( v - pl . GABAberev ) / (1 + math .Exp (pl .GABAbv * ((v - pl .GABAberev )+ pl .GABAbo )))
109
- gs := pl . GABAstd . Gbar * pl .GABAstd . GFromV ( chans . VFromBio ( float32 ( v )))
94
+ v : = pl .Vstart + float64 (vi )* pl .Vstep
95
+ g : = float64 (pl .GABAB .Gbar ) / (1 + math .Exp (pl .Vgain * ((v - pl .Erev )+ pl .Voff )))
96
+ i := ( v - pl .Erev ) * g
110
97
111
98
dir .Float64 ("V" , nv ).SetFloat1D (v , vi )
112
- dir .Float64 ("GgabaB " , nv ).SetFloat1D (g , vi )
113
- dir .Float64 ("GgabaBstd " , nv ).SetFloat1D (float64 ( gs ) , vi )
99
+ dir .Float64 ("Ggaba_b " , nv ).SetFloat1D (g , vi )
100
+ dir .Float64 ("Igaba_b " , nv ).SetFloat1D (i , vi )
114
101
}
115
- metadata .SetDoc (dir .Float64 ("GgabaBstd" ), "std is from code actually used in models" )
116
102
plot .SetFirstStyler (dir .Float64 ("V" ), func (s * plot.Style ) {
117
103
s .Role = plot .X
118
104
})
119
- ons := []string {"GgabaB " }
105
+ ons := []string {"Ggaba_b" , "Igaba_b " }
120
106
for _ , on := range ons {
121
107
plot .SetFirstStyler (dir .Float64 (on ), func (s * plot.Style ) {
122
108
s .On = true
@@ -128,24 +114,19 @@ func (pl *GababPlot) GVRun() { //types:add
128
114
}
129
115
}
130
116
131
- // GSRun plots conductance over spiking.
132
- func (pl * GababPlot ) GSRun () { //types:add
117
+ // GSRun plots conductance as function of spiking rate .
118
+ func (pl * GABABPlot ) GSRun () { //types:add
133
119
pl .Update ()
134
120
dir := pl .Dir .Dir ("G_Spike" )
135
121
136
122
nv := int (float64 (pl .Smax ) / pl .Vstep )
137
- s := 0.0
138
- g := 0.0
139
123
for si := range nv {
140
- s = float64 (si ) * pl .Vstep
141
- g = 1.0 / (1.0 + math .Exp (- (s - 7.1 )/ 1.4 ))
142
- gs := pl .GABAstd .GFromS (float32 (s ))
124
+ s := float64 (si ) * pl .Vstep
125
+ g := 1.0 / (1.0 + math .Exp (- (s - 7.1 )/ 1.4 ))
143
126
144
127
dir .Float64 ("S" , nv ).SetFloat1D (s , si )
145
128
dir .Float64 ("GgabaB_max" , nv ).SetFloat1D (g , si )
146
- dir .Float64 ("GgabaBstd_max" , nv ).SetFloat1D (float64 (gs ), si )
147
129
}
148
- metadata .SetDoc (dir .Float64 ("GgabaBstd_max" ), "std is from code actually used in models" )
149
130
plot .SetFirstStyler (dir .Float64 ("S" ), func (s * plot.Style ) {
150
131
s .Role = plot .X
151
132
})
@@ -162,37 +143,35 @@ func (pl *GababPlot) GSRun() { //types:add
162
143
}
163
144
164
145
// TimeRun runs the equations over time.
165
- func (pl * GababPlot ) TimeRun () { //types:add
146
+ func (pl * GABABPlot ) TimeRun () { //types:add
166
147
pl .Update ()
167
148
dir := pl .Dir .Dir ("G_Time" )
168
149
nv := pl .TimeSteps
169
150
170
151
time := 0.0
171
152
gs := 0.0
172
- x := pl .GsXInit
173
- gabaBx := float32 (pl .GsXInit )
174
- gabaB := float32 (0.0 )
175
- gi := 0.0 // just goes down
176
- for t := range nv {
153
+ x := 0.0
154
+ spikeInt := int (1000 / pl .TimeHz )
155
+ for ti := range nv {
156
+ sin := 0.0
157
+ if ti >= 10 && ti < (10 + pl .TimeIn ) && (ti - 10 )% spikeInt == 0 {
158
+ sin = 1
159
+ }
160
+
177
161
// record starting state first, then update
178
- dir .Float64 ("Time" , nv ).SetFloat1D (float64 (time ), t )
179
- dir .Float64 ("GabaB" , nv ).SetFloat1D (float64 (gs ), t )
180
- dir .Float64 ("GabaBX" , nv ).SetFloat1D (float64 (x ), t )
181
- dir .Float64 ("GabaBstd" , nv ).SetFloat1D (float64 (gabaB ), t )
182
- dir .Float64 ("GabaBXstd" , nv ).SetFloat1D (float64 (gabaBx ), t )
183
-
184
- gis := 1.0 / (1.0 + math .Exp (- (gi - 7.1 )/ 1.4 ))
185
- dGs := (pl .TauFact * x - gs ) / pl .RiseTau
186
- dXo := - x / pl .DecayTau
162
+ dir .Float64 ("Time" , nv ).SetFloat1D (time , ti )
163
+ dir .Float64 ("GabaB" , nv ).SetFloat1D (gs , ti )
164
+ dir .Float64 ("GabaBX" , nv ).SetFloat1D (x , ti )
165
+
166
+ gis := 1.0 / (1.0 + math .Exp (- (sin - 7.1 )/ 1.4 ))
167
+ dGs := (float64 (pl .GABAB .TauFact )* x - gs ) / float64 (pl .GABAB .RiseTau )
168
+ dXo := - x / float64 (pl .GABAB .DecayTau )
187
169
gs += dGs
188
170
x += gis + dXo
189
171
190
- var dG , dX float32
191
- pl .GABAstd .BiExp (gabaB , gabaBx , & dG , & dX )
192
- dir .Float64 ("dG" , nv ).SetFloat1D (float64 (dG ), t )
193
- dir .Float64 ("dX" , nv ).SetFloat1D (float64 (dX ), t )
194
-
195
- pl .GABAstd .GABAB (float32 (gi ), & gabaB , & gabaBx )
172
+ dir .Float64 ("dG" , nv ).SetFloat1D (dGs , ti )
173
+ dir .Float64 ("dX" , nv ).SetFloat1D (dXo , ti )
174
+ dir .Float64 ("Xmax" , nv ).SetFloat1D (gis , ti )
196
175
197
176
time += pl .TimeInc
198
177
}
@@ -213,7 +192,7 @@ func (pl *GababPlot) TimeRun() { //types:add
213
192
}
214
193
}
215
194
216
- func (pl * GababPlot ) MakeToolbar (p * tree.Plan ) {
195
+ func (pl * GABABPlot ) MakeToolbar (p * tree.Plan ) {
217
196
tree .Add (p , func (w * core.FuncButton ) {
218
197
w .SetFunc (pl .GVRun ).SetIcon (icons .PlayArrow )
219
198
})
0 commit comments