Skip to main content

Package for simulating spiking neuron models

Project description

NeuronMd

Package for simulating different spiking neuron models.

Installation

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 .

Neuron Models

Hodgkin-Huxley Neuron Model

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.

Izhikevich Neuron Model

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.

Fitz-Hugh Nagumo Neuron Model

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

neuronmd-0.1.1.post1.tar.gz (5.1 kB view hashes)

Uploaded Source

Built Distribution

neuronmd-0.1.1.post1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page