Ever heard of the computer programming language called Python? Where do you think Python got its name from?
Monty Python!
Python programming has had an increasing effect on neuroscientific developments. In fact, with the growing field of computational neuroscience, Python programming has taken a role in how neuroscience research occurs.
Python itself is a high-level programming language. Its syntax is relatively straightforward, as one of its main philosophies is code readability. Therefore, coders can use fewer lines of code than they would in other programming languages.
In neuroscience, python is used in data analysis and simulation. Python is ideal for neuroscience research because both neural analysis and simulation code should be readable and simple to generate and execute. Further, it should be understandable xx time later, by xx people reading the code. That is, it should be timeless and should make sense to anyone who reads the code and tries to execute or replicate it.
Of course, MATLAB is good for neuroscience research purposes, but MATLAB is a closed-source, expensive product, where python is open-source and more readily available to the masses. In fact, you can download Python here. Further, there are a number of courses that can help a dedicated learner teach themselves Python.
Python also has science packages that allow for systems like algebra, packages specifically for neural data analysis and simulation packages to describe neuronal connectivity and function. Python can even be used for database management, which may be important when there are large amounts of data belonging to a given laboratory. Because Python combines features from other languages, it can be used in foreign code and other libraries beyond the ones it was developed in. This allows for effective sharing and collaboration between laboratories. SciPy is “a collection of open source software for scientific computing in Python.”
In relation to neuronal simulations, Python make sense because:
1. It is easy to learn. This is because is has a clear syntax, is an interpreted language (meaning the code is interactive and provides immediate feedback to the coder), and lists/dictionaries are built into the program itself.
2. It has a standard library, which therefore provides built-in features important for data processing, database access, network programming and more.
3. It is easy to interface Python with other programming languages, which means that a coder can develop an interface in Python, and then implement it in other fast programming languages, such as C and C++.
An example of Python being used as a neuronal simulator is NEURON. An example of code is the following:
>>> from neuron import h
>>> soma = h.Section()
>>> dend = h.Section()
>>> dend.connect(soma, 0, 0)
>>> soma.insert(’hh’)
>>> syn = h.ExpSyn(0.9, sec=dend)
(taken from Davison, et al., 2009).
Here, a neuron is “built”, with a dendrite, soma, dendrite all “created”, as well as channels. It is clear, then, how simple and straightforward Python code is, and how important it can then be in neuroscience.