A neural network implementing optimal state estimation based on dynamic spike train decoding