title: Straight from the source: NEURON’s incredible backwards compatibility Date: 2015-10-26 00:37 Author: svenni Tags: Straight from the source, Technical Tags: C++, hoc, neuron, neuroscience, plot, plotting, Programming, vt100, vt125 Slug: straight-from-the-source-neurons-incredible-backwards-compatibility Status: published layout: post
NEURON is a neural simulator, but it’s not just another neural network application. NEURON has been around much longer than your fancy deep learning software. It was first released in 1994, although some of it’s early code and concepts seem to stem from the 70’s and 80’s. In fact, NEURON is not a machine learning library at all. It simulates real neurons. It uses real morphologies and ion channel densities to reproduce experiments. Some labs even use machine learning algorithms to fit the parameters of their NEURON models. NEURON is one of the workhorses of the computational branch of the Human Brain Project and the core engine in the Blue Brain Project.
But the age of NEURON is starting to show in its source code. Because some things are a bit awkward when working with this simulator[ref]One interesting NEURON feature is how deleting an object in its Python wrapper doesn’t delete the object in the engine, leaving all kinds of bugs ready to bite you two hours later.[/ref] I decided to peek at its sources. Just to see what this old engine looks like on the inside. And it turned out to be an interesting journey. Deep inside NEURON’s plotting library, I found this:
vtplot(mode, x, y);
Now, I didn’t know what VT125 was when I first saw this, but a quick search on the web reminded me that I’m still a young software developer. I present to you, the VT100:
[caption id=”attachment_1367” align=”aligncenter” width=”640”] I couldn’t find a good picture of the VT125. I apologize if it looks way more modern than its older cousin.[/caption]
Now that’s what I call backwards compatibility!
Some of you may want to lecture me about how modern terminals actually emulate VT100s and that this code might be in there to allow some fancy plotting inside xterm or its siblings. But I would argue that there are other parts of this code that give away its impressive attempt at supporting older platforms. Such as the rest of the above switch statement:
hoc_sunplot(&amp;amp;text, mode, x, y);
tplot(mode, x, y);
vtplot(mode, x, y);
Now, we all love nested preprocessor if-statements inside switch blocks, but let’s look aside from that and at what’s supported here.
There’s the NRNOC_X11, which I believe introduces the only part of this block that might actually be executed nowadays. In addition we have SUNCORE, which might be Solaris, but I’d bet this supports something that existed long before Oracle acquired Sun back in 2010. There’s TEK, which may refer to something like the Tektronix 4010:
[caption id=”attachment_1373” align=”aligncenter” width=”200”] This baby was made in 1972, but it still runs NEURON’s plotting functions. Just download the 5 MB zip-file of NEURON’s source code and … oh, wait.[/caption]
And then there’s NeXTstep, which Apple acquired in 1997 and used to replace its own Mac OS with Mac OS X. Considering that NeXTstep made its last official release in 1995, I think its fair to say that this piece of code was written in the previous century. It could, of course, just be that no one has deared to search-replace NeXTstep with OS X, but I doubt it.
I should finish this with a final caveat: It could be that this code isn’t at all in use by NEURON anymore. After all, I found all of the above in the plot.c file in thesrc/oc folder of NEURON’s source code. The above could be remainders of NEURON’s interpreter language, hoc, which was originally made as a demonstration of how to use the parser generator Yacc in the The Unix Programming Environment book. As far as I know, NEURON is the only software out there that’s still using hoc, but that’s a story for another day.