Identifying the spatial and temporal features of neuronal population activity that drive perception is a key goal of sensory coding research. Here, the authors trained mice to discriminate between different ‘synthetic odours’ created by optogenetically activating olfactory bulb neurons in specific spatial and temporal patterns. Subsequent systematic variation of spatial or temporal aspects of the activation patterns allowed the authors to determine which features have the greatest influence on perception (assessed via task performance) and to generate a model that could replicate the behavioural responses to different activity patterns. The study reveals some key principles of olfactory coding and provides evidence for the importance of both the spatial and the temporal patterns of neuronal activation in perception.