Git Product home page Git Product logo

pypns's Introduction

Build Status

Binder Enter code like in this picture PyPNS_build.png

PyPNS

PyPNS is a Python module for the simulation of peripheral nerves. Axon models are simulated in the compartmental simulator NEURON over its Python interface. Extracellular potentials from membrane currents or stimulation electrodes are calculated in a resistive, electro-quasistatic approximation of the Maxwell equations from either a homogeneous analytical solution, precomputed and imported finite element model outputs or analytical functions fit to FEM results.

PyPNS was developed in the Department of Bioengineering, Centre of Neurotechnology at Imperial College London.

This scientific software is released under the GNU Public License GPLv3.

Requirements

To install PyPNS you will need:

  • Python3
  • Python modules numpy, scipy and matplotlib
  • NEURON (from http://www.neuron.yale.edu) compiled as a Python module. IMPORTANT: Do not rely on pip for the installation of NEURON. Below is a guide on how to install NEURON including the Python interface from source. PyPNS is tested for NEURON 7.6.7 with InterViews 19

NEURON installation

It is advisable to install NEURON from source. The following description is closely based on Andrew Davidson's tutorial and copied here to make sure it is available. Another good description can be found on the official page here.

Download the source from the NEURON site

Download the NEURON source nrn-nn.tar.gz and the corresponding version of InterViews iv-mm.tar.gz from here.

Compile and install InterView

Replace mm with your InterViews version number.

 N=`pwd`
 tar xzf iv-mm.tar.gz
 cd iv-mm
 ./configure --prefix=`pwd`
 make
 make install

Compile and install NEURON

Replace nn with your NEURON version number and mm with your InterViews version number.

cd ..
tar xzf nrn-nn.tar.gz
cd nrn-nn
./configure --prefix=`pwd` --with-iv=$N/iv-mm --with-nrnpython
make
make install

If you want to run parallel NEURON, add --with-paranrn to the configure options. On Mac OS X, I have found I need to add PYLIB=-lpython PYLIBLINK=-lpython to the configure line.

Add NEURON binaries to PATH variable

Replace nn with your NEURON version number and x86_64 with your architecture code.

export PATH=$N/nrn-nn/x86_64/bin:$PATH

Build NEURON for Python

cd src/nrnpython
python setup.py install

This command (which will probably have to be run as root or using sudo) will install the neuron package to your site-packages directory. An alternative, especially if you don't have root privileges, is:

python setup.py install --prefix=~

which will install the neuron package to ~/lib/python/site-packages. You will then have to add this directory to the PYTHONPATH environment variable:

export PYTHONPATH=$PYTHONPATH:~/lib/python/site-packages

Installation

Using pip or easy install

pip install PyPNS

easy_install PyPNS

From source:

tar -xzf PyPNS-x.x.tar.gz
cd PyPNS-x.x
python setup.py install

Usage

To run PyPNS properly, several NEURON extensions need to be compiled for the myelinated axon model. Those are located in the mods-directory of PyPNS. Download this directory and run

nrnivmodl

from the console. A new folder will be generated containing the compiled files. They need to be present in the working directory of your project.

If FEM results are to be used for either recording or stimulation, the 'Fields'-directory needs to be present within the working directory as well. Different field dictionaries need to be contained within subdirectories. Subdirectory name equals field name. One example field can be downloaded from GitHub.

Testing

For a quick first test, download the test.py script from GitHub and run it:

python test.py

To reproduce figures of the paper go to this figure-repository.

Documentation

For further description of the different components of PyPNS, compile the Sphinx documentation. To do so, navigate to documentation/source within the PyPNS directory and run

sphinx-build -b html . ../HTML

pypns's People

Contributors

chlubba avatar russelljjarvis avatar

Watchers

James Cloos avatar

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.