a, Whole-cell current-clamp recordings from ChR2–YFP-positive neurons in vitro demonstrate normal current–firing relationships consistent with direct-pathway (red traces) and indirect-pathway (green traces) MSNs (D1-control, n = 10; D1-ChR2, n = 3; D2-control, n = 7; D2-ChR2, n = 3). b, Firing rate plotted as a function of injected current in direct- and indirect-pathway MSNs expressing either green fluorescent protein or ChR2–YFP. c, ChR2-mediated photocurrents (top) and spiking (bottom) in direct-pathway (left) and indirect-pathway (right) MSNs. In this and subsequent panels, blue bars indicate illumination time. d, Summary of ChR2-mediated photocurrents (left) and spiking (right) for D1-ChR2 (n = 5) and D2-ChR2 (n = 4) cells. e, Schematic of in vivo optical stimulation and recording in the striatum. f, Example MSN recorded from the striatum of an anaesthetized D1-ChR2 mouse that showed increased firing in response to illumination. Insets in f, g, j and k show spike waveforms with (blue) or without (grey) illumination. Scale bars apply to insets in f, g, j and k. g, Example of a light-sensitive MSN from a D2-ChR2 mouse. h, Normalized change in MSN firing rates in response to striatal illumination in D1-ChR2 (n = 16) and D2-ChR2 (n = 10) mice. Pre, before illumination; laser, during illumination; post, after illumination. i, Schematic of in vivo optical stimulation in striatum and recording in SNr. j, Example of a SNr neuron recorded from a D1-ChR2 mouse that was inhibited by direct-pathway activation. k, Example of a SNr neuron recorded from a D2-ChR2 mouse that was excited by indirect-pathway activation. l, Normalized change in SNr firing rate in response to activation of the direct (D1, n = 8) or indirect (D2, n = 4) pathways. *P < 0.05; error bars, s.e.m.