Code Monkey home page Code Monkey logo

rthybrid-neuron-model-generator's Introduction

RTHybrid Neuron Model Generator

Automatic neuron model generator compatible with RTHybrid model library.

It reads the equations that define the model from a text file and generates all the necessary code to use the model in RTHybrid.

Input file format

This is an example of an input file for the model generator:

Example_Model_2019 -100 100
d/dt V = (-(i_k + i_na) + i - syn) / Cm
i_na = g_na^2 * (1.0 / (1.0 + exp(-0.2 * (V + 45)))) * (V - V_na)
i_k = g_k * (V - V_k)

Values
V = -55
i = 0.0
Cm = 0.02
g_na = 0.0231
g_k = 0.25
V_k = -70.0
V_na = 40.0

The first line of the file contains the name of the model (use under scores instead of spaces), and its minimum and maximum amplitude values. It is recommended to use the reference of the paper from which the model is obtained as name (i.e. Hodgkin_Huxley_1952).

The following lines are the equations that define the model:

  • Use only parenthesis to set operations precedence, not brackets or curly braces.
  • It is case sensitive, but do not name two variables or parameters the same, even with different cases.
  • To define a differential equation write d/dt before the variable name (e.g. d/dt V).
  • Power functions can be expressed using ^ (e.g. n^2).
  • Exponential functions can be expressed using exp (e.g. exp(-0.4 * (V + 31))).
  • There must ALWAYS exist a parameter named syn in the voltage equation, which will be used for the synaptic input.
  • Trigonometric functions are not supported yet.

After all the equations there must be a line with the word Values and after it, the initial values for the variables and parameters necessary.

How to use it

Open a terminal and type

$ sh generator.sh filename model_name

where filename is the input file (e.g. hodgkin_huxley_1952.txt) and model_name is the name written in the first line of that file (e.g. Hodgkin_Huxley_1952).

This script will first execute the program equation_parser/file_parser.py, which will generate the code for the neuron model in the directory model_library/neuron/<model_name>.

Then, it will execute dt_pts_calculator/calculator.py, which will compute the model with different integration steps and integration methods (Euler, Heun, Runge-Kutta order 4 and Runge-Kutta order 6(5)) and generate the set_pts_burst function, necessary for RTHybrid temporal calibration of the models. This may take several minutes.

The program dt_pts_calculator/test.py allows you to test the generated model with different integration methods (EULER, HEUN, RK4 or RK65) and integration steps

python dt_pts_calculator/test.py <model_name> <integration_method> <integration_step>

Finally, the complete code for the neuron model will be at model_library/neuron/<model_name>. Copy the <model_name> folder to model_library/neuron/ directory of RTHybrid (the file main_<model_name>.c can be removed at this point).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.