Skip to main content

Thank you for visiting nature.com. 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.

  • Resource
  • Published:

The brain time toolbox, a software library to retune electrophysiology data to brain dynamics

Abstract

Human thought is highly flexible, achieved by evolving patterns of brain activity across groups of cells. Neuroscience aims to understand cognition in the brain by analysing these intricate patterns. We argue that this goal is impeded by the time format of our data—clock time. The brain is a system with its own dynamics and regime of time, with no intrinsic concern for the human-invented second. Here, we present the Brain Time Toolbox, a software library that retunes electrophysiology data in line with oscillations that orchestrate neural patterns of cognition. These oscillations continually slow down, speed up and undergo abrupt changes, introducing a disharmony between the brain’s internal regime and clock time. The toolbox overcomes this disharmony by warping the data to the dynamics of coordinating oscillations, setting oscillatory cycles as the data’s new time axis. This enables the study of neural patterns as they unfold in the brain, aiding neuroscientific enquiry into dynamic cognition. In support of this, we demonstrate that the toolbox can reveal results that are absent in a default clock time format.

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

Access options

Buy this article

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

Fig. 1: Sources of disharmony between clock and brain time.
Fig. 2: What is the best way to study a foreign system?
Fig. 3: Brain time warping between clock and brain time.
Fig. 4: Electrophysiology datasets used to validate brain time warping.
Fig. 5: Results of basic analyses in the simulated dataset.
Fig. 6: Results of advanced analyses in the simulated dataset.
Fig. 7: Results of advanced analyses in the rodent and human dataset.

Similar content being viewed by others

Data availability

We restructured and re-analysed the data of ref. 38 and simulated new data, which are available in the Brain Time Toolbox at https://github.com/sandervanbree/braintime. We re-analysed the data of ref. 39, which is available at https://osf.io/bpexa/.

Code availability

Code for the brain time analysis of the rodent and simulated data is included in the Brain Time Toolbox at https://github.com/sandervanbree/braintime. Custom code for analysis of the human data is available from the corresponding author upon request.

