A web version of an interactive visual neuron simulator

Interactive and explorable demonstrations of model neurons in the visual system can be useful in learning about the neurophysiology of vision. Here, I describe and show a web-based interactive simulation of the response properties of different model visual system neurons under various types of visual stimulation.

Quite a few years ago, I wrote a Python script that displayed an interactive simulation of various model visual system neurons and stimulus types for use within my undergraduate teaching. This worked well for in-person classes in university computer labs, but was difficult for students to review after class or run on their own computers. The shift to fully online delivery due to the COVID-19 pandemic meant that this code needed to be ported into a web platform if I was going to continue to use it in my teaching.

I used JavaScript and the canvas API to reimplement the functionality in a web platform. It was a challenge to shift in mindset from Python, but it was quite enjoyable to use JavaScript and I learned a lot along the way. Being able to run in the browser without any other setup is great, even though I did miss the familiarity with the 'ecosystem' that I had with Python after using it for so long.

All the functionality from the non-web version was able to be ported, with a few changes and improvements on the way. The neurons modelled in the simulator include centre-surround cells (ON-centre and OFF-centre) and simple and complex cells (of different phase, orientation, and spatial frequency selectivity). The visual stimulation types (probes) include a spot, a sinusoidal grating, a Hermann grid, and an image depicting a simultaneous contrast effect. Each of the probes was procedurally generated and could be manipulated in their position, size, wavelength, orientation, phase, and visibility. I also included the simulation of some 'mystery' cells, for which the receptive field profile was not displayed and the goal is to use the various probes to try and work out the cell type and characteristics.

You can have a go at the simulator below. Apologies that it isn't mobile friendly.

Instructions

You can control the simulation by using either the following keyboard shortcuts or by using the graphical controls that are found below the simulation.

Keyboard shortcuts for interacting with the simulation.
Key(s) Effect
1 / 2 Decrease / increase the size of the probe
3 / 4 Decrease / increase the probe's wavelength
5 / 6 Anti-clockwise / clockwise change in probe orientation
7 / 8 Decrease / increase the probe's phase
9 / 0 Decrease / increase the probe's opacity (visibility)
- Toggle whether the probe is 'locked' to the centre of the receptive field
= Toggle whether the probe is visible
p Moves between the different probe types
c Moves between the different cell types

Simulator

Simulator settings
Probe
Type
Properties
Cell
Type
? cell visibility