Try it in your browser: https://aeronite-p.github.io/Neuron-Lab/
An interactive 3D walkthrough of one action potential, from rest to the synapse, plus nine "what if" experiments. The visuals are driven by a Hodgkin–Huxley model running quietly in the background: the classic squid giant axon at 6.3 °C, slowed thousands of times (the app says so on screen, and the Math panel gives the mammalian values alongside).
-
Double-click
index.html. It works offline: no internet, no build step and no server needed. three.js and the Inter font are invendor/, inside the project. -
Or serve the folder:
python3 -m http.server 8771 --directory "$HOME/Personal Projects/neuron-firing"Then open http://localhost:8771.
| Where | What |
|---|---|
| Top bar | 10 stage steps: click one to jump. Explore opens the scenario menu, whose last row is Common myths (ten misconceptions, each with a "Show me" that jumps to the moment that disproves it). Math specifics opens the numbers panel; in the membrane stages it also holds a live trace of the voltage and the three gates. The gear holds settings: auto-advance, reduce motion, Graphics (High / Balanced, with an automatic switch to Balanced on a slow machine) and "Ask me before key moments" (a short prediction question before four stages, off by default). Help (?) lists the shortcuts and a Words list. |
| Left panel | Narration for the current stage. Read first, then play: each stage opens with its text easing into this card, a paragraph at a time, while the scene waits under a light dim; click the card (or Play this stage, Enter, →, or the scene) and the stage plays. A thin bar counts the reading time and plays the stage by itself. Settings (the sun icon) has the switch. Dotted terms show a one-line definition on hover or tap. In the membrane stages, a small "inside of the cell" meter shows the voltage in words, without numbers. Collapse it with the arrow. At the end of the tour a one-screen recap retells the ten stages. |
| Bottom bar | Restart, previous, play/pause, next, speed (0.25×, 0.5×, 1×), Fire again, reset camera, ion labels (an icon toggle). Every control has a tooltip with its shortcut. |
| Mouse | Drag to orbit, scroll to zoom. Both have limits so you can't get lost. |
| Key | Action |
|---|---|
| Space | Play or pause |
| ← / → | Previous or next stage (→ on a reading card starts the stage) |
| Enter | Play the stage after reading its text |
| R | Restart the tour |
| L | Ion labels on or off |
| M | Math specifics panel |
| P | Presenter mode: hides everything except a large title, a one-line caption and a control strip (sized for a projector) |
| N | Presenter notes: one talking point per stage, in presenter mode only |
| ? | Shortcut list |
| Esc | Close menus, or leave presenter mode |
All narration lives in js/narration.js:
NF.TEXT.stages: the 10 tour stages. Each has alabel(top bar),title,caption(the one-line presenter caption),body(2–4 sentences, HTML allowed, no digits), an optionalscaleline andmath(the Math panel content, the only place numbers appear).NF.TEXT.recap,NF.TEXT.myths,NF.TEXT.notes,NF.TEXT.predict: the end-of-tour recap, the Common myths list, the presenter notes and the prediction prompts.js/glossary.js: the 26 one-line definitions behind the dotted terms and the Help "Words" list.NF.TEXT.scenarios: the Explore menu entries (one-line descriptions).NF.TEXT.scn: each scenario's narration and Math panel content. A{{name}}placeholder is filled with live numbers from the model.
Color words in the text use classes that match the scene: <b class="na"> sodium (amber), class="k" potassium (cyan), class="ca" calcium (green).
index.html markup, CSS (design tokens at the top), boot script
vendor/ three.js r160 + addons bundled into one plain script (three-bundle.js, MIT,
LICENSE-three.txt), its sources (src/), the Inter font (fonts/, OFL)
js/model.js Hodgkin–Huxley model: single patch, unmyelinated and myelinated cables,
dendrite chain, drugs, temperature, stochastic channels, ATP ledger
js/narration.js every word on screen
js/scene.js renderer, restrained bloom, camera rig (log-scale zoom dives), materials
js/neuron.js procedural neuron (dendrites, soma, AIS, myelinated axon, terminals)
js/membrane.js lipid bilayer close-up, Na⁺/K⁺ channels with gates, the pump
js/ions.js ions: random walk, channel crossings, ion tags
js/synapse.js the synapse close-up (stage 10)
js/tour.js the stage controller and the app's main loop
js/explore.js the nine Explore scenarios
js/ui.js panels, menus, keyboard shortcuts, presenter mode, glossary card, recap, myths, notes
js/glossary.js the 26 plain-word definitions (dotted terms + the Help Words list)
js/trace.js the live gate trace inside the Math panel (runs only while the panel is open)
js/predict.js prediction moments (off by default; settings toggle)
favicon.svg the line-art mark used as favicon and load screen
tests/model.test.js 83 model checks (every number the narration states is pinned)
tools/ test and screenshot scripts (see below); vendor-three.js rebuilds vendor/
screenshots/ tour/, explore/, ui/ (night 1) and night2/ (every review set, before/after pairs,
compare.html built by tools/night2-compare.py)
PLAN.md, PROGRESS.md, DECISIONS.md, QUEUE.md, MORNING_REPORT.md, MORNING_REPORT_NIGHT2.md
The JS files are plain scripts, not modules. That is what lets index.html work from a double-click: browsers block local ES modules under file://. For the same reason three.js (pinned at three@0.160.0) is not loaded as modules: node tools/vendor-three.js downloads it once and turns it into one plain script, vendor/three-bundle.js, which sets window.THREE and NF.addons. The output is committed, so nothing is fetched at run time.
node tests/model.test.jsThis runs 83 checks. They cover:
- the rate functions against the spec's tabulated values
- rest at −65 mV, a +40 mV peak and a −76 mV undershoot
- rheobase and all-or-none firing
- no NaN at any time step
- squid-axon velocity, and myelinated beating unmyelinated
- demyelination, Uhthoff's phenomenon and 4-AP rescue
- refractory periods, TTX, TEA and lidocaine use-dependence
- hyperkalemia
- dendritic summation and shunting
- energy cost and channel noise
- every number the narration states (threshold, open fractions, Na⁺ entry after the peak, time constants, refractory periods, node spike width, EPSP size, the Hodgkin–Huxley Na⁺-entry benchmark)
These browser tests use playwright-core and the installed Google Chrome:
node tools/controls-test.jsThis one drives every button and shortcut, rapid jumping and a full auto-advance run.
node tools/explore-test.jsThis one runs every scenario, checks the outcome text and saves screenshots.
node tools/walkthrough.jsThis one plays the whole tour the way a viewer sees it, screenshots every 2.5 s into screenshots/wip/walk/ (plus contact sheets), and automatically checks for console errors, NaN, and ion labels that leave the screen or cover a panel. Set W=1280 H=800 to check a 13" laptop.
node tools/crossing-probe.jsThis one prints, every 0.25 s through stages 3–7, how many channels are open and how many ions are crossing (inward and outward Na⁺, K⁺), to check that crossings follow the channels; it also checks that the pump completes a cycle in stages 1 and 8 and waits during the spike.
node tools/shoot.js screenshots/wip tourThis one saves screenshots of each stage (shots mode runs a JSON list of page scripts; tools/night2-shots.sh <W> <H> <outDir> renders a whole review set: walkthrough, every scenario and every UI state at one size).
node tools/filmstrip.js 4 30 screenshots/wip/film/stage4.jpgThis one plays a stage (here stage 4 for 30 s) in real time, the way a viewer sees it, and saves one contact sheet of frames: the quickest way to judge whether a stage shows what it should. STEP sets the seconds between frames, FULL=1 keeps the text panel in frame.
The test tools run the tour with Read first switched off (tools/_noread.js), so their timings are the stages' own; controls-test.js checks the reading card itself.
node tools/engines-test.jsThis one opens the app offline (all network blocked) in Chrome, WebKit (Safari's engine) and Firefox, checks it starts, renders stage 4 and the console stays clean, and saves screenshots/night2/T4-01/engine_<name>_offline.jpg. Firefox prints one harmless three.js shader warning ("Output of vertex shader … not read by fragment shader"); the test allows exactly that line. WebKit and Firefox come from cd tools && npx playwright@1.48.2 install webkit firefox.
playwright-core lives in tools/node_modules (not committed). If it is missing:
cd tools && npm i playwright-core@1.48.2simulator/ holds a separate, more technical companion: a neuron simulator that runs in the browser on real reconstructed neuron shapes (up to 4,974 compartments). You place an electrode, add recording points and block channels. Its numbers are compared with NEURON, the standard research simulator, and the comparison is published with every result, including two tests that failed.
- Open it: https://aeronite-p.github.io/Neuron-Lab/simulator/, or double-click
simulator/index.html - What it claims and what it leaves out:
simulator/README.md - Every number:
simulator/VALIDATION.md
MIT, see LICENSE; it covers simulator/ too. The three neuron shapes in simulator/cells/ are from NeuroMorpho.Org under CC BY 4.0, with the citations listed in simulator/CELLS.md. The bundled three.js (vendor/LICENSE-three.txt, MIT) and Inter font (vendor/fonts/LICENSE.txt) keep their own licenses.
Created by Shiv Prahalathan · 2026