  Optical imaging of genetically encoded calcium indicators is a powerful tool
to record the activity of a large number of neurons simultaneously over a long
period of time from freely behaving animals. However, determining the exact
time at which a neuron spikes and estimating the underlying firing rate from
calcium fluorescence data remains challenging, especially for calcium imaging
data obtained from a longitudinal study. We propose a multi-trial time-varying
$\ell_0$ penalized method to jointly detect spikes and estimate firing rates by
robustly integrating evolving neural dynamics across trials. Our simulation
study shows that the proposed method performs well in both spike detection and
firing rate estimation. We demonstrate the usefulness of our method on calcium
fluorescence trace data from two studies, with the first study showing
differential firing rate functions between two behaviors and the second study
showing evolving firing rate function across trials due to learning.
