Skip to content

Commit

Permalink
Merge branch 'Adam_ketamine' of https://github.com/Neuroblox/Neuroblo…
Browse files Browse the repository at this point in the history
…x.jl into Adam_ketamine
  • Loading branch information
anandpathak31 committed Jul 19, 2024
2 parents 721cd16 + cb06d4c commit ca1199f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 37 deletions.
6 changes: 3 additions & 3 deletions src/blox/discrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ struct TAN <: AbstractDiscrete
@variables t
sts = @variables R(t)=κ
ps = @parameters κ=κ jcn=0.0 [input=true]
eqs = [
R ~ min(κ, κ/*jcn + sqrt(eps())))
eqs = Equation[
# R ~ min(κ, κ/(λ*jcn + sqrt(eps())))
]
sys = ODESystem(eqs, t, sts, ps; name)

Expand Down Expand Up @@ -98,4 +98,4 @@ end
function get_modulator_state(s::SNc)
sys = get_namespaced_sys(s)
return sys.R_
end
end
111 changes: 77 additions & 34 deletions src/blox/neuron_models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ struct HHNeuronInhib_MSN_Adam_Blox <: AbstractInhNeuronBlox
T = T
end

@brownian χ

αₙ(v) = 0.032*(v+52)/(1-exp(-(v+52)/5))
βₙ(v) = 0.5*exp(-(v+57)/40)
αₘ(v) = 0.32*(v+54)/(1-exp(-(v+54)/4))
Expand All @@ -237,17 +235,25 @@ struct HHNeuronInhib_MSN_Adam_Blox <: AbstractInhNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)-G_M*mM*(V-E_K)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)-G_M*mM*(V-E_K)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in),
D(n)~(αₙ(V)*(1-n)-βₙ(V)*n),
D(m)~(αₘ(V)*(1-m)-βₘ(V)*m),
D(h)~(αₕ(V)*(1-h)-βₕ(V)*h),
D(mM)~(αₘₘ(V)*(1-mM)-βₘₘ(V)*mM),
D(G)~(-1/τ)*G + G_asymp(V,a,b)*(1-G)

]
noise_eqs = [
σ/Cₘ
0
0
0
0
0
]

sys = System(
eqs, t, sts, ps;
sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)

Expand Down Expand Up @@ -312,8 +318,6 @@ struct HHNeuronInhib_FSI_Adam_Blox <: AbstractInhNeuronBlox
b = b
T = T
end

@brownian χ

n_inf(v) = 1/(1+exp(-(v+12.4)/6.8))
τₙ(v) = (0.087+11.4/(1+exp((v+14.6)/8.6)))*(0.087+11.4/(1+exp(-(v-1.3)/18.7)))
Expand All @@ -327,7 +331,7 @@ struct HHNeuronInhib_FSI_Adam_Blox <: AbstractInhNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m_inf(V)^3*h*(V-E_Na)-G_K*n^2*(V-E_K)-G_L*(V-E_L)-G_D*mD^3*hD*(V-E_K)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_gap+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m_inf(V)^3*h*(V-E_Na)-G_K*n^2*(V-E_K)-G_L*(V-E_L)-G_D*mD^3*hD*(V-E_K)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_gap+I_asc+I_in),
D(n)~(n_inf(V)-n)/τₙ(V),
D(h)~(h_inf(V)-h)/τₕ(V),
D(mD)~(mD_inf(V)-mD)/τₘD(V),
Expand All @@ -336,9 +340,18 @@ struct HHNeuronInhib_FSI_Adam_Blox <: AbstractInhNeuronBlox
D(Gₛ)~(-1/τₛ)*Gₛ + G_asymp(V,a,b)*(1-Gₛ)

]
noise_eqs = [
σ/Cₘ
0
0
0
0
0
0
]

sys = System(
eqs, t, sts, ps;
sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)

Expand Down Expand Up @@ -395,8 +408,6 @@ struct HHNeuronExci_STN_Adam_Blox <: AbstractExciNeuronBlox
b = b
end

@brownian χ

αₙ(v) = 0.032*(v+52)/(1-exp(-(v+52)/5))
βₙ(v) = 0.5*exp(-(v+57)/40)
αₘ(v) = 0.32*(v+54)/(1-exp(-(v+54)/4))
Expand All @@ -407,16 +418,25 @@ struct HHNeuronExci_STN_Adam_Blox <: AbstractExciNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in),
D(n)~(αₙ(V)*(1-n)-βₙ(V)*n),
D(m)~(αₘ(V)*(1-m)-βₘ(V)*m),
D(h)~(αₕ(V)*(1-h)-βₕ(V)*h),
D(G)~(-1/τ)*G + G_asymp(V,a,b)*(1-G)

]

noise_eqs = [
σ/Cₘ
0
0
0
0
0
0
]

sys = System(
eqs, t, sts, ps;
sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)

Expand Down Expand Up @@ -476,8 +496,6 @@ struct HHNeuronInhib_GPe_Adam_Blox <: AbstractInhNeuronBlox
T = T
end

@brownian χ

αₙ(v) = 0.032*(v+52)/(1-exp(-(v+52)/5))
βₙ(v) = 0.5*exp(-(v+57)/40)
αₘ(v) = 0.32*(v+54)/(1-exp(-(v+54)/4))
Expand All @@ -489,15 +507,25 @@ struct HHNeuronInhib_GPe_Adam_Blox <: AbstractInhNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in),
D(n)~(αₙ(V)*(1-n)-βₙ(V)*n),
D(m)~(αₘ(V)*(1-m)-βₘ(V)*m),
D(h)~(αₕ(V)*(1-h)-βₕ(V)*h),
D(G)~(-1/τ)*G + G_asymp(V,a,b)*(1-G)
]
noise_eqs = [
σ/Cₘ
0
0
0
0
0
0
]

sys = System(
eqs, t, sts, ps;

sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)

Expand Down Expand Up @@ -561,8 +589,6 @@ mutable struct HHNeuronExci_pyr_Adam_Blox <: AbstractExciNeuronBlox
a = a
b = b
end

@brownian χ

αₙ(v) = 0.032*(v+52)/(1-exp(-(v+52)/5))
βₙ(v) = 0.5*exp(-(v+57)/40)
Expand All @@ -574,17 +600,26 @@ mutable struct HHNeuronExci_pyr_Adam_Blox <: AbstractExciNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in),
D(n)~(αₙ(V)*(1-n)-βₙ(V)*n),
D(m)~(αₘ(V)*(1-m)-βₘ(V)*m),
D(h)~(αₕ(V)*(1-h)-βₕ(V)*h),
D(G)~(-1/τ)*G + G_asymp(V,a,b)*(1-G),
D(Glu)~(-1/τ_glu)*Glu + G_asymp(V-20,2.35,0.01) #this approximates the glutamate dynamics in the model where every spike instantaneously raises glutamate to 1mM

]

sys = System(
eqs, t, sts, ps;
noise_eqs = [
σ/Cₘ
0
0
0
0
0
0
]

sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)
nmda_rec = map(Base.OneTo(N_nmda)) do i
Expand Down Expand Up @@ -654,8 +689,6 @@ mutable struct HHNeuronInh_inter_Adam_Blox <: AbstractInhNeuronBlox
a = a
b = b
end

@brownian χ

αₙ(v) = 0.032*(v+52)/(1-exp(-(v+52)/5))
βₙ(v) = 0.5*exp(-(v+57)/40)
Expand All @@ -667,16 +700,26 @@ mutable struct HHNeuronInh_inter_Adam_Blox <: AbstractInhNeuronBlox
G_asymp(v,a,b) = a*(1+tanh(v/b))

eqs = [
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in+σ*χ),
D(V)~(1/Cₘ)*(-G_Na*m^3*h*(V-E_Na)-G_K*n^4*(V-E_K)-G_L*(V-E_L)+I_bg*(sin(t*freq*2*pi/1000)+1)+I_syn+I_asc+I_in),
D(n)~(αₙ(V)*(1-n)-βₙ(V)*n),
D(m)~(αₘ(V)*(1-m)-βₘ(V)*m),
D(h)~(αₕ(V)*(1-h)-βₕ(V)*h),
D(G)~(-1/τ)*G + G_asymp(V,a,b)*(1-G)

]

sys = System(
eqs, t, sts, ps;

noise_eqs = [
σ/Cₘ
0
0
0
0
0
0
]

sys = SDESystem(
eqs, noise_eqs, t, sts, ps;
name = Symbol(name)
)

Expand Down Expand Up @@ -902,4 +945,4 @@ struct IzhikevichNeuron <: AbstractNeuronBlox
sys = ODESystem(eqs, t, sts, p, continuous_events=[ev]; name=name)
new(p, sts[2], sts[5], sts[1], sys, namespace)
end
end
end

0 comments on commit ca1199f

Please sign in to comment.