-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZenke_synapses.jl
38 lines (30 loc) · 949 Bytes
/
Zenke_synapses.jl
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
abstract type Synapse end
function get_name(ch::Synapse)
Base.typename(ch |> typeof).name |> Symbol
end
struct EmptyConnection <: Synapse end
mutable struct link{T<:AbstractFloat} <: Synapse
w::T
S::T
τ_synapse::T
θ::T
tunable::Bool
end
link(x; tunable::Bool=false) = link(x, 0., 12.5, 0.99, tunable)
syn_current(::link, sys::ODESystem) = sys.I_syn
function synapse(channel::link; name = name)
states = @variables S(t) I_syn(t) V_pre(t) V_post(t)
tunable = channel.tunable
if tunable
params = @parameters w [tunable = true, bounds = (0., Inf)]
elseif !tunable
params = @parameters w
end
eqs = [
D(I_syn) ~ -I_syn / channel.τ_synapse + w * S,
S ~ ϕ(V_pre - channel.θ)
]
current = [eqs[2]]
defaultmap = Dict(w => channel.w, I_syn => 0.)
return ODESystem(eqs, t, states, params; defaults = defaultmap, observed = current, name = name)
end