Neuroscience
Model the electrical behaviour of neurons with Python. Build from neuron circuits and spiking models to synapses, networks, learning, and a complete spiking circuit.
What helps
Basic biology, algebra, and electrical circuit ideas help. Later models use differential equations, probability, and numerical integration.
Python pathway
Programming Foundations / Practice rooms / Track curriculum and enrollment
The Neuron as a Circuit
A neuron's membrane is a tiny electrical circuit: a capacitor (the lipid bilayer) in parallel with resistors (ion channels). Start from charge, capacitance, and Ohm's law, build the exponential dynamics that follow, then integrate them numerically to simulate a passive membrane responding to injected current. This is the foundation every neuron model is built on.
- The Membrane Capacitor: 5 lessons
- The Leak: Resistance and Current: 5 lessons
- Exponential Dynamics: 5 lessons
- Simulating with Euler: 5 lessons
- The Passive Membrane: 5 lessons
The Integrate-and-Fire Neuron
Add one rule to the passive membrane and it becomes a spiking neuron: when the voltage reaches a threshold, fire a spike and reset. The leaky integrate-and-fire (LIF) neuron is the workhorse of computational neuroscience. Build it, measure its firing-rate response to current (the F-I curve), add a refractory period, and quantify spike-train irregularity. Units here are mV, ms, nA, and megaohms, so R times I is a voltage in mV.
- The LIF Equation: 5 lessons
- Spikes and Trains: 5 lessons
- The F-I Curve: 5 lessons
- The Refractory Period: 5 lessons
- Noise and Variants: 5 lessons
The Hodgkin-Huxley Neuron
Build the classical squid-axon model from voltage-dependent channel rates, gates and ionic currents. Advance all four state variables from the same old state, then inspect simulated spikes and firing responses. These are numerical model outputs, not measurements of living tissue.
- Gating Rate Functions: 5 lessons
- Gate Dynamics: 5 lessons
- Channels and Currents: 5 lessons
- The Full Model: 5 lessons
- Spike Properties: 5 lessons
Synapses
Build conductance-based synaptic currents, decaying gates, summed inputs and short-term resource dynamics. Separate the direction of voltage movement from the effect on spiking: inhibitory conductance may act by shunting, even without hyperpolarizing below rest.
- The Synaptic Current: 5 lessons
- Synaptic Kinetics: 5 lessons
- Excitation and Inhibition: 5 lessons
- Summation and Integration: 5 lessons
- Short-Term Plasticity: 5 lessons
Networks of Neurons
Represent connectivity with weight matrices and evolve recurrent firing-rate models. Measure population activity and E-I interactions while distinguishing finite-time diagnostics from mathematical guarantees of convergence or stability.
- Connections and Weights: 5 lessons
- Firing-Rate Dynamics: 5 lessons
- Excitation, Inhibition, Stability: 5 lessons
- Population Activity: 5 lessons
- Network Dynamics: 5 lessons
Plasticity and Learning
Implement Hebbian, Oja, STDP, covariance and BCM learning rules, then examine clipping, normalization and homeostatic updates. Finish with a sequential Oja learner and an explicit final normalization; convergence depends on inputs and step size.
- Hebbian Learning: 5 lessons
- Keeping Weights Stable: 5 lessons
- Spike-Timing-Dependent Plasticity: 5 lessons
- Rate-Based Learning: 5 lessons
- Homeostasis and an Oja Learner: 5 lessons
Neural Coding
Measure firing rates, build tuning curves and encode stimuli with a population. Distinguish exact Poisson count sampling from the one-event-per-bin approximation used for binary spike trains, and quantify finite-sample variability.
- Firing-Rate Codes: 5 lessons
- Tuning Curves: 5 lessons
- Poisson Spiking: 5 lessons
- Variability: 5 lessons
- Encoding a Stimulus: 5 lessons
Decoding and Information
Compare center-of-mass, direction-vector, likelihood and linear decoders. Make model assumptions explicit, measure information and discrimination, and fit a linear decoder on training counts before evaluating separate held-out responses.
- Population Decoding: 5 lessons
- Maximum-Likelihood Decoding: 5 lessons
- Discrimination: 5 lessons
- Information Theory: 5 lessons
- Linear Decoding: 5 lessons
Dynamics and Models
Study FitzHugh-Nagumo and Wilson-Cowan dynamics, synchronous Hopfield recall, and bounded noisy evidence accumulation. Use traces and diagnostics to distinguish a stable state from a cycle, and a completed decision from a timeout.
- The FitzHugh-Nagumo Model: 5 lessons
- The Phase Plane: 5 lessons
- Wilson-Cowan Dynamics: 5 lessons
- Attractor Memory: 5 lessons
- Decision Making: 5 lessons
Capstone: A Spiking Circuit
Assemble a NumPy spiking circuit from vectorized LIF cells, decaying synaptic conductances, directed weights, tuned input and a count readout. Compare the zero-coupling baseline with a coupled circuit, then measure decoding error from the resulting spike raster.
- A Population of Neurons: 5 lessons
- Coupling the Neurons: 5 lessons
- Inputs and Wiring: 5 lessons
- Running the Circuit: 5 lessons
- Reading Out the Circuit: 5 lessons