The Brian Simulator
Total Page:16
File Type:pdf, Size:1020Kb
FOCUSED REVIEW published: 15 September 2009 doi: 10.3389/neuro.01.026.2009 The Brian simulator Dan F. M. Goodman1,2* and Romain Brette1,2* 1 Laboratoire Psychologie de la Perception, CNRS and Université Paris Descartes, Paris, France 2 Département d’Etudes Cognitives, Ecole Normale Supérieure, Paris, France “Brian” is a simulator for spiking neural networks (http://www.briansimulator.org). The focus is on making the writing of simulation code as quick and easy as possible for the user, and on fl exibility: new and non-standard models are no more diffi cult to defi ne than standard ones. This allows scientists to spend more time on the details of their models, and less on their implementation. Neuron models are defi ned by writing differential equations in standard mathematical notation, facilitating scientifi c communication. Brian is written in the Python programming language, and uses vector-based computation to allow for effi cient simulations. It is particularly useful for neuroscientifi c modelling at the systems level, and for teaching Edited by: computational neuroscience. Jan G. Bjaalie, International Neuroinformatics Coordination Facility, Keywords: Python, spiking neural networks, simulation, teaching, systems neuroscience Sweden; University of Oslo, Norway Reviewed by: Eilif Muller, Ecole Polytechnique Fédérale de Lausanne, Switzerland INTRODUCTION takes considerably more time to write the code Nicholas T. Carnevale, Yale Computational modelling of neural networks than to run the simulations. Minimising learn- University School of Medicine, USA plays an increasing role in neuroscience research. ing and development time rather than simulation Örjan Ekeberg, Royal Institute of Technology, Sweden Writing simulation code from scratch (typically time implies different design choices, putting more in Matlab or C) can be very time-consuming and emphasis on fl exibility, readability, and simplicity * Correspondence: in all but the simplest cases requires expertise in of the syntax. programming and knowledge of neural simula- There are various projects underway to address tion algorithms. This can discourage researchers these issues. All of the major simulation pack- from investigating non-standard models or more ages now include Python interfaces (Eppler et al., complex network structures. 2008; Hines et al., 2009) and the PyNN project Several successful neural simulators already exist (Davison et al., 2008) is working towards provid- Dan F. M. Goodman obtained a degree (Brette et al., 2007), such as Neuron (Carnevale and ing a unifi ed interface to them. Because it is both in Mathematics from the University of Hines, 2006) and Genesis (Bower and Beeman, easy and powerful, Python is rapidly becoming Cambridge and a Ph.D. in Mathematics from the University of Warwick. 1998) for compartmental modelling, and NEST the standard high-level language for the fi eld of He is currently doing post-doctoral (Gewaltig and Diesmann, 2007) for large scale computational neuroscience, and for scientifi c research in Theoretical and Computational network modelling. These simulators implement computing more generally (Bassi, 2007). Neuroscience at the Ecole Normale computationally effi cient algorithms and are We took those approaches one step further by Supérieure in Paris. His research widely used for large-scale modelling and complex developing a new neural simulator, Brian, which interests are in the role of spike-timing based coding and computation, biophysical models. However, computational effi - is an extension package for the Python program- and neural simulation technologies. ciency is not always the main limiting factor when ming language (Goodman and Brette, 2008). At the moment, he is working on simulating neural models. Efforts have been made A simulation using Brian is a Python program developing spiking neural network in several simulators to make it as easy as possible, either executed from a script or interactively from models of sound localisation such as Neuron’s NMODL language described in a Python shell. The primary focus is on making and GPU-based parallel processing algorithms for Brian. Hines and Carnevale (2000) and graphical user the development of a model by the user as rapid [email protected] interface. In many practical cases; however, it still and fl exible as possible. For that purpose, the Frontiers in Neuroscience www.frontiersin.org September 2009 | Volume 3 | Issue 2 | 192 Goodman and Brette The Brian simulator models are defi ned directly in the main script in language that is both intuitive and well established, their mathematical form (differential equations and secondly, to let users defi ne models in a form and discrete events). This design choice addresses that is as close as possible to their mathemati- the three issues mentioned earlier: fl exibility, as the cal defi nitions. As in other simulation projects, user can change the model by changing the equa- we identifi ed Python as an ideal choice for the tions; readability, as equations are unambiguous programming language. Python is a well estab- and do not require any specifi c knowledge of the lished language that is intuitive, easy to learn Brian simulator to understand them; and simplic- and benefi ts from a large user community and ity of the syntax, as models are expressed in their many extension packages (in particular for sci- original mathematical form, with little syntax to entifi c computing and visualisation). While other learn that is specifi c to Brian. Computational effi - simulators use Python as an interface to lower ciency is achieved using vector-based computa- level simulation code, the Brian simulator itself tion techniques. is written in Python. The most original aspect We expect that the availability of this new tool of Brian is the emphasis on defi ning models as will have the strongest impact in two areas: fi rstly directly as possible by providing their mathemati- in systems neuroscience, by making it easy to cal defi nition, consisting of differential equations explore spiking models with custom architectures and discrete events (the effect of spikes) written in and properties, and secondly in teaching com- standard mathematical notation. One of the sim- putational neuroscience, by making it possible plest examples is a leaky integrate-and-fi re neu- to write the code for a functional neural model ron, which has a single variable V which decays within a single tutorial, and without strong pro- to a resting potential V0 over time according to τ − − gramming skills required. In this review, we start the equation dV/dt = (V V0). If this variable > by describing the core principles of Brian, then we reaches a threshold V VT the neuron fi res a discuss a few concrete examples for which Brian is spike and then resets to a value VR. If neuron i is particularly useful. Finally, we outline directions connected to neuron j with a synaptic weight Wij + for future research. then neuron i fi ring causes Vj to jump to Vj Wij. Brian can be downloaded from http:// This is represented in Brian with the following briansimulator.org. It is open source and freely code for a group of N neurons with all-to-all available under the CeCILL license (compatible connectivity: with the GPL license). equations = ‘‘’ THE SPIRIT OF BRIAN dV/dt = -(V-V0)/tau : volt The main goal of the Brian project is to minimise ‘’’ the development time for a neural model, and in G = NeuronGroup(N, equations, particular the time spent writing code, so that sci- threshold=’V>VT’, entists can spend their time on the details of their reset=’V=VR’) model rather than the details of its implementa- C = Connection(G, G, ‘V’) * Correspondence: tion. The development time also includes the time spent learning how to use the simulator. Ease of As can be seen in this code, the thresholding learning is important because it opens the pos- condition and the reset operation are also given sibility for people who would not previously have in standard mathematical form. In fact it is pos- considered computational modelling to try it out. sible to give arbitrary Python expressions for It is also helpful for teaching (see Teaching). More these, including calling user-defi ned functions. generally, it is desirable to minimise the time it This gives greater generality, but using only math- Romain Brette obtained a Ph.D. takes to read and understand someone else’s code. ematical expressions improves clarity. In addition in Computational Neuroscience from the Paris VI University in France. It helps peers to verify and evaluate research based to the mathematical defi nitions, the physical units He did post-doctoral studies in Alain on computational modelling, and it makes it eas- are specifi ed explicitly for all variables, enforc- Destexhe’s group in Gif-sur-Yvette ier for researchers to share their models. Finally, in ing dimensional consistency (here variable V has (France) and Wulfram Gerstner’s group order to minimise the time spent on writing code, units of volts). In order to avoid ambiguities and in Lausanne (Switzerland). the translation of the model defi nition into code make the code more readable, there is no stand- He is now an Assistant Professor of Computational Neuroscience should be as direct as possible. Execution speed ard scale for physical quantities (e.g. mV for volt- at Ecole Normale Supérieure, Paris. and memory usage of the code is also an issue, but ages) and the user provides the units explicitly. His group investigates spike-based only inasmuch as it puts a constraint on what can For example, the potential of the neurons is set to neural computation, theory and be done with it. It is therefore most important in −70 mV by writing G.V=-70*mV or equivalently simulation of spiking neuron models, G.V=-.07*volt. with a special focus on the auditory the case of large neural networks. system. These goals led us to make the following two Making differential equations the basis of [email protected] choices: fi rstly, to use a standard programming models in Brian may seem like a fundamental Frontiers in Neuroscience www.frontiersin.org September 2009 | Volume 3 | Issue 2 | 193 Goodman and Brette The Brian simulator Python restriction.