Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Detecting and correcting false transients in calcium imaging


Population recordings of calcium activity are a major source of insight into neural function. Large datasets require automated processing, but this can introduce errors that are difficult to detect. Here we show that popular time course-estimation algorithms often contain substantial misattribution errors affecting 10–20% of transients. Misattribution, in which fluorescence is ascribed to the wrong cell, arises when overlapping cells and processes are imperfectly defined or not identified. To diagnose misattribution, we develop metrics and visualization tools for evaluating large datasets. To correct time courses, we introduce a robust estimator that explicitly accounts for contaminating signals. In one hippocampal dataset, removing contamination reduced the number of place cells by 15%, and 19% of place fields shifted by over 10 cm. Our methods are compatible with other cell-finding techniques, empowering users to diagnose and correct a potentially widespread problem that could alter scientific conclusions.

This is a preview of subscription content, access via your institution

Access options

Rent or buy this article

Get just this article for as long as you need it


Prices may be subject to local taxes which are calculated during checkout

Fig. 1: False transients occur and can interfere with scientific conclusions.
Fig. 2: Quantitative metrics for evaluating transients.
Fig. 3: Geometric intuition for the proposed solution.
Fig. 4: Explicit model of unexplained fluorescence.
Fig. 5: SEUDO performance on a full population of sources.
Fig. 6: SEUDO can correct errors affecting scientific results.

Data availability

The data that support the findings of this study, including the CA1 raw imaging data, identified source profiles and time traces from automated cell-finding algorithms and manual annotations of transients, are available on the Open Science Framework at

Code availability

