wsphillips / Conductor.jl

Choo-choo
MIT License
60 stars 12 forks source link

[WIP] Implement IF-style neurons/compartments #39

Closed wsphillips closed 1 year ago

wsphillips commented 2 years ago

Implements LIF neurons using callbacks to do voltage reset and spike generation. liftest

using Conductor, ModelingToolkit, OrdinaryDiffEq, Plots, Graphs
import Unitful.ms

stim_dynamics = Conductor.LIF(-75.0, tau_membrane = 10.0, tau_synaptic = 10.0, threshold = -55.0, resistance = 0.1, stimulus = 500)
@named stim_neuron = CompartmentSystem(stim_dynamics)

sim = Simulation(stim_neuron, time = 300ms, return_system = false)
sol = solve(sim, Euler(), dt = 0.5);
fig = plot(sol[stim_neuron.V] + sol[stim_neuron.S]*(70)) # Superimpose spikes on top of voltage

Network simulations also make use of callbacks to do spike propagation by updating synaptic input current.

wsphillips commented 1 year ago

network simulations won't work until https://github.com/SciML/ModelingToolkit.jl/issues/1721 gets fixed upstream