Package for simulating different spiking neuron models.
Install using pip
:
pip install neuronmd
Clone the repository:
git clone https://github.com/sowmyamanojna/neuronmd
Then, cd
into the directory and run:
pip install .
The HH neuron model can be simulated by creating an instance of the HHNeuron
class.
The code is as follows:
import numpy as np
from neuronmd import HHNeuron
# Initialize a HH Neuron Class
hhneuron = HHNeuron()
# tmax - Max time (ms) to simulate the neuron
# dt - time step of simulation
# I - Current for simulating the neuron
tmax = 100
dt = 0.01
I = 0.1
t = np.arange(0, tmax, dt)
# Simulate the neuron for a single current instance
hhneuron.simulate(t, I)
# Plot the results
hhneuron.plot()
# View the variation in the state of the dynamical
# system, as the input current is varied.
current_list = np.arange(0.01, 0.5, 0.01)
hhneuron.animate(t, ylim=[-85,40], current_list=current_list)
hhneuron.animate(t, current_list=current_list, name="no_ylim")
The results obtained from the above code:
The default parameters used in the model are:
v = -65 # mV
vna = 50 # mV
vk = -77 # mV
vl = -54.387 # mV
gnamax = 1.20 # m.mho/cm**2
gkmax = 0.36 # m.mho/cm**2
gl = 0.003 # m.mho/cm**2
cm = 0.01 # mF/cm**2
m = 0.0530
h = 0.5960
n = 0.3177
The parameters can be changed using the change_params
function. A dict of params as keys and their corresponding values should be passed as the parameter.
The Izhikevich neuron model can be simulated by creating an instance of the IzhNeuron
class.
The code is as follows:
izhneuron = IzhNeuron()
tmax = 1000
dt = 0.01
t = np.arange(0, tmax, dt)
I = 5
izhneuron.simulate(t, I)
izhneuron.plot()
current_list = np.arange(0.01, 10, 0.5)
izhneuron.animate(t, ylim=[-80,35], current_list=current_list)
izhneuron.animate(t, current_list=current_list, name="no_ylim")
The results obtained from the above code:
The default parameters used in the model are:
a = 0.02
b = 0.2
c = -65
d = 8
v = -65
u = b * v
The above values correspond to Regular Spiking neuron.
The parameters can be changed using the change_params
function. A dict of params as keys and their corresponding values should be passed as the parameter.
The Fitz-Hugh Nagumo neuron model can be simulated by creating an instance of the FHNNeuron
class.
The code is as follows:
fhnneuron = FHNNeuron()
tmax = 100
dt = 0.01
I = 1.75
t = np.arange(0, tmax, dt)
fhnneuron.simulate(0.6, 0, t, 0.6)
fhnneuron.plot(name="0.1")
current_list = np.arange(0.01, I, 0.01)
fhnneuron.animate(t, current_list, ylim=[-0.45,1.5])
fhnneuron.animate(t, current_list=current_list, name="no_ylim")
The results obtained from the above code:
The default parameters used in the model are:
a = 0.5
b = 0.1
r = 0.1
The parameters can be changed using the change_params
function. A dict of params as keys and their corresponding values should be passed as the parameter.