-
Notifications
You must be signed in to change notification settings - Fork 7
/
kna.go
124 lines (99 loc) · 3 KB
/
kna.go
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// Copyright (c) 2019, The Emergent Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package chans
import "cogentcore.org/core/goal/gosl/slbool"
//gosl:start chans
// KNaParams implements sodium (Na) gated potassium (K) currents
// that drive adaptation (accommodation) in neural firing.
// As neurons spike, driving an influx of Na, this activates
// the K channels, which, like leak channels, pull the membrane
// potential back down toward rest (or even below).
type KNaParams struct {
// if On, use this component of K-Na adaptation
On slbool.Bool
// Rise rate of fast time-scale adaptation as function of Na concentration due to spiking -- directly multiplies -- 1/rise = tau for rise rate
Rise float32
// Maximum potential conductance of fast K channels -- divide nA biological value by 10 for the normalized units here
Max float32
// time constant in cycles for decay of adaptation, which should be milliseconds typically (tau is roughly how long it takes for value to change significantly -- 1.4x the half-life)
Tau float32
// 1/Tau rate constant
Dt float32 `display:"-"`
pad, pad1, pad2 int32
}
func (ka *KNaParams) Defaults() {
ka.On.SetBool(true)
ka.Rise = 0.01
ka.Max = 0.1
ka.Tau = 100
ka.Update()
}
func (ka *KNaParams) Update() {
ka.Dt = 1 / ka.Tau
}
func (ka *KNaParams) ShouldDisplay(field string) bool {
switch field {
case "On":
return true
default:
return ka.On.IsTrue()
}
}
// GcFromSpike updates the KNa conductance based on spike or not
func (ka *KNaParams) GcFromSpike(gKNa *float32, spike bool) {
if ka.On.IsTrue() {
if spike {
*gKNa += ka.Rise * (ka.Max - *gKNa)
} else {
*gKNa -= ka.Dt * *gKNa
}
} else {
*gKNa = 0
}
}
// KNaMedSlow describes sodium-gated potassium channel adaptation mechanism.
// Evidence supports 2 different time constants:
// Slick (medium) and Slack (slow)
type KNaMedSlow struct {
// if On, apply K-Na adaptation
On slbool.Bool
// engages an optional version of Slow that discretely turns on at start of new trial (NewState): nrn.GknaSlow += Slow.Max * nrn.SpkPrv -- achieves a strong form of adaptation
TrialSlow slbool.Bool
pad, pad1 int32
// medium time-scale adaptation
Med KNaParams `display:"inline"`
// slow time-scale adaptation
Slow KNaParams `display:"inline"`
}
func (ka *KNaMedSlow) Defaults() {
ka.Med.Defaults()
ka.Slow.Defaults()
ka.Med.Tau = 200
ka.Med.Rise = 0.02
ka.Med.Max = 0.2
ka.Slow.Tau = 1000
ka.Slow.Rise = 0.001
ka.Slow.Max = 0.2
ka.Update()
}
func (ka *KNaMedSlow) Update() {
ka.Med.Update()
ka.Slow.Update()
}
func (ka *KNaMedSlow) ShouldDisplay(field string) bool {
switch field {
case "On":
return true
default:
return ka.On.IsTrue()
}
}
// GcFromSpike updates med, slow time scales of KNa adaptation from spiking
func (ka *KNaMedSlow) GcFromSpike(gKNaM, gKNaS *float32, spike bool) {
ka.Med.GcFromSpike(gKNaM, spike)
if ka.TrialSlow.IsFalse() {
ka.Slow.GcFromSpike(gKNaS, spike)
}
}
//gosl:end chans