Page 1 of 1

Running NEURON tutorials on webpage

Posted: Sun Mar 05, 2017 1:27 pm
by bll5z6
Hey everyone,

Our lab uses some tutorials we developed with NEURON to teach undergraduate neuroscience. We also disseminate these tutorials to other instructors. The tutorials are very popular because they are interactive i.e. they allow students to "block" sodium channels and see the effect on currents and membrane potential, for instance.

We would like these tutorials to be available in a sort of web-based interactive form so that students can simply visit a website and interact with them instead of needing to download NEURON and compile the .mod files. Alternatively, being able to generate an .exe would be another option.

Does anyone know the best way to do this conversion? We don't really have experience in web programming so I'm not sure what the standard is for developing interactive web-based tutorials. Any pointers would be greatly appreciated!


Re: Running NEURON tutorials on webpage

Posted: Fri Mar 10, 2017 10:34 am
by ramcdougal
Sounds like a great project!

There are two main approaches that I'm aware of for sharing interactive NEURON simulations on the web:

Approach 1: Jupyter notebook, GitHub, and

Jupyter notebook provides a rich web-based approach for running Python programs, including NEURON. Put the bulk of the code in a file you import and use Jupyter's widgets and matplotlib-based graphics (PyNeuron-Toolbox can help by providing shape-plot like functionality) to allow interactively triggering simulations and exploring the results.

If you share your code in GitHub, you can then use to run it. If reliability is important ( is a free service by a biology research lab not a company), they provide instructions for creating your own version to host locally.

Williams et al 2016 used this strategy (without the widgets and with prominent code visibility) by sharing their NEURON code on GitHub (see, e.g. this file) which when mybinder is available can be run at: ... -Transport. (Warning: at the time of writing this post, deploying mybinder solutions is down; you can check the status of mybinder.)

A strength of this approach is that users have full access to NEURON (in a container, so they can't corrupt your system or anyone else's experience) and can explore anything they want by creating a new cell in Jupyter and running arbitrary Python code.

Approach 2: Custom web interface

Alternatively, we have experimented with building custom interfaces for models; see the picture below.

The nice thing about this approach is that (1) you have full control over how things look and can use the latest approaches such as webgl (which enables the rotatable and zoom-able mitral cell here) and can make sure things look great on both mobile and desktop, and (2) you can cleanly separate the science (whatever your interface allows them to do) from the code.

The downsides: (1) you need to know a little about jQuery and websockets, (2) you need to have a server that you control and can run arbitrary Python services on.


Re: Running NEURON tutorials on webpage

Posted: Wed Mar 22, 2017 9:31 am
by bll5z6
Thank you for the information! I think what I'm looking for is closer to the second approach. Do you know of any resources for learning about jquery & websockets as they relate to making an interactive web page like you describe?

Re: Running NEURON tutorials on webpage

Posted: Thu Aug 22, 2019 1:20 pm
by rgerkin
What is the status of this? I have students copying/pasting from ... steps.html into Jupyter notebooks on our lab JupyterHub and it seems to work great. But just converting this directly to a notebook would be better. Has anyone done this?

Re: Running NEURON tutorials on webpage

Posted: Thu Aug 29, 2019 10:45 am
by ramcdougal
We've started a process of redoing those tutorials, which are pretty old.

The new versions use more modern idioms and come as Jupyter notebooks.

We haven't moved these to the website because we don't have a full replacement, but here's a few: ... rial.ipynb ... sics.ipynb ... ck-1.ipynb

There's nothing about using the plot method of RangeVarPlots and ShapePlots for plotting to Matplotlib/bokeh (bokeh is supported by RangeVarPlots only at this time). That's probably a better way to do things than using gui2.

We cover essentially the content of that tutorial as an interactive session every year during the NEURON courses, so it should not be that hard to turn those notebooks into a web tutorial...

Re: Running NEURON tutorials on webpage

Posted: Thu Sep 05, 2019 6:13 pm
by rgerkin
Awesome, thanks Robert! Do you think these could be moved to a "NEURON-tutorials" GitHub repo? Then I could git clone whatever was in there everytime I build my server for teaching, and also submit PRs if I see potential improvements. I could set it up and then transfer ownership if you'd like. You can email me (rgerkin at asu dot edu) if you want to discuss further.