References

  1. Antle, M. C. & Silver, R. Orchestrating time: arrangements of the brain circadian clock. Trends Neurosci. 28, 145–151 (2005).

    Article  CAS  PubMed  Google Scholar 

  2. MacDonald, C. J., Lepage, K. Q., Eden, U. T. & Eichenbaum, H. Hippocampal “time cells” bridge the gap in memory for discontiguous events. Neuron 71, 737–749 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  3. Llinás, R. R. The intrinsic electrophysiological properties of mammalian neurons: insights into central nervous system function. Science 242, 1654–1664 (1988).

    Article  PubMed  Google Scholar 

  4. Buzsáki, G. & Draguhn, A. Neuronal oscillations in cortical networks. Science 304, 1926–1929 (2004).

    Article  PubMed  Google Scholar 

  5. Engel, A. K., Fries, P. & Singer, W. Dynamic predictions: oscillations and synchrony in top-down processing. Nat. Rev. Neurosci. 2, 704–716 (2001).

    Article  CAS  PubMed  Google Scholar 

  6. Jensen, O. & Mazaheri, A. Shaping functional architecture by oscillatory alpha activity: gating by inhibition. Front. Hum. Neurosci. 4, 186 (2010).

    Article  PubMed  PubMed Central  Google Scholar 

  7. Klimesch, W. α-band oscillations, attention, and controlled access to stored information. Trends Cogn. Sci. 16, 606–617 (2012).

    Article  PubMed  PubMed Central  Google Scholar 

  8. Capotosto, P., Babiloni, C., Romani, G. L. & Corbetta, M. Frontoparietal cortex controls spatial attention through modulation of anticipatory alpha rhythms. J. Neurosci. 29, 5863–5872 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  9. Luo, H. & Poeppel, D. Cortical oscillations in auditory perception and speech: evidence for two temporal windows in human auditory cortex. Front. Psychol. https://www.frontiersin.org/article/10.3389/fpsyg.2012.00170 (2012).

  10. Lakatos, P. et al. An oscillatory hierarchy controlling neuronal excitability and stimulus processing in the auditory cortex. J. Neurophysiol. 94, 1904–1911 (2005).

    Article  PubMed  Google Scholar 

  11. Busch, N. A., Dubois, J. & VanRullen, R. The phase of ongoing EEG oscillations predicts visual perception. J. Neurosci. 29, 7869–7876 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  12. Romei, V., Gross, J. & Thut, G. On the role of prestimulus alpha rhythms over occipito-parietal areas in visual input regulation: correlation or causation? J. Neurosci. 30, 8692–8697 (2010).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  13. Ai, L. & Ro, T. The phase of prestimulus alpha oscillations affects tactile perception. J. Neurophysiol. 111, 1300–1307 (2013).

    Article  PubMed  Google Scholar 

  14. Ruzzoli, M. & Soto-Faraco, S. Alpha stimulation of the human parietal cortex attunes tactile perception to external space. Curr. Biol. 24, 329–332 (2014).

    Article  CAS  PubMed  Google Scholar 

  15. Nowak, M., Zich, C. & Stagg, C. J. Motor cortical gamma oscillations: what have we learnt and where are we headed? Curr. Behav. Neurosci. Rep. 5, 136–142 (2018).

    Article  PubMed  PubMed Central  Google Scholar 

  16. Joundi, R. A., Jenkinson, N., Brittain, J.-S., Aziz, T. Z. & Brown, P. Driving oscillatory activity in the human cortex enhances motor performance. Curr. Biol. 22, 403–407 (2012).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  17. Hasselmo, M. E., Bodelón, C. & Wyble, B. P. A proposed function for hippocampal theta rhythm: separate phases of encoding and retrieval enhance reversal of prior learning. Neural Comput. 14, 793–817 (2002).

    Article  PubMed  Google Scholar 

  18. Hanslmayr, S., Axmacher, N. & Inman, C. S. Modulating human memory via entrainment of brain oscillations. Trends Neurosci. 42, 485–499 (2019).

    Article  CAS  PubMed  Google Scholar 

  19. Kerrén, C., Linde-Domingo, J., Hanslmayr, S. & Wimber, M. An optimal oscillatory phase for pattern reactivation during memory retrieval. Curr. Biol. 28, 3383–3392 (2018).

    Article  PubMed  Google Scholar 

  20. Jacobs, J., Hwang, G., Curran, T. & Kahana, M. J. EEG oscillations and recognition memory: theta correlates of memory retrieval and decision making. NeuroImage 32, 978–987 (2006).

    Article  PubMed  Google Scholar 

  21. Polanía, R., Moisa, M., Opitz, A., Grueschow, M. & Ruff, C. C. The precision of value-based choices depends causally on fronto-parietal phase coupling. Nat. Commun. 6, 8090 (2015).

    Article  PubMed  Google Scholar 

  22. Mazaheri, A. & Jensen, O. Posterior α activity is not phase-reset by visual stimuli. Proc. Natl Acad. Sci. USA 103, 2948–2952 (2006).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  23. Jansen, B. H., Agarwal, G., Hegde, A. & Boutros, N. N. Phase synchronization of the ongoing EEG and auditory EP generation. Clin. Neurophysiol. 114, 79–85 (2003).

    Article  PubMed  Google Scholar 

  24. Cole, S. R. & Voytek, B. Brain oscillations and the importance of waveform shape. Trends Cogn. Sci. 21, 137–149 (2017).

    Article  PubMed  Google Scholar 

  25. Sauseng, P. et al. A shift of visual spatial attention is selectively associated with human EEG alpha activity. Eur. J. Neurosci. 22, 2917–2926 (2005).

    Article  CAS  PubMed  Google Scholar 

  26. Buzsáki, G. The Brain from Inside Out (Oxford Univ. Press, 2019).

  27. Scharnowski, F., Rees, G. & Walsh, V. Time and the brain: neurorelativity: the chronoarchitecture of the brain from the neuronal rather than the observer’s perspective. Trends Cogn. Sci. 17, 51–52 (2013).

    Article  PubMed  Google Scholar 

  28. Klimesch, W. EEG alpha and theta oscillations reflect cognitive and memory performance: a review and analysis. Brain Res. Rev. 29, 169–195 (1999).

    Article  CAS  PubMed  Google Scholar 

  29. Kösem, A., Gramfort, A. & van Wassenhove, V. Encoding of event timing in the phase of neural oscillations. NeuroImage 92, 274–284 (2014).

    Article  PubMed  Google Scholar 

  30. Ter Wal, M. et al. Theta rhythmicity governs human behavior and hippocampal signals during memory-dependent tasks. Nat. Commun. 12, 7048 (2021).

    Article  PubMed  PubMed Central  Google Scholar 

  31. Bonnefond, M. & Jensen, O. Gamma activity coupled to alpha phase as a mechanism for top-down controlled gating. PLoS ONE 10, e0128667 (2015).

    Article  PubMed  PubMed Central  Google Scholar 

  32. Qasim, S. E., Fried, I. & Jacobs, J. Phase precession in the human hippocampus and entorhinal cortex. Cell 184, 3242–3255 (2021).

  33. Williams, A. H. et al. Discovering precise temporal patterns in large-scale neural recordings through robust and interpretable time warping. Neuron 105, 246–259 (2020).

    Article  CAS  PubMed  Google Scholar 

  34. Sakoe, H. & Chiba, S. Dynamic programming algorithm optimization for spoken word recognition. IEEE Trans. Acoust. Speech Signal Process. 26, 43–49 (1978).

    Article  Google Scholar 

  35. Berndt, D. J. & Clifford, J. Using dynamic time warping to find patterns in time series. In Proc. 3rd International Conference on Knowledge Discovery and Data Mining, 359–370 (AAAI, 1994).

  36. Thut, G., Nietzel, A., Brandt, S. A. & Pascual-Leone, A. Alpha-band electroencephalographic activity over occipital cortex indexes visuospatial attention bias and predicts visual target detection. J. Neurosci. 26, 9494–9502 (2006).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  37. Worden, M. S., Foxe, J. J., Wang, N. & Simpson, G. V. Anticipatory biasing of visuospatial attention indexed by retinotopically specific alpha-band electroencephalography increases over occipital cortex. J. Neurosci. 20, RC63 (2000).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  38. Newman, E. L. & Hasselmo, M. E. (2014). Grid cell firing properties vary as a function of theta phase locking preferences in the rat medial entorhinal cortex. Front. Syst. Neurosci. https://www.frontiersin.org/article/10.3389/fnsys.2014.00193 (2014).

  39. Bae, G.-Y. & Luck, S. J. Decoding motion direction using the topography of sustained ERPs and alpha oscillations. NeuroImage 184, 242–255 (2019).

    Article  PubMed  Google Scholar 

  40. Bouwer, F. L., Honing, H. & Slagter, H. A. Beat-based and memory-based temporal expectations in rhythm: similar perceptual effects, different underlying mechanisms. J. Cogn. Neurosci. 32, 1221–1241 (2020).

    Article  PubMed  Google Scholar 

  41. King, J.-R. & Dehaene, S. Characterizing the dynamics of mental representations: the temporal generalization method. Trends Cogn. Sci. 18, 203–210 (2014).

    Article  PubMed  PubMed Central  Google Scholar 

  42. Hafting, T., Fyhn, M., Molden, S., Moser, M.-B. & Moser, E. I. Microstructure of a spatial map in the entorhinal cortex. Nature 436, 801–806 (2005).

    Article  CAS  PubMed  Google Scholar 

  43. Grootswagers, T., Wardle, S. G. & Carlson, T. A. Decoding dynamic brain patterns from evoked responses: a tutorial on multivariate pattern analysis applied to time series neuroimaging data. J. Cogn. Neurosci. 29, 677–697 (2017).

    Article  PubMed  Google Scholar 

  44. Jacobs, J. et al. Direct recordings of grid-like neuronal activity in human spatial navigation. Nat. Neurosci. 16, 1188–1190 (2013).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  45. Burgess, N. & O’Keefe, J. Models of place and grid cell firing and theta rhythmicity. Curr. Opin. Neurobiol. 21, 734–744 (2011).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  46. Kriegeskorte, N., Simmons, W. K., Bellgowan, P. S. F. & Baker, C. I. Circular analysis in systems neuroscience: the dangers of double dipping. Nat. Neurosci. 12, 535–540 (2009).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  47. Pletzer, B., Kerschbaum, H. & Klimesch, W. When frequencies never synchronize: the golden mean and the resting EEG. Brain Res. 1335, 91–102 (2010).

    Article  CAS  PubMed  Google Scholar 

  48. Hughes, S. W. et al. Synchronized oscillations at α and θ frequencies in the lateral geniculate nucleus. Neuron 42, 253–268 (2004).

    Article  CAS  PubMed  Google Scholar 

  49. Vijayan, S. & Kopell, N. J. Thalamic model of awake alpha oscillations and implications for stimulus processing. Proc. Natl Acad. Sci. USA 109, 18553–18558 (2012).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  50. Koepsell, K. et al. Retinal oscillations carry visual information to cortex. Front. Syst. Neurosci. https://doi.org/10.3389/neuro.06.004.2009 (2009).

  51. VanRullen, R. Perceptual cycles. Trends Cogn. Sci. 20, 723–735 (2016).

    Article  PubMed  Google Scholar 

  52. ten Oever, S., De Weerd, P. & Sack, A. T. Phase-dependent amplification of working memory content and performance. Nat. Commun. 11, 1832 (2020).

    Article  PubMed  PubMed Central  Google Scholar 

  53. van Wassenhove, V. Temporal cognition and neural oscillations. Curr. Opin. Behav. Sci. 8, 124–130 (2016).

    Article  Google Scholar 

  54. Kostov, V. B. et al. Kepler-413b: a slightly misaligned, Neptune-size transiting circumbinary planet. Astrophys. J. 784, 14 (2014).

    Article  Google Scholar 

  55. Donoghue, T. et al. Parameterizing neural power spectra into periodic and aperiodic components. Nat. Neurosci. 23, 1655–1665 (2020).

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  56. Benjamini, Y. & Yekutieli, D. The control of the false discovery rate in multiple testing under dependency. Ann. Stat. 29, 1165–1188 (2001).

    Article  Google Scholar 

Download references

Acknowledgements

We thank E. Newman, F. Meconi, G.-Y. Bae and S. J. Luck for sharing their data and B. Griffiths for his insightful comments on the Brain Time Toolbox. This research was funded by the European Research Council (grant no. 715714 for M.W. and 647954 for S.H.), the Economic and Social Research Council (ES/R010072/2 for S.H.) and the Autónoma University of Madrid (FPI-UAM 2017 for M.M.). The funders had no role in study design, data collection and analysis, decision to publish or preparation of the manuscript.

Author information

Authors and Affiliations

Authors

Contributions

The Brain Time Toolbox was conceived and developed by S.B., M.M. and S.H. with consultation from L.K., C.K. and M.W. The simulated dataset was generated and analysed by S.B., M.M. and S.H. The remaining datasets were analysed by S.B. and S.H. The manuscript was written by S.B. and S.H. with input from M.M, L.K., C.K. and M.W.

Corresponding author

Correspondence to Sander van Bree.

Ethics declarations

Competing interests

The authors declare no competing interests.

Peer review

Peer review information

Nature Human Behaviour thanks Anne Urai and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.

Additional information

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

Supplementary information

Supplementary Information

Supplementary Sections 1–3 and references.

Reporting Summary

Peer Review File

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

van Bree, S., Melcón, M., Kolibius, L.D. et al. The brain time toolbox, a software library to retune electrophysiology data to brain dynamics. Nat Hum Behav 6, 1430–1439 (2022). https://doi.org/10.1038/s41562-022-01386-8

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1038/s41562-022-01386-8

This article is cited by

Search

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