Using two-photon optogenetics, electrical recordings and sparse signal reconstruction, the authors demonstrate in vivo synaptic connectivity mapping in the mouse visual cortex.