Skip to content

Commit

Permalink
Merge branch 'nest-dev' of github.com:NeuralEnsemble/PyNN into nest-dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	ci/install_nest.sh
  • Loading branch information
apdavison committed Aug 30, 2017
2 parents aa0e209 + 56d28f7 commit 0fe65e5
Show file tree
Hide file tree
Showing 129 changed files with 3,244 additions and 295 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
x86_64
i386
i686
_build

# Python files
build
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ after_success:
- coveralls
cache:
directories:
- $HOME/nest-master
- $HOME/nest-2.12.0
- $HOME/nrn-7.4
- $HOME/build/nest-master
- $HOME/build/nest-2.12.0
- $HOME/build/nrn-7.4
- $HOME/.cache/pip
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
include pyNN/neuron/nmodl/*.mod
include pyNN/nest/extensions/*.h
include pyNN/nest/extensions/*.cpp
include pyNN/nest/extensions/CMakeLists.txt
include pyNN/nest/extensions/sli/*
include pyNN/descriptions/templates/*/*.txt
include test/parameters/*
include test/system/*.py
Expand All @@ -10,3 +14,4 @@ include LICENSE
include AUTHORS
include README.rst
include changelog
include requirements.txt
2 changes: 1 addition & 1 deletion ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
set -e # stop execution in case of errors

sudo apt-get install -qq python-numpy python3-numpy python-scipy python3-scipy libgsl0-dev openmpi-bin libopenmpi-dev

pip install -r requirements.txt
pip install coverage coveralls
pip install nose-testconfig
source ci/install_brian.sh
source ci/install_nest.sh
source ci/install_neuron.sh
Expand Down
14 changes: 12 additions & 2 deletions ci/install_nest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ set -e # stop execution in case of errors

if [ "$TRAVIS_PYTHON_VERSION" == "2.7" ] || [ "$TRAVIS_PYTHON_VERSION" == "3.5" ]; then
echo -e "\n========== Installing NEST ==========\n"
# Specify which version of NEST to install
export NEST_VERSION="master"
#export NEST_VERSION="2.12.0"

export NEST="nest-simulator-$NEST_VERSION"
pip install cython==0.23.4
wget https://github.com/nest/nest-simulator/archive/$NEST_VERSION.tar.gz -O $HOME/$NEST.tar.gz;

if [ "$NEST_VERSION" = "master" ]; then
wget https://github.com/nest/nest-simulator/archive/$NEST_VERSION.tar.gz -O $HOME/$NEST.tar.gz;
else
wget https://github.com/nest/nest-simulator/releases/download/v$NEST_VERSION/nest-$NEST_VERSION.tar.gz -O $HOME/$NEST.tar.gz
fi

pushd $HOME;
tar xzf $NEST.tar.gz;
ls;
popd;

mkdir -p $HOME/build/$NEST
pushd $HOME/build/$NEST
export VENV=`python -c "import sys; print(sys.prefix)"`;
ln -s /opt/python/2.7.12/lib/libpython2.7.so $VENV/lib/libpython2.7.so;
ln -s /opt/python/2.7.13/lib/libpython2.7.so $VENV/lib/libpython2.7.so;
ln -s /opt/python/3.5.2/lib/libpython3.5m.so $VENV/lib/libpython3.5.so;
export PYTHON_INCLUDE_DIR=$VENV/include/python${TRAVIS_PYTHON_VERSION}
if [ "$TRAVIS_PYTHON_VERSION" == "3.5" ]; then
Expand Down
10 changes: 7 additions & 3 deletions doc/build_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"synaptic_input.py",
"tsodyksmarkram.py",
"varying_poisson.py",
"stochastic_synapses.py",
"stochastic_deterministic_comparison.py"
)

# todo: add line numbering to code examples
Expand Down Expand Up @@ -62,8 +64,9 @@
tmp_dir = tempfile.mkdtemp()
results_dir = os.path.join(tmp_dir, "Results")

if not os.path.exists(image_dir):
os.makedirs(image_dir)
for dir_name in (image_dir, results_dir):
if not os.path.exists(dir_name):
os.makedirs(dir_name)


def run(python_script, simulator, *extra_args):
Expand Down Expand Up @@ -92,8 +95,9 @@ def list_files(filter):
for filename in x[2]
if filter in filename])

print("Running examples in {}".format(tmp_dir))
for example in examples:
new_files = run(example, simulators.next())
new_files = run(example, next(simulators))
if len(new_files) > 1:
raise Exception("Multiple image files")
img_path, = new_files
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class MockNESTModule(mock.Mock):
# built documents.
#
# The short X.Y version.
version = '0.8'
version = '0.9'
# The full version, including alpha/beta/rc tags.
release = '0.8.3'
release = '0.9.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
4 changes: 2 additions & 2 deletions doc/data_handling.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ top-level data container, which contains one or more :class:`Segment`\s. Each
:class:`Segment` is a container for data sharing a common time basis - a new
:class:`Segment` is added every time the :func:`reset` function is called.

A :class:`Segment` can contain lists of :class:`AnalogSignal`,
:class:`AnalogSignalArray` and :class:`SpikeTrain` objects. These data objects
A :class:`Segment` can contain lists of :class:`AnalogSignal` and :class:`SpikeTrain` objects.
These data objects
inherit from NumPy's array class, and so can be treated in further processing
(analysis, visualization, etc.) in exactly the same way as NumPy arrays, but in
addition they carry metadata about units, sampling interval, etc.
Expand Down
19 changes: 18 additions & 1 deletion doc/developers/contributing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,23 @@ The suggested way to do this is to write test functions, in a separate file,
that take a simulator module as an argument, and then call these functions from
``test_neuron.py``, ``test_nest.py``, etc.

System tests defined in the scenarios directory are treated as a single test
(test_scenarios()) while running nosetests. To run only the tests within a file
named 'test_electrodes' located inside system/scenarios, use::

$ nosetests -s --tc=testFile:test_electrodes test_nest.py

To run a single specific test named 'test_changing_electrode' located within
some file (and added to registry) inside system/scenarios, use::

$ nosetests -s --tc=testName:test_changing_electrode test_nest.py

Note that this would also run the tests specified within the simulator specific
files such as test_brian.py, test_nest.py and test_neuron.py. To avoid
this, specify the 'test_scenarios function' on the command line::

$ nosetests -s --tc=testName:test_changing_electrode test_nest.py:test_scenarios

The ``test/unsorted`` directory contains a number of old tests that are either
no longer useful or have not yet been adapted to the nose framework. These are
not part of the test suite, but we are gradually adapting those tests that are
Expand Down Expand Up @@ -249,4 +266,4 @@ If this is a final release, there are a few more steps:
.. _`issue tracker`: https://github.com/NeuralEnsemble/PyNN/issues/
.. _fork: https://github.com/NeuralEnsemble/PyNN/fork
.. _`PyNN repository`: https://github.com/NeuralEnsemble/PyNN/
.. _contents: http://software.incf.org/software/pynn/pynn/folder_contents
.. _contents: http://software.incf.org/software/pynn/pynn/folder_contents
2 changes: 2 additions & 0 deletions doc/examples.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ Examples
examples/synaptic_input
examples/tsodyksmarkram
examples/varying_poisson
examples/stochastic_synapses
examples/stochastic_deterministic_comparison
examples/VAbenchmarks
2 changes: 1 addition & 1 deletion doc/examples/Izhikevich.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A selection of Izhikevich neurons
=================================

.. image:: ../images/examples/Izhikevich_nest_np1_20151005-081145.png
.. image:: ../images/examples/Izhikevich_nest_np1_20170505-150315.png

.. literalinclude:: ../../examples/Izhikevich.py

2 changes: 1 addition & 1 deletion doc/examples/VAbenchmarks.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Balanced network of excitatory and inhibitory neurons
=====================================================

.. image:: ../images/examples/VAbenchmarks_CUBA_20151005-081325.png
.. image:: ../images/examples/VAbenchmarks_CUBA_20170505-150538.png

.. literalinclude:: ../../examples/VAbenchmarks.py

2 changes: 1 addition & 1 deletion doc/examples/cell_type_demonstration.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A demonstration of the responses of different standard neuron models to current injection
=========================================================================================

.. image:: ../images/examples/cell_type_demonstration_nest_20151005-081150.png
.. image:: ../images/examples/cell_type_demonstration_nest_20170505-150320.png

.. literalinclude:: ../../examples/cell_type_demonstration.py

2 changes: 1 addition & 1 deletion doc/examples/current_injection.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Injecting time-varying current into a cell
==========================================

.. image:: ../images/examples/current_injection_neuron_20151005-081148.png
.. image:: ../images/examples/current_injection_neuron_20170505-150317.png

.. literalinclude:: ../../examples/current_injection.py

2 changes: 1 addition & 1 deletion doc/examples/random_numbers.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
An example to illustrate random number handling in PyNN
=======================================================

.. image:: ../images/examples/random_numbers_neuron_20151005-081153.png
.. image:: ../images/examples/random_numbers_neuron_20170505-150323.png

.. literalinclude:: ../../examples/random_numbers.py

2 changes: 1 addition & 1 deletion doc/examples/simple_STDP.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A very simple example of using STDP
===================================

.. image:: ../images/examples/simple_stdp_neuron_20151005-081202.png
.. image:: ../images/examples/simple_stdp_neuron_20170505-150331.png

.. literalinclude:: ../../examples/simple_STDP.py

2 changes: 1 addition & 1 deletion doc/examples/small_network.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Small network created with the Population and Projection classes
================================================================

.. image:: ../images/examples/small_network_nest_np1_20151005-081205.png
.. image:: ../images/examples/small_network_nest_np1_20170505-150334.png

.. literalinclude:: ../../examples/small_network.py

7 changes: 7 additions & 0 deletions doc/examples/stochastic_deterministic_comparison.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Example of facilitating and depressing synapses in deterministic and stochastic versions
========================================================================================

.. image:: ../images/examples/stochastic_comparison_neuron_20170505-150418.png

.. literalinclude:: ../../examples/stochastic_deterministic_comparison.py

7 changes: 7 additions & 0 deletions doc/examples/stochastic_synapses.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Example of simple stochastic synapses
=====================================

.. image:: ../images/examples/stochastic_synapses__nest_20170505-150345.png

.. literalinclude:: ../../examples/stochastic_synapses.py

2 changes: 1 addition & 1 deletion doc/examples/synaptic_input.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A demonstration of the responses of different standard neuron models to synaptic input
======================================================================================

.. image:: ../images/examples/synaptic_input_neuron_20151005-081208.png
.. image:: ../images/examples/synaptic_input_neuron_20170505-150337.png

.. literalinclude:: ../../examples/synaptic_input.py

2 changes: 1 addition & 1 deletion doc/examples/tsodyksmarkram.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Example of depressing and facilitating synapses
===============================================

.. image:: ../images/examples/tsodyksmarkram_nest_20151005-081211.png
.. image:: ../images/examples/tsodyksmarkram_nest_20170505-150340.png

.. literalinclude:: ../../examples/tsodyksmarkram.py

2 changes: 1 addition & 1 deletion doc/examples/varying_poisson.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
A demonstration of the use of callbacks to vary the rate of a SpikeSourcePoisson
================================================================================

.. image:: ../images/examples/varying_poisson_neuron_20151005-081216.png
.. image:: ../images/examples/varying_poisson_neuron_20170505-150343.png

.. literalinclude:: ../../examples/varying_poisson.py

Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified doc/images/examples/random_distributions.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions doc/index.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
PyNN: documentation
===================

This is the documentation for version |release|. For versions 0.7 and earlier,
see http://neuralensemble.org/trac/PyNN

.. toctree::
:maxdepth: 1

Expand All @@ -25,6 +22,13 @@ see http://neuralensemble.org/trac/PyNN
contributors
release_notes

.. note::

This is the documentation for version |release|. Earlier versions:

- `version 0.8`_
- `version 0.7 and earlier`_

.. add 'logging' after 'units' once configure_logging() implemented.

.. add 'descriptions' after logging
Expand Down Expand Up @@ -62,3 +66,6 @@ Indices and tables
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

.. _`version 0.8`: http://neuralensemble.org/docs/PyNN/0.8/
.. _`version 0.7 and earlier`: http://neuralensemble.org/docs/PyNN/0.7/
24 changes: 6 additions & 18 deletions doc/installation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Installing PyNN requires:
* Python (version 2.6, 2.7, 3.3-3.6)
* a recent version of the NumPy_ package
* the lazyarray_ package
* the Neo_ package
* the Neo_ package (>= 0.5.0)
* at least one of the supported simulators: e.g. NEURON, NEST, or Brian.

Optional dependencies are:
Expand All @@ -22,7 +22,7 @@ Optional dependencies are:
Installing PyNN
===============

.. note:: if using NEURON, it is easiest if you install NEURON *before* you install PyNN (see below).
.. note:: if using NEURON or NEST, it is easiest if you install NEURON/NEST *before* you install PyNN (see below).

The easiest way to get PyNN is to use pip_::

Expand All @@ -32,8 +32,8 @@ If you are running Debian or Ubuntu, there are :doc:`binary packages <download>`
available. If you would prefer to install manually, :doc:`download the latest
source distribution <download>`, then run the setup script, e.g.::

$ tar xzf PyNN-0.8.3.tar.gz
$ cd PyNN-0.8.3
$ tar xzf PyNN-0.9.1.tar.gz
$ cd PyNN-0.9.1
$ python setup.py install

This will install it to your Python :file:`site-packages` directory, and may
Expand All @@ -49,6 +49,8 @@ Test it using something like the following::
>>> sim.end()

(This assumes you have NEST installed).
If you get a warning "Unable to install NEST extensions. Certain models may not be available" then ensure the
program :command:`nest-config` is on your system PATH.

With NEURON as the simulator, make sure you install NEURON *before* you install PyNN.
The PyNN installation will then compile PyNN-specific membrane mechanisms, which are loaded when importing the :mod:`neuron` module::
Expand Down Expand Up @@ -116,20 +118,6 @@ Earlier versions of NEST will not work with this version of PyNN.
The full installation instructions are available in the file INSTALL, which you can find in the NEST source package,
or at `<http://www.nest-simulator.org/installation/>`_.

.. note:: NumPy must be installed *before* installing NEST.

.. note:: Make sure you have the GNU Scientific Library (GSL) installed,
otherwise some PyNN standard models (e.g. :class:`IF_cond_exp`) will not be available.

On Linux, most Unix variants and Mac OS X, installation is usually as simple as::

$ ./configure --with-mpi
$ make
$ make install

This will install PyNEST to your Python :file:`site-packages` directory.
If you wish to install it elsewhere, see the full installation instructions.

Now try it out::

$ cd ~
Expand Down
4 changes: 2 additions & 2 deletions doc/neurons.txt
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ or written to file using :meth:`write_data()`:
Neo see the documentation at http://packages.python.org/neo. Here, it will
suffice to note that a :class:`Block` is the top-level container, and contains
one or more :class:`Segments`. Each :class:`Segment` is a container for data
that share a common time basis, and can contain lists of :class:`AnalogSignal`,
:class:`AnalogSignalArray` and :class:`SpikeTrain` objects. These data objects
that share a common time basis, and can contain lists of :class:`AnalogSignal`
and :class:`SpikeTrain` objects. These data objects
inherit from NumPy array, and so can be treated in further processing (analysis,
visualization, etc.) in exactly the same way as plain arrays, but in addition
they carry metadata about units, sampling interval, etc.
Expand Down
2 changes: 1 addition & 1 deletion doc/pyplots/ac_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
sim.run(500.0)

t, i_inj = sine._get_data()
v = population.get_data().segments[0].analogsignalarrays[0]
v = population.get_data().segments[0].analogsignals[0]

plot_current_source(t, i_inj, v,
v_range=(-66, -49),
Expand Down
2 changes: 1 addition & 1 deletion doc/pyplots/continuous_time_spiking.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_sim(on_or_off_grid, sim_time):
prj = Projection(src, nrn, OneToOneConnector(), StaticSynapse(weight=weight))
nrn.record('v')
run(sim_time)
return nrn.get_data().segments[0].analogsignalarrays[0]
return nrn.get_data().segments[0].analogsignals[0]

sim_time = 10.0
off = test_sim('off_grid', sim_time)
Expand Down

0 comments on commit 0fe65e5

Please sign in to comment.