All algorithms described are available in a MATLAB-based software suite. The software also includes several graphical user interfaces (GUIs) to facilitate visualization and parameter optimization. For example, one GUI displays transients for manual classification (Extended Data Fig. 2). Users can also interact with this GUI to specify which transients are true, false or mixed or identify artifact sources. Other GUIs (not shown) facilitate comparing different sets of parameters to optimize performance. All software is available under the MIT license and can be downloaded from


  1. Denk, W., Strickler, J. H. & Webb, W. W. Two-photon laser scanning fluorescence microscopy. Science 248, 73–76 (1990).

    Article  CAS  PubMed  Google Scholar 

  2. Dombeck, D. A., Khabbaz, A. N., Collman, F., Adelman, T. L. & Tank, D. W. Imaging large-scale neural activity with cellular resolution in awake, mobile mice. Neuron 56, 43–57 (2007).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  3. Pachitariu, M. et al. Suite2p: beyond 10,000 neurons with standard two-photon microscopy. Preprint at bioRxiv (2016).

  4. Dana, H. et al. Thy1-GCaMP6 transgenic mice for neuronal population imaging in vivo. PLoS ONE 9, e108697 (2014).

    Article  PubMed  PubMed Central  Google Scholar 

  5. Madisen, L. et al. Transgenic mice for intersectional targeting of neural sensors and effectors with high specificity and performance. Neuron 85, 942–958 (2015).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  6. Chen, T.-W. et al. Ultrasensitive fluorescent proteins for imaging neuronal activity. Nature 499, 295–300 (2013).

    PubMed  PubMed Central  Google Scholar 

  7. Badura, A., Sun, X. R., Giovannucci, A., Lynch, L. A. & Wang, S. S. H. Fast calcium sensor proteins for monitoring neural activity. Neurophotonics 1, 025008 (2014).

    Article  PubMed  PubMed Central  Google Scholar 

  8. Song, A. et al. Volumetric two-photon imaging of neurons using stereoscopy (vTwINS). Nat. Methods 14, 420–426 (2017).

    Article  PubMed  PubMed Central  Google Scholar 

  9. Dombeck, D. A., Graziano, M. S. & Tank, D. W. Functional clustering of neurons in motor cortex determined by cellular resolution imaging in awake behaving mice. J. Neurosci. 29, 13751–13760 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  10. Mukamel, E. A., Nimmerjahn, A. & Schnitzer, M. J. Automated analysis of cellular signals from large-scale calcium imaging data. Neuron 63, 747–760 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  11. Giovannucci, A. et al. CaImAn: an open source tool for scalable calcium imaging data analysis. eLife 8, e38173 (2019).

    Article  PubMed  PubMed Central  Google Scholar 

  12. Mishne, G., Coifman, R. R., Lavzin, M. & Schiller, J. Automated cellular structure extraction in biological images with applications to calcium imaging data. Preprint at bioRxiv (2018).

  13. Dombeck, D. A., Harvey, C. D., Tian, L., Looger, L. L. & Tank, D. W. Functional imaging of hippocampal place cells at cellular resolution during virtual navigation. Nat. Neurosci. 13, 1433–1440 (2010).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  14. Lecoq, J. et al. Visualizing mammalian brain area interactions by dual-axis two-photon calcium imaging. Nat. Neurosci. 17, 1825–1829 (2014).

    Article  PubMed Central  Google Scholar 

  15. Kerr, J. N., Greenberg, D. & Helmchen, F. Imaging input and output of neocortical networks in vivo. Proc. Natl Acad. Sci. USA 102, 14063–14068 (2005).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  16. Harris, K. D., Quiroga, R. Q., Freeman, J. & Smith, S. L. Improving data quality in neuronal population recordings. Nat. Neurosci. 19, 1165–1174 (2016).

    PubMed Central  Google Scholar 

  17. Malik, W. Q., Schummers, J., Sur, M. & Brown, E. N. Denoising two-photon calcium imaging data. PloS ONE 6, e20490 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  18. Gauthier, J. L. & Tank, D. W. A dedicated population for reward coding in the hippocampus. Neuron 99, 179–193 (2018).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  19. Pnevmatikakis, E. A. et al. Simultaneous denoising, deconvolution, and demixing of calcium imaging data. Neuron 89, 285–299 (2016).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  20. Peron, S. P., Freeman, J., Iyer, V., Guo, C. & Svoboda, K. A cellular resolution map of barrel cortex activity during tactile behavior. Neuron 86, 783–799 (2015).

    Article  CAS  PubMed  Google Scholar 

  21. O’Keefe, J. Place units in the hippocampus of the freely moving rat. Exp. Neurol. 51, 78–109 (1976).

    Article  PubMed  Google Scholar 

  22. Henriksen, E. J. et al. Spatial representation along the proximodistal axis of CA1. Neuron 68, 127–137 (2010).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  23. Inan, H., Erdogdu, M. A. & Schnitzer, M. Robust estimation of neural signals in calcium imaging. In Advances in Neural Information Processing Systems (eds Guyon, I, et al.) 2905–2914 (NIPS, 2017).

  24. Petersen, A., Simon, N. & Witten, D. SCALPEL: extracting neurons from calcium imaging data. Ann. Appl. Stat. 12, 2430–2456 (2018).

    Article  PubMed  PubMed Central  Google Scholar 

  25. Martinez-Cantin, R. BayesOpt: a Bayesian optimization library for nonlinear optimization, experimental design and bandits. J. Mach. Learn. Res. 15, 3735–3739 (2014).

    Google Scholar 

  26. McCoy, M. B. & Tropp, J. A. Sharp recovery bounds for convex demixing, with applications. Found. Comput. Math. 14, 503–567 (2014).

    Article  Google Scholar 

  27. Hill, D. N., Mehta, S. B. & Kleinfeld, D. Quality metrics to accompany spike sorting of extracellular signals. J. Neurosci. 31, 8699–8705 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  28. Won, D. S., Chong, D. Y. & Wolf, P. D. Effects of spike sorting error on information content in multi-neuron recordings. In First International IEEE EMBS Conference on Neural Engineering 618–621 (IEEE, 2003).

  29. Ecker, A. S. et al. Decorrelated neuronal firing in cortical microcircuits. Science 327, 584–587 (2010).

    Article  CAS  PubMed  Google Scholar 

  30. Cohen, M. R. & Kohn, A. Measuring and interpreting neuronal correlations. Nat. Neurosci. 14, 811–819 (2011).

    PubMed Central  Google Scholar 

  31. Pillow, J. W., Shlens, J., Chichilnisky, E. & Simoncelli, E. P. A model-based spike sorting algorithm for removing correlation artifacts in multi-neuron recordings. PloS ONE 8, e62123 (2013).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  32. Keemink, S. W. et al. FISSA: a neuropil decontamination toolbox for calcium imaging signals. Sci. Rep. 8, 3493 (2018).

    Article  PubMed  PubMed Central  Google Scholar 

  33. Bioucas-Dias, J. M. et al. Hyperspectral unmixing overview: geometrical, statistical, and sparse regression-based approaches. IEEE J. Sel. Top. Appl. Earth Obs. Remote Sens. 5, 354–379 (2012).

    Article  Google Scholar 

  34. Rickgauer, J. P., Deisseroth, K. & Tank, D. W. Simultaneous cellular-resolution optical perturbation and imaging of place cell firing fields. Nat. Neurosci. 17, 1816–1824 (2014).

    Article  PubMed Central  Google Scholar 

  35. Tibshirani, R. Regression shrinkage and selection via the lasso. JR Stat. Soc. Series B Methodol. 58, 267–288 (1996).

  36. Becker, S. R., Candès, E. J. & Grant, M. C. Templates for convex cone problems with applications to sparse signal recovery. Math. Program. Comput. 3, 165 (2011).

    Article  Google Scholar 

