Reading population codes: a neural implementation of ideal observers