a | Expression of optogenetic actuators such as channelrhodopsin 2 (ChR2) or NpHR in neurons leads to emergence of light-driven photocurrents, which can be recorded using the whole-cell patch clamp technique (left). Cells expressing chloride-conducting NpHR will show an outward current (top right, voltage clamp recording with cell resting at −70 mV) whereas cells expressing cation-conducting ChR2 will show an inward photocurrent (bottom right, voltage clamp recording with cell resting at −70 mV). b | Whole-cell current-clamp recordings in a neuron expressing excitatory ChR2, showing action potentials evoked by brief light pulses (blue bars). c | Hyperpolarization and silencing of spontaneously occurring action potentials in a neuron expressing eNpHR3.0. d | Extracellular recordings, coupled with local light delivery, used to reveal activity of neurons in vivo, using the awake behaving optrode configuration268. e | Raster plot showing action potentials (black dots) occurring rapidly after a 5-ms blue light pulse delivered into the target brain region. f | Raster plot showing activity of neurons expressing inhibitory anion-conducting GtACR2, showing increased inhibition of action potential firing with increasing light intensity. Part f is reprinted from REF.24, CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).