In vivo cell-attached recordings were performed using glass pipettes (∼5-7 MΩ) filled with solution containing the following (in mM): 125 NaCl, 5 KCl, 10 glucose, 10 HEPES, 2 CaCl2, 2 MgSO4, and 0.1 Alexa Fluor 594; pH 7.4). Signals were amplified using an AxoPatch 200B amplifier (Molecular Devices), filtered at 5 kHz, and digitized at 10 kHz. Spikes were recorded using current clamp mode. The frame trigger pulses of ScanImage 4.0 were also recorded and used offline to synchronize individual frames to electrophysiological recordings. After establishment of a low-resistance seal (15-50 MΩ), the orientation, spatial and temporal frequency of the stimuli was quickly optimized for individual neurons using recorded spikes. The optimal grating stimulus was repeated at a reduced contrast to maintain a moderate spiking rate.