Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adams model on ketamine #358

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions examples/Adam_NMDA_MWE.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Neuroblox
using DifferentialEquations
using Graphs
using MetaGraphs
using Plots

@named n1=HHNeuronExci_pyr_Adam_Blox(σ=0,I_bg=-1.25;N_nmda=1,namespace=:g)
@named n2=HHNeuronExci_pyr_Adam_Blox(σ=3;N_nmda=1,namespace=:g)
#this parameter set reproduces figure 3C DO NOT CHANGE
@named n3=HHNeuronInh_inter_Adam_Blox(σ=1,I_bg=-1.8;N_nmda=1,k_unblock=5.4,namespace=:g)

@named glu1= Glutamate_puff()
@named glu2= Steady_Glutamate()

assembly = [n1,n2]
#assembly = [glu1,n1]
g = MetaDiGraph()
add_blox!.(Ref(g), assembly)
add_edge!(g,1,2,Dict(:weight=>0,:nmda=>true,:nmda_weight=>2))

@named neuron_net = system_from_graph(g)
sys = structural_simplify(neuron_net)
prob = SDEProblem(sys, [], (0.0, 2000), [])
sol = solve(prob, ImplicitEM(),saveat = 0.01)
ss=convert(Array,sol)
st=unknowns(sys)
vlist=Int64[]
for ii = 1:length(st)
if contains(string(st[ii]), "V(t)")
push!(vlist,ii)
end
end
V = ss[vlist,:]

VV=zeros(length(vlist),length(sol.t))
for ii = 1:length(vlist)
VV[ii,:] .= V[ii,:] .+ 200*(ii-1)

end
plot(sol.t,VV[:,:]',color= "blue",label=false)
54 changes: 54 additions & 0 deletions examples/Adam_NMDA_full_working_example.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Neuroblox
using DifferentialEquations
using Graphs
using MetaGraphs
using Plots

#Number of neurons in each block
N_pyr=30
N_in_phasic=20
N_in_tonic=10

#number of connections between each block pair
prj_pyr_phasic = 10
prj_phasic_pyr = 10
prj_tonic_pyr = 5
prj_tonic_phasic = 5

@named cb_pyr = Cortical_Pyramidal_Assembly_Adam(N_exci=N_pyr,namespace=:g)
@named cb_in_phasic = Cortical_Interneuron_Assembly_Phasic_Adam(namespace=:g,N_inhib=N_in_phasic)
@named cb_in_tonic = Cortical_Interneuron_Assembly_Tonic_Adam(namespace=:g,N_inhib=N_in_tonic)
@named glu= Steady_Glutamate()
assembly = [cb_pyr,cb_in_phasic,cb_in_tonic,glu];
g = MetaDiGraph()
add_blox!.(Ref(g), assembly)

add_edge!(g,1,2,Dict(:weight=>0.2/prj_pyr_phasic,:density=>prj_pyr_phasic/N_pyr,:nmda=>true,:nmda_weight=>9.5/prj_pyr_phasic))
add_edge!(g,2,1,Dict(:weight=>0.8/prj_phasic_pyr,:density=>prj_phasic_pyr/N_in_phasic))
add_edge!(g,3,1,Dict(:weight=>5/prj_tonic_pyr,:density=>prj_tonic_pyr/N_in_tonic))
add_edge!(g,3,2,Dict(:weight=>5/prj_tonic_phasic,:density=>prj_tonic_phasic/N_in_tonic))
add_edge!(g,4,3,Dict(:nmda=>true,:nmda_weight=>9.5))

@named neuron_net = system_from_graph(g)
sys = structural_simplify(neuron_net)
prob = SDEProblem(sys, [], (0.0, 2000), [])
sol = solve(prob,saveat = 0.01)
#sol = solve(prob, ImplicitEM(),saveat = 0.01)
ss=convert(Array,sol)
st=unknowns(sys)
vlist=Int64[]
for ii = 1:length(st)
if contains(string(st[ii]), "V(t)")
push!(vlist,ii)
end
end
V = ss[vlist,:]

VV=zeros(length(vlist),length(sol.t))
for ii = 1:length(vlist)
VV[ii,:] .= V[ii,:] .+ 200*(ii-1)

end
plot(sol.t,VV[:,:]',color= "blue",label=false)


10 changes: 10 additions & 0 deletions examples/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"
MetaGraphs = "626554b9-1ddb-594c-aa3c-2596fe9399a5"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Neuroblox = "769b91e5-4c60-41ee-bfae-153c84203cb2"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Pluto = "c3e4b0f8-55cb-11ea-2926-15256bba5781"
5 changes: 4 additions & 1 deletion src/Neuroblox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ abstract type NeuralMassBlox <: AbstractBlox end
abstract type CompositeBlox <: AbstractBlox end
abstract type StimulusBlox <: AbstractBlox end
abstract type ObserverBlox end # not AbstractBlox since it should not show up in the GUI
abstract type AbstractReceptorBlox end # not shown in the GUI

# we define these in neural_mass.jl
# abstract type HarmonicOscillatorBlox <: NeuralMassBlox end
Expand Down Expand Up @@ -108,6 +109,7 @@ include("blox/cortical.jl")
include("blox/canonicalmicrocircuit.jl")
include("blox/neuron_models.jl")
include("blox/DBS_Model_Blox_Adam_Brown.jl")
include("blox/Ketamine_Cortical_Model_Blox_Adam_Brown.jl")
include("blox/van_der_pol.jl")
include("blox/ts_outputs.jl")
include("blox/sources.jl")
Expand Down Expand Up @@ -221,7 +223,8 @@ export JansenRitSPM12, next_generation, qif_neuron, if_neuron, hh_neuron_excitat
hh_neuron_inhibitory, van_der_pol, Generic2dOscillator
export HHNeuronExciBlox, HHNeuronInhibBlox, IFNeuron, LIFNeuron, QIFNeuron, IzhikevichNeuron, LIFExciNeuron, LIFInhNeuron,
CanonicalMicroCircuitBlox, WinnerTakeAllBlox, CorticalBlox, SuperCortical, HHNeuronInhib_MSN_Adam_Blox, HHNeuronInhib_FSI_Adam_Blox, HHNeuronExci_STN_Adam_Blox,
HHNeuronInhib_GPe_Adam_Blox, Striatum_MSN_Adam, Striatum_FSI_Adam, GPe_Adam, STN_Adam, LIFExciCircuitBlox, LIFInhCircuitBlox
HHNeuronInhib_GPe_Adam_Blox, Striatum_MSN_Adam, Striatum_FSI_Adam, GPe_Adam, STN_Adam, LIFExciCircuitBlox, LIFInhCircuitBlox, HHNeuronExci_pyr_Adam_Blox, HHNeuronInh_inter_Adam_Blox
export Cortical_Pyramidal_Assembly_Adam, Cortical_Interneuron_Assembly_Phasic_Adam, Cortical_Interneuron_Assembly_Tonic_Adam, NMDA_receptor, Steady_Glutamate, Glutamate_puff
export LinearNeuralMass, HarmonicOscillator, JansenRit, WilsonCowan, LarterBreakspear, NextGenerationBlox, NextGenerationResolvedBlox, NextGenerationEIBlox, KuramotoOscillator
export Matrisome, Striosome, Striatum, GPi, GPe, Thalamus, STN, TAN, SNc
export HebbianPlasticity, HebbianModulationPlasticity
Expand Down
Loading
Loading