Download references


We thank L. Meshulam, P.D. Rich, A. Giovannucci and E. Pnevmatikakis for helpful comments on the manuscript and M. Lewis for developing the SEUDO acronym. J.L.G. was funded by NIH NRSA 1F32NS077840-01A1. A.S.C. was supported by the NIH BRAIN Initiative (R01 MH115750). J.W.P. was supported by grants from the Simons Collaboration on the Global Brain (SCGB AWD543027), the NIH BRAIN Initiative (R01 MH115750) and a U19 NIH–NINDS BRAIN Initiative award (5U19NS104648). D.W.T. was supported by grants from the Simons Collaboration on the Global Brain (SCGB 328057) and a U19 NIH–NINDS BRAIN Initiative award (5U19NS104648).

Author information

Authors and Affiliations



J.L.G. and A.S.C. developed and applied analysis methods; J.L.G., S.A.K. and E.H.N. performed imaging experiments; all authors wrote the paper.

Corresponding authors

Correspondence to David W. Tank or Adam S. Charles.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review

Peer review information

Nature Methods thanks Philipp Berens and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Primary Handling Editor: Nina Vogt, in collaboration with the Nature Methods team.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Extended data

Extended Data Fig. 1 Example classified transient profiles for a single source from mouse CA1 found using CNMF.

Each panel is titled with the Pearson correlation between the source profile and transient profile.

Extended Data Fig. 2 User interface for manual classification of transients.

For detailed description, see software documentation in the GIT repository

Extended Data Fig. 3 Comparison of manual annotation for two graders on the same 1,834 transients.

Confusion matrices showing the number of transients graded in different ways by each reviewer (left) and the total percentage of transients in each bin (right).

Extended Data Fig. 4 Algorithm to classify transients as true or false using the spatial Ljung-Box quartile test instead of the correlation metric.

A: Schematic for how the transient profile residual autocorrelation is computed. B: Two example transients, shown to illustrate difference in residual for true and false transients. C: Classification of four example transients using the LBQ test. D: Results of the LBQ test on transients classified by human expert. Left: Results of the test applied to true and false transients for various values of α. Right: Results of the test applied to all four transient types.

Extended Data Fig. 5 Effect of SEUDO parameters.

A: Activity estimated by SEUDO and least squares for one true transient (top row) and one false transient (bottom row) using several types of estimation (column labels). Images and traces show estimated amplitude of the source profile (green) and sum of fitted Gaussian kernels (magenta). B: Sum of activity ascribed to the source profile (green) and Gaussian kernels (magenta) for the true transient (left) and the false transient (right). Each subplot shows results for one set of parameters. Roman numerals indicate parameter regimes shown in A.

Extended Data Fig. 6 Performance of SEUDO as σ2 was varied over three orders of magnitude, for the same sources and quantified in the same way as in Fig. 5c.

Each subplot shows performance for the value of σ2 indicated in the title and the shown values of λ (green points). Also plotted for comparison are the collection of points taken from all subplots (gray points).

Extended Data Fig. 7 Removing false transients can impact global summaries of activity.

Here, time courses were sorted into 5 clusters using K-means (best clustering over 50 random seeds). A-B: SEUDO time courses were more highly consolidated (that is, fewer clusters contained more of the neurons) as compared to the time-traces with contamination. C: A confusion matrix depicts that a small number of cluster relabelings accounted for much of the changes in SEUDO time courses.

Supplementary information

Supplementary Information

Supplementary Figs. 1–18 and Tables 1–3

Reporting Summary

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Gauthier, J.L., Koay, S.A., Nieh, E.H. et al. Detecting and correcting false transients in calcium imaging. Nat Methods 19, 470–478 (2022).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing