How should we define the penalties \(P_{spatial}(\mathbf {u})\)  and \(P_{temporal}(\mathbf {v})\) , along with the corresponding constraints \(c_{1}^k\)  and \(c_{2}^{k}\) ? The simplest option would be to use quadratic smoothing penalties; this would lead to a simple closed-form linear smoothing update for each \(\mathbf {u_k}\)  and \(\mathbf {v_k}\) . However, the signals of interest here have inhomogeneous smoothness levels — an apical dendrite might be spatially smooth in the apical direction but highly non-smooth in the orthogonal direction, and similarly a calcium signal might be very smooth except at the times at which a spike occurs. Therefore simple linear smoothing is typically highly suboptimal, often resulting in both undersmoothing and oversmoothing in different signal regions. We have found total variation (TV) [1]} and trend filtering (TF) [2]} penalties to be much more empirically effective. We let
\(P_{temporal}(\mathbf {v}) = \Vert  \mathbf {D}^{(2)} \mathbf {v}\Vert _1 = \sum _{t=2}^{T-1} |\mathbf {v}_{t-1} - 2 \mathbf {v}_{t} + \mathbf {v}_{t+1}|\) 
