Friday, February 4, 2011

PyNN 0.7.0 released

PyNN 0.7.0 is available for download from  PyPI and from the INCF Software Center. Documentation is available at

This release sees a major extension of the API with the addition of the PopulationView and Assembly classes, which aim to make building large, structured networks much simpler and cleaner. A PopulationView allows a subset of the neurons from a Population to be encapsulated in an object. We call it a "view", rather than a "sub-population", to emphasize the fact that the neurons are not copied: they are the same neurons as in the parent Population, and any operations on either view or parent (setting parameter values, recording, etc.) will be reflected in the other.  An Assembly is a list of  Population and/or PopulationView objects, enabling multiple cell types to be encapsulated in a single object. PopulationView and Assembly objects behave in most ways like Population: you can record them, connect them using a Projection, you can have views of views...

The "low-level API" (rechristened "procedural API") has been reimplemented in terms of Population and Projection. For example, create() now returns a Population object rather than a list of IDs, and connect() returns a Projection object. This change should be almost invisible, since Population now behaves very much like a list of IDs (can be sliced, joined, etc.).

There has been a major change to cell addressing: Populations now always store cells in a one-dimensional array, which means cells no longer have an address but just an index. To specify the spatial structure of a Population, pass a Structure object to the constructor, e.g.

  p = Population((12,10), IF_cond_exp)

is now

   p = Population(120, IF_cond_exp, structure=Grid2D(1.2))

although the former syntax still works, for backwards compatibility. The reasons for doing this are:

  1. we can now have more interesting structures than just grids
  2. efficiency (less juggling addresses, flattening)
  3. simplicity (less juggling addresses, less code).

The API for setting initial values has changed: this is now done via the initialize() function or the Population.initialize() method, rather than by having v_init and similar parameters for cell models.
Other API changes:

- simplification of the record_X() methods.
- enhanced describe() methods: can now use Jinja2 or Cheetah templating engines to produce much nicer, better formatted network descriptions.
- connections and neuron positions can now be saved to various binary formats as well as to text files.
- added some new connectors: SmallWorldConnector and CSAConnector  (CSA = Connection Set Algebra).
- native neuron and synapse models are now supported using a NativeModelType subclass, rather than specified as strings. This simplifies the code internally and increases the range of PyNN functionality that can be used with native models (e.g. you can now record any variable from a native NEST or NEURON model). For NEST, there is a class factory native_cell_type(), for NEURON the NativeModelType subclasses have to be written by hand.

Backend changes:

  • the NEST backend has been updated to work with NEST version 2.0.0rc2.
  • the Brian backend has seen extensive work on performance and on bringing it to feature parity with the other backends.


I'd like to thank everyone who has contributed to this release:  Daniel BrĂ¼derle, Eilif Muller, Mikael Djurfeldt, Michael Schmucker and especially Pierre Yger, who has done amazing work on the Brian backend, on implementing my wish list of features for the Assembly class, and in many other areas, while at the same time successfully completing and defending his PhD thesis. Thanks also to everyone who has reported bugs or requested improvements.

What is PyNN?

PyNN (pronounced 'pine' ) is a simulator-independent language for building neuronal network models.

In other words, you can write the code for a model once, using the PyNN API and the Python programming language, and then run it without modification on any simulator that PyNN supports (currently NEURONNESTPCSIM and Brian).

Even if you don't wish to run simulations on multiple simulators, you may benefit from writing your simulation code using PyNN's powerful, high-level interface. In this case, you can use any neuron or synapse model supported by your simulator, and are not restricted to the standard models.

The code is released under the CeCILL licence (GPL-compatible).