Learn to program by understanding the brain
A free, hands-on path from your first line of Python to building brain-computer interfaces and models of neurons. Real neural data from day one. No programming or neuroscience background required.
Why this exists
Modern AI was born from ideas about the brain, yet most machine learning engineers have never looked at a spike train, and most neuroscientists cannot write the code to analyse their own data. This site sits in that gap. It teaches neuroscience through code and code through neuroscience, and it starts from zero.
Real data, always
Every lesson uses actual recordings from published experiments, downloaded with one link. You never work with toy examples.
Code you write yourself
Each lesson is a script you build line by line, with the real output shown next to it. No hidden libraries doing the interesting parts.
A path, not a feed
Seven tracks, each building on the last. You always know where you are and what comes next.
The path
Work through the tracks in order, or jump in where your background puts you. Lessons are added roughly weekly.
flowchart TB F[1. Foundations] --> S[2. Signals] S --> D[3. Data] D --> M[4. Models] S --> B[5. Decoding and BCI] M --> B M --> N[6. Neuro meets AI] B --> P[7. Precision medicine] N --> P
- Foundations · Python for people who have never programmed, taught through neuroscience. Lessons 1 to 4 available.
- Signals · What EEG, spikes and fMRI actually measure, and the signal processing that makes them meaningful. Lessons 5 to 7 available.
- Data · Open datasets and file standards, and how to load, clean and share neural data reproducibly. Coming soon.
- Models · From one leaky neuron to Hodgkin-Huxley to spiking networks, each built from scratch. Coming soon.
- Decoding and brain-computer interfaces · Classify intention from neural signals, ending in a working BCI loop. Introduction available.
- Neuroscience meets AI · Deep networks as models of cortex, learning without backpropagation, neuromorphic hardware. Manifesto available.
- Precision medicine · Neural biomarkers, clinical machine learning, and how good models fail in hospitals. Coming soon.
Coming next: a deep-dive series rather than a survey, several lessons that stay with one problem and build it to completion. The first candidate is turning lesson 7‘s decoder into a working brain-computer interface, one piece per lesson.
Start here
New here? Read why every neuroscientist should learn to code first, then take the lessons in order. Lessons 1 to 4 are the Foundations track; lessons 5 to 7 are Signals.
Your first neuron in Python
Load a recording of 734 neurons, plot it, and build a working model neuron in thirty lines. Lesson 1.
Does this neuron care about the stimulus?
Align trials, build the field’s most important plot, and test which brain areas are listening. Lesson 2.
What did the mouse see? Your first neural decoder
Write a classifier from scratch and read the stimulus back out of 66 neurons. The first step toward a BCI. Lesson 3.
The shape of a population: your first PCA
Write PCA from scratch, find how many dimensions visual cortex uses, and watch a trial as a trajectory. Lesson 4.
From voltage to spikes: your first spike sorter
Ten seconds of raw Neuropixels voltage: filter it, find the spikes, sort them into neurons, and check your answer against a real spike sorter. Lesson 5, the start of the Signals track.
What the filter threw away: EEG, LFP and the Fourier transform
Build the Fourier transform from a dot product, reproduce Berger’s 1929 alpha rhythm on real EEG, and find theta in a mouse hippocampus. Lesson 6.
The brain getting ready to move: motor imagery and your first BCI signal
Align EEG to movement cues, measure the rhythm that switches off over motor cortex, and take a two-number decoder of imagined movement from chance to 84 percent with one spatial filter. Lesson 7.
Three short primers, for when a lesson leans on a method you have not met. Each one is introductory and runs on the same real data.
Primer: the generalised linear model
Why linear, logistic and Poisson regression are one model, and what it finds in a neuron that a tuning curve cannot.
Primer: independent component analysis
The cocktail party in two channels, FastICA in twenty lines, and eye blinks pulled out of real EEG.
Primer: Bayesian inference
Prior, likelihood, posterior on a grid; a belief that sharpens trial by trial; a decoder that says how sure it is.
About the author
I am Santosh Srinivasaiah, a Senior Lead Scientist working on precision medicine, brain-computer interfaces and semantic search. I spend my days translating between the people who study brains and the people who build software, and this site is the guide I wish had existed when I started. More about me and this site.
Latest writing
Notes at the intersection of software engineering and neuroscience.
The brain getting ready to move: motor imagery and your first BCI signal
Signals, lesson 7. Align 64-channel EEG to movement cues, measure event-related desynchronisation over motor cortex, map it, find the visual-alpha trap, and…
What the filter threw away: EEG, LFP and the Fourier transform
Signals, lesson 6. Build the Fourier transform from a dot product, write a power spectrum and a spectrogram in ten lines each,…
Primer: Bayesian inference
An introductory primer on Bayesian inference with real neural data: prior, likelihood and posterior on a grid, watching a belief about a…
Primer: independent component analysis
An introductory primer on ICA: the cocktail-party problem in two channels, how FastICA finds sources by non-Gaussianity (written from scratch in NumPy),…
Primer: the generalised linear model
An introductory primer on GLMs with real neural data: why linear, logistic and Poisson regression are one model, how to fit a…
From voltage to spikes: your first spike sorter
Signals, lesson 5. Ten seconds of raw Neuropixels voltage from a mouse brain: filter it, find the spikes, cut out their waveforms,…