Sander van Bree

[email protected]

Curriculum vitae

PhD Student

University of Glasgow

Introducing the Brain Time Toolbox

June 20, 2022

We've just published the paper accompanying the Brain Time Toolbox in Nature Human Behaviour (page; PDF). This post serves to give a brief introduction to the toolbox, explaining its raison d'être and how it works. In a sentence, it transforms electrophysiology data in accordance with internal brain dynamics to facilitate our analysis of the cognitive brain.

Let’s start with three observations. First, electrophysiology data is formatted and analyzed in clock time—that is to say, the data unfolds millisecond by millisecond. Second, the brain is mostly indifferent to clock time and instead uses neural oscillations to coordinate the intricate patterns underlying cognition. Third, such neural oscillations are highly dynamic—they speed up, slow down, reset themselves spontaneously, and start at different phases across trials.

Combining these facts, it becomes apparent that there is a mismatch—or “disharmony”—between the format of our data (clock time), and how information is meaningfully processed by the brain itself (brain time). We argue this is an issue: if the goal is to understand a system, then it does not really matter how we as external (clock time preferring) observers parse neural patterns. What matters is how the brain processes information within its own regime of time (a point which has been noted by others [1,2]).

The Brain Time Toolbox offers a new solution to clock-to-brain time disharmony: Brain Time Warping (for other ideas to overcome disharmony, see [3,4,5]). It works like this. First, the user selects an oscillation hypothesized to coordinate cognition based on information like cortical source and frequency. The algorithm then analyzes the phase dynamics of this oscillation, resulting in a signal that indexes brain time. Next, it calls on Dynamic Time Warping (DTW) to calculate a so-called warping path between brain time and clock time (which is indexed by a perfectly stationary sine wave). The cool thing about DTW is that the warping path is basically a resampling procedure that tells you how a signal can be transformed to look closely like another. The trick of Brain Time Warping is to use this warping path to transform the rest of the electrophysiology data cycle-by-cycle, and trial-by-trial. This effectively does away with disharmony and sets a new time format to the data: cycles of orchestrating brain oscillations.


What you get after applying the toolbox is a transformed dataset that you can run through your analysis of choice (though there are a few important circularity concerns that we describe in the paper). All in all, the way to think about this is as a preprocessing tool. Using the Brain Time Toolbox, you can prepare your data in such a way that brain dynamics are factored in, supporting subsequent analyses on cognition in the brain. The toolbox can do a variety of other things, which we detail on its webpage.

If you’d like to try the toolbox, you can download it here. For a brief video primer on the toolbox, see here. Finally, the paper can be found here with a full-access PDF here.