Category Archives: Guides

Add ssh key (Git)

Open a terminal

ssh-keygen

Press enter if you don’t want to change filename

Write a passphrase (optional)

cat ~/.ssh/id_rsa.pub

Copy output

Go to github.com account > settings
Select ssh keys on left side, select add ssh key
Write name of key and paste key from terminal

Select ssh when you want to copy the “clone adress”.
Enter previously passphrase and select “remember”.

To change an existing https key do:

git remote set-url origin SSH_ADDRESS

Install neo++ in a virtual environment

sudo apt-get install virtualenvwrapper python-pyqt4
mkvirtualenv NEO --system-site-packages
workon NEO

Then copy the following into a bashfile and run it – bash bashfile

#!/bin/bash
# Install script
set -x  # make sure each command is printed in the terminal

function pip_install {
  pip install --upgrade "$@"
  if [ $? -ne 0 ]; then
    echo "could not install $p - abort"
    exit 1
  fi
}

pip_install cython
pip_install h5py==2.5.0
pip_install tables
pip_install sqlalchemy
pip_install sqlalchemy-migrate
pip_install scikit-learn
pip_install pywavelets

git clone https://github.com/NeuralEnsemble/elephant.git
git clone https://github.com/OpenElectrophy/OpenElectrophy.git
git clone https://github.com/rproepp/spykeviewer.git
git clone https://github.com/rproepp/spykeutils.git
git clone https://github.com/jzaremba/guidata.git
git clone https://github.com/PierreRaybaut/guiqwt.git

cd guidata && python setup.py install
cd ..
cd guiqwt && python setup.py build install
cd ..
cd python-neo && python setup.py develop
cd ..
cd spykeutils && python setup.py develop
cd ..
cd spykeviewer && python setup.py develop
cd ..
cd OpenElectrophy && python setup.py develop
cd ..
cd elephant && python setup.py develop

Install klustakwik and klustaviewa on ubuntu

Note that this project is being replaced by phy

First of all you need the right dependencies, its easiest to do with anaconda – make a virtual environment!

cd into your preferred directory e.g. $HOME/apps/ in this example, clone the necessary repos, make symlink and install.

git clone https://github.com/klusta-team/klustaviewa.git
git clone https://github.com/rossant/qtools
git clone https://github.com/rossant/galry
git clone https://github.com/klusta-team/spikedetekt
git clone https://github.com/klusta-team/kwiklib
git clone https://github.com/klusta-team/klustakwik.git 

cd klustaviewa

ln -s ../qtools/qtools qtools
ln -s ../galry/galry galry
ln -s ../spikedetekt2/spikedetekt2 spikedetekt2
ln -s ../kwiklib/kwiklib kwiklib

python setup.py develop

make klustakwik and rename the executable

cd $HOME/apps/klustakwik
make 
mv KlustaKwik klustakwik

export path in your ~/.bashrc file

export PATH=$HOME/apps/klustakwik/:$PATH

Download test data (.zip) and change params.prm to this file cd to example dir and enter

klusta params.par

Getting started with HybridLFPy

This is a current* guide to getting HybridLFPy up and running on Ubuntu 14.04.

HybridLFPy combines some research-grade packages that are in active development. We therefore have to apply a combination of techniques to install compatible versions of each package. The packages that needs to be installed are

  • NEST
  • Neuron
  • LFPy
  • NeuroTools

Some of these will be installed using pip, some using setup.py and some using .deb packages. For the pip and setup.py packages, it will be a good idea to contain these in virtual environment to avoid contaminating the entire Python installation. To do this, we start out by installing virtualenvwrapper:

sudo apt-get install virtualenvwrapper

Restart your terminal and run the following command to create a virtual environment for our LFPy installation. It will use the system’s Python packages for anything else, for instance matplotlib, numpy, etc.:

mkvirtualenv lfpy --system-site-packages

To start using the new virtual environment, use the workon command:

workon lfpy

Installing NEST

We will install NEST from source. Go to the NEST website and download the most recent stable version. As of this writing, version 2.6.0 is the most recent.

After downloading, unpack NEST and while still in the lfpy virtual environment, run

./configure --prefix=$HOME/opt/nest

Then make and make install:

make -j 4
make install

NEST does not add its Python packages to PYTHONPATH. Do this manually by adding the following to your ~/.bashrc file (~ means your home folder, i.e. /home/yourusername/.bashrc):

export PYTHONPATH=$HOME/opt/nest/lib/python2.7/site-packages/:$PYTHONPATH

You now need to reload the .bashrc file by running the following command:

source ~/.bashrc

To test that the installation works, open a python interpreter, still in the lfpy virtual environment, and try to import nest:

python
import nest

If you don’t receive any error messages, NEST has been installed. Note that NEST now is installed only in the lfpy virtual environment. This means that you won’t have access to it if you don’t run workon lfpy  first.

Installing Neuron

Neuron can be installed from the NEURON website. However, as of this writing, we need to use the alpha version of NEURON 7.3. This can be found from the alpha packages listing on NEURONs website.

Download the file nrn-7.3.rel-1173+.x86_64.deb.

Double click the file to open Ubuntu Software Center and install the package. Note that you will be receiving an error message about the package being broken. Ignore this and continue the installation.

NEURON does not add its Python packages to PYTHONPATH. Do this manually by adding the following to your ~/.bashrc file:

export PYTHONPATH=/usr/local/nrn/lib/python/:$PYTHONPATH

You now need to reload the .bashrc file by running the following command:

source ~/.bashrc

To test that the installation works, open a python interpreter and try to import neuron:

python
import neuron

If you don’t receive any error messages, NEURON has been installed.

Installing LFPy

LFPy most easily installed through pip. Open the lfpy virtual environment if you have not done so already:

workon lfpy

Once in the lfpy shell, run pip to install the lfpy package:

pip install lfpy

To test that the installation works, open a python interpreter and try to import LFPy (remember that the package name is case-sensitive):

python
import LFPy

If you don’t receive any error messages, LFPy has been installed.

Installing NeuroTools

Again, we will use pip for installation. Run the following command to install NeuroTools:

pip install neurotools

To test that the installation works, open a python interpreter and try to import NeuroTools (remember that the package name is case-sensitive):

python
import NeuroTools

If you don’t receive any error messages, NeuroTools has been installed.

Installing mpi4py

mpi4py is easily installed using apt-get:

sudo apt-get install python-mpi4py

Installing HybridLFPy

HybridLFPy is not yet in any package repository. We therefore need to clone HybridLFPy from GitHub directly:

git clone https://github.com/espenhgn/hybridLFPy.git

Once cloned. Try running the basic example:

export PYTHONPATH=..:$PYTHONPATH
cd hybridLFPy/examples
python examples/example_brunel.py

This will take a long time to run, but once finished a few windows with plots showing the results of the simulation will show.

Troubleshooting

Segmentation faults

If you get a segmentation fault, similar to the one below, you are likely using the wrong version of Neuron for LFPy:

[stan:17420] *** Process received signal ***
[stan:17420] Signal: Segmentation fault (11)
[stan:17420] Signal code: Address not mapped (1)
[stan:17420] Failing at address: 0x44000098
[stan:17420] [ 0] /lib/x86_64-linux-gnu/libpthread.so.0(+0x10340) [0x7f8bd78bc340]
[stan:17420] [ 1] /usr/lib/libmpi.so.1(PMPI_Comm_dup+0x4e) [0x7f8bcc04477e]
[stan:17420] [ 2] /usr/local/nrn/x86_64/lib/libnrnmpi.so(f_nrnmpi_init+0xe9) [0x7f8bb72dba49]
[stan:17420] [ 3] /usr/local/nrn/lib/python/neuron/hoc.so(inithoc+0x1a0) [0x7f8bb96d8ec0]
[stan:17420] [ 4] python(_PyImport_LoadDynamicModule+0x9b) [0x4268bc]
...

Try to install a different version of NEURON. As of this writing, the needed version gives the following output upon importing the neuron package in Python:

NEURON -- Release 7.3 (1173+:c2415b59f252+) 2014-10-07

*This guide may be obsolete if you’re reading it some time after it was posted.