Efficient computation of the maximum a posteriori path and parameter estimation in integrate-and-fire and more general state-spa