Python for large-scale electrophysiology
Department of Mathematical Sciences and Technology, Norwegian University of Life Sciences, Ås, Norway
A commentary on
Python for large-scale electrophysiology
by Martin Spacek, Tim Blanche and Nicholas Swindale
Researchers changing scientific fields are often surprised to discover how different the cultures in their new and old fields are. While the neuroscience culture is vibrant and stimulating in many ways, neuroscience is not a field with the strongest tradition for sharing or division of labor. In physics there has effectively been a division of labor between experimentalists and modelers for about 100 years. It was realized that it is simply too difficult for a single person or a single research group to master all techniques necessary to do the best science. Ever since, experimentalists and modelers have happily shared credit and Nobel prizes for discoveries that have only been made possible by their joint collaborative efforts. The World Wide Web was invented at CERN in Switzerland to allow for efficient sharing of the large amounts of data generated by this international particle-physics research facility.
A traditional neuroscience laboratory has been a more self-contained entity. Data has been recorded and analyzed within the group, typically with tools bought from a commercial vendor or made as side projects by the group members themselves, all under the guidance and control of a single laboratory leader. Similar to how we may imagine the operation of a 19th century physics laboratory.
But things are slowly changing also in our community. Public databases of neurobiological data have been established, the most famous probably being the Allen Brain Atlas
1
set up by the philanthropist of Microsoft wealth. The Organisation for Economic Co-operation and Development (OECD) even concluded that neuroinformatics is so important that it established the International Neuroinformatics Coordinating Facility (INCF)
2
in 2005 in order to promote a coordinated global development of this new field, and the open-access Frontiers Journal Series with an aim to facilitate better scientific communication between researchers was recently established with neuroscience as the pioneering field. Further, due to persistent efforts by enthusiastic individuals, neuroscientists have for 20 years or so already enjoyed free access to neural simulators such as NEURON
3
and Genesis
4
, tailor-made for biophysically detailed neuron modeling. Lately, simulators such as NEST
5
, optimized for simulations of large neuronal networks, have been added to the pool of free public resources. The use of these simulators is now an integral part of the curriculum at several research schools, further contributing to the fostering of a more cohesive research community, particularly within computational neuroscience.
Free software packages tailored for experimental neuroscientists have been scarcer, and the three new packages described in the paper by Spacek et al. (2009)
are thus most welcome. The packages, all developed to suit needs in the authors’ laboratory, are used for (i) generation of visual stimuli for in vivo recordings, (ii) visualization of extracellular potentials recorded by silicon multielectrodes and spike-sorting based on such data, and (iii) analysis of the extracted spike trains.
All software packages were made using the Python programming language
6
, and the paper of Spacek and collaborators was part of a recent special-topic issue on “Python in neuroscience” in Frontiers in Neuroinformatics. Python appears to be the new programming language of choice in many communities both inside and outside science. For outsiders the shift towards a new programming language, Python in this case, may sometimes appear to be faddish and have elements akin to a religious revival. However, Python appears to have qualities that likely will lead to a further strengthening of its position in the years to come.
For one it is “open source,” so unlike for products from commercial competitors like MATLAB, one doesn’t have to worry about licensing costs. Like the operating system Linux, or scientific knowledge for that matter, Python is largely developed by dedicated individuals who are standing on each other’s shoulders. Already a large number of Python packages have been made available, and Spacek and his collaborators say that they in fact were introduced to Python via one of its many packages. But such sharing is not unique to Python. What makes Python stand out from the crowd is that it has a clear and simple syntax which, according to the authors, “fits your brain.” The first author even states in the paper that for his part “the switch to Python has made programming a much more enjoyable and productive experience, and has resulted in greatly improved programming skills.”
The requirements for the three packages developed by Spacek and collaborators differed greatly. The visual stimulus package required, for example, real-time control over the display monitor and communication via a digital output board, controlled by specific drivers, between the stimulus and acquisition computers. The package visualizing extracellular waveforms required construction of a comprehensive graphical user interface, while the spike-train analysis package required access to efficient numerical routines established by the scientific computation community. The authors nevertheless found Python to be well suited for all three.
In the final paragraph of their paper, Spacek and collaborators trumpet: “We encourage others in neuroscience to consider Python for their programming needs(…). Rallying around a common open-source language may help foster efforts to increase sharing of data and code, efforts deemed necessary to push forward progress in systems neuroscience.” It is likely that more of us will unite behind this rallying cry as we all, experimentalists and modelers alike, realize that a closer collaboration is needed to move our science forward. We will have more fun as well.
Maybe a scientist switching to neuroscience from another field in, say, 10 or 20 years will be pleasantly surprised to discover how vigorously and efficiently we collaborate?