Running the script yourself gives you a figure at the end and no clue which step caused what. NeuroCode runs it step by step in a real Jupyter kernel, then hands each step — and the real state of your data after it — to an LLM that explains what changed and why that step belongs there. The model writes with the actual result in front of it, not a guess at what the code probably did.
A teaching tool for people learning EEG & fNIRS analysis. Bring your own Claude or Gemini key — everything else stays on your machine.
Free & open source · Built for learning · EEG · MEG · fNIRS
Steps are grouped by what they do, not one per line. Every one executes for real — the badges are read back out of the live objects, not guessed.
NeuroCode is a teaching tool first. It's built for students and early-career researchers who can run an MNE-Python script but aren't yet sure what each line is doing to their data — or why the order matters.
Start from a bundled example — EEG preprocessing, epoching, ERP, time–frequency, or the fNIRS chain — read what every step does at Novice depth, and ask follow-up questions on anything that doesn't land.
The pipeline you inherited that nobody remembers writing — run it and find out what it actually does before you trust its output.
You already know the analysis. Look up the MNE equivalent of the functions you use, and translate a script you've got.
Experienced users get use out of it too — but the explanations, the Novice / Intermediate / Expert control and the defaults are all tuned for learning, not for speed.
You could, and it will hand you code that looks right. The difference is what happens next.
The step executes in a real kernel before the LLM says a word. It writes with the actual result in front of it — the sampling rate, the filter band, the trials that survived rejection — read back by introspection. Same class of model, far better context.
No server, no upload, no account. What reaches the model is your source code and a short summary of the data's shape — sampling rate, channel count, filter band, trial count. Never the signal itself.
Explanations, edits and next-step suggestions are grounded in the code you already have and the state of the data at that point — so advice fits your pipeline, not a generic one.
The script from your lab that nobody remembers writing — run it and find out what it does, line by line.
“Band-pass 1–40 Hz and epoch around events.” “Add ICA to remove eye blinks.” Write from scratch or tweak in place.
Paste a .m script. Recognised pop_* /
hmrR_* calls are flagged with a confidence rating
before translating.
Works with EEG, MEG and fNIRS objects. Bundled examples use synthetic data, so they run instantly with nothing to download.
The explanations, the code generation and the legacy translation are all LLM-driven — but the model is kept on a short leash, and you own the key.
Every explanation is generated after the step executes, with the introspected data state in the prompt. Translation is anchored to a curated EEGLAB / Homer3 → MNE mapping table, and flags calls it can't map instead of inventing an answer.
NeuroCode auto-detects ANTHROPIC_API_KEY (Claude, default
claude-haiku-4-5) or GEMINI_API_KEY (Gemini,
default gemini-2.5-flash). Cheap, fast defaults; override
with NEUROCODE_MODEL. No NeuroCode account, no middleman
billing.
Your source code, plus a short JSON summary of the data's shape — sampling rate, channel count and the first few channel names, filter band, epoch count. The recordings themselves are never sent, and nothing goes anywhere else.
Without a key NeuroCode runs every step, plots every figure and reports the real data state — you just get templated text instead of written explanations. The kernel half needs no LLM at all.
Explanations are cached on disk keyed by model, level, code and data state. Re-running a script, or clicking back through steps, costs no API call and returns instantly — which matters on a free tier.
No signup, no hosted service — it starts a local server and opens your browser.
$ git clone https://github.com/ruixip/NeuroCode.git $ cd NeuroCode $ python3 -m venv .venv && source .venv/bin/activate $ pip install -e . $ neurocode # opens http://127.0.0.1:8765
To turn the explanations on, copy .env.example to
.env and paste in an ANTHROPIC_API_KEY or a
GEMINI_API_KEY — the provider is picked automatically. It's
optional; see above for what runs without one.
NeuroCode is under active development, with more updates on the way. It's early enough that your feedback genuinely changes what gets built next: what's confusing, what's missing, and what would make you reach for it while working with your own data.
Watch the repo on GitHub to hear about new releases.