Skip to main content
  • Poster presentation
  • Open access
  • Published:

Brian: a simulator for spiking neural networks in Python

We present Brian, a new clock driven simulator for spiking neural networks which is available on almost all platforms. Brian is easy to learn and use, highly flexible and easily extensible. The Brian package itself and simulations using it are all written in the Python programming language, which is very well adapted to these goals. Python is an easy, concise and highly developed language with many advanced features and development tools, excellent documentation and a large community of users providing support and extension packages. Brian allows you to write very concise, natural and readable code for simulations, and makes it quick and efficient to play with these models (for example, changing the differential equations doesn't require a recompile of the code). Figure 1 shows an example of a complete network implemented in Brian, a randomly connected network of integrate and fire neurons with exponential inhibitory and excitatory currents (the CUBA network from [1]). Defining the model, running the simulation and making a raster plot of the activity takes fifteen lines of code. Amongst Brian's features are:

Flexible neuron models: these can be defined in many ways, notably by directly providing differential equations (including stochastic DEs), or modularly, using standard components like ion channels and alpha function postsynaptic currents.

Built in analysis and plotting: using the SciPy and PyLab scientific computing and plotting packages.

Unit checking: equations and quantities are checked for dimensional consistency, which helps to eliminate scaling errors and incorrect equations which can otherwise be very hard to debug.

Interactive simulations: Using the Python interactive shell, running simulations, changing aspects of the model, plotting and analysis can all be done interactively rather than requiring the network to be run afresh each time.

Extensibility: Since Brian is written in the same high level language as simulations using it, it is easy to write extensions to Brian and share them with others.

Python is an interpreted language which means that it is slower than code written directly in C, but by using the NumPy package for highly optimised linear algebra it ends up comparable in speed to C code for large networks. The random network described above with 4000 neurons took 3.5 s to simulate 1 s of biological time, which was roughly 60% faster than Matlab, and 25% slower than C.

Figure 1
figure 1

Brian in action.

References

  1. Brette R, Rudolph M, Carnevale T, Hines M, Beeman D, Bower JM, Diesmann M, Morrison A, Goodman PH, Harris FC, et al: Simulation of networks of spiking neurons: a review of tools and strategies. J Comput Neurosci. 2007, 23 (3): 349-398. 10.1007/s10827-007-0038-6.

    Article  PubMed Central  PubMed  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Dan Goodman.

Rights and permissions

Open Access This article is published under license to BioMed Central Ltd. This is an Open Access article is distributed under the terms of the Creative Commons Attribution 2.0 International License (https://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Reprints and permissions

About this article

Cite this article

Goodman, D., Brette, R. Brian: a simulator for spiking neural networks in Python. BMC Neurosci 9 (Suppl 1), P92 (2008). https://0-doi-org.brum.beds.ac.uk/10.1186/1471-2202-9-S1-P92

Download citation

  • Published:

  • DOI: https://0-doi-org.brum.beds.ac.uk/10.1186/1471-2202-9-S1-P92

Keywords