Figures
Abstract
Electroencephalography (EEG) is an established method for investigating neurocognitive functions during human development. In cognitive neuroscience, time-frequency analysis of the EEG is a widely used analytical approach. This paper introduces WTools, a new MATLAB-based toolbox for time-frequency analysis of EEG signals using complex wavelet transformation. WTools features an intuitive GUI that guides users through the analysis steps, focusing on essential parameters. Being free and open-source, it can be integrated and expanded with new features, making it a handy tool that is growing its popularity in developmental cognitive neuroscience. While the default settings follow established pipelines in developmental research, the toolbox also provides the flexibility to accommodate settings more commonly used in adult neuroscience. Here, we provide a detailed description of the WTools algorithm for wavelet transformation and we compare it with state-of-the-art methods implemented in EEGLAB. Alongside the official tool release, we offer a comprehensive, illustrated tutorial with sample infant EEG data designed to support novice users, enhance accessibility and promote the transparent and reproducible usage of WTools.
Citation: Ferrari A, Filippin L, Buiatti M, Parise E (2025) WTools: A MATLAB-based toolbox for time-frequency analysis of infant data. PLoS One 20(5): e0323179. https://doi.org/10.1371/journal.pone.0323179
Editor: Humaira Nisar, Universiti Tunku Abdul Rahman, MALAYSIA
Received: November 8, 2024; Accepted: April 3, 2025; Published: May 7, 2025
Copyright: © 2025 Ferrari et al. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Data Availability: WTools is publicly available as open-source software on GitHub (github.com/cogdevtools/WTools/tree/v2.0) under GNU General Public License (GPL-3.0). A step-by-step tutorial for the use of WTools is provided in the wiki section of the GitHub project. An example anonymized dataset (data from [1]) has been deposited in the Open Science Framework and is freely available at https://osf.io/jtudr/.
Funding: 'This research was supported by an Advanced Investigator grant (249519, OSTREFCOM) from the European Research Council to Gergely Csibra. E.P. was partially supported by the International Centre for Language and Communicative Development (LuCiD) at Lancaster University, funded by the Economic and Social Research Council (UK) (ES/L008955/1), as well as by the Italian Ministry for Universities and Research (PRIN PNRR 2022 grant P202222P3T). A.F. was supported by the MSCA PF Grant 2022 “MultiMeans” (Project 101105251) from Horizon Europe.
Competing interests: The authors have declared that no competing interests exist.
Introduction
Electroencephalography (EEG) is an established and practical tool for studying brain function and dysfunction across the lifespan. Over the past decades, time-frequency analysis of the EEG has become increasingly popular in cognitive neuroscience. Often implemented via wavelet transformation [2–4], time-frequency analysis attempts to unfold the EEG signal into the frequency domain. Unlike pure Fourier transformation, it includes some temporal support, allowing us to see the frequencies in the EEG signal spread over time relative to a time-locked stimulation. Consequently, time-frequency analysis can finely characterize the temporal dynamics embedded in EEG oscillations in terms of frequency, power, and phase [4]. This analysis provides invaluable information on a variety of cognitive processes such as attention [5,6], learning and prediction of upcoming information [7,8], memory [9,10], language [11–13] and motor activation [14,15], pointing to the centrality of cortical rhythms in cognition [16,17].
Over the past two decades, time-frequency analysis of the electroencephalogram (EEG) has become increasingly popular in the field of developmental cognitive neuroscience [2,1,18–24]. Yet, most studies in this field currently rely on ERPs and Fourier-based power, possibly because time-frequency analyses can be both computationally intensive and analytically complex [25]. Different from event-related potential (ERP) analysis, time-frequency analysis can be done with many different mathematical approaches (short-time Fourier transform, Hilbert transformation, wavelet transformation) and requires the manipulation of several parameters. Different approaches and small changes in the parameters can lead to very different results.
There is a large number of free software [26–29] and commercial software (NetStation, Brain Vision Analyzer) to perform time-frequency analysis of the EEG. However, commercial software does not disclose the exact algorithm for the signal processing. As a result, it is virtually impossible to understand what the software does exactly, undermining flexibility, transparency and reproducibility. Free software on the other hand can be difficult to use because of the lack of a graphic user interface (GUI), or because they require to manually set several parameters. By developing in complexity and integrating an increasing number of functionalities, these toolboxes are difficult to use for inexperienced researchers and students, as is often the case in developmental neuroscience.
This paper presents WTools, a new MATLAB-based toolbox for time-frequency analysis of the EEG signal. WTools is designed to be very user-friendly through its simple GUI; it is easy to learn and use because it keeps the number of parameters to manipulate at a minimum; it is open source and flexible as the code is freely available. WTools uses wavelet transformation and the algorithm is fully described. It works in combination with EEGLAB, exploiting its functionalities to import several different EEG data formats, as well as some of the EEGLAB plotting functionalities. Its data structure is derived from ERPWAVELAB [27] and therefore WTools files are fully compatible with ERPWAVELAB. It handles multi-channel time-frequency analysis and multi-subject projects. It computes within-subject time-frequency differences among conditions and plots the results with time-frequency plots, as well as 2D and 3D scalp maps. It is possible to integrate and extend the toolbox with personalized configurations for developmental research (i.e., newborn and infant scalp maps). Finally, WTools includes a function to export numerical datasets into tabulated text files that can be easily analysed with any statistical software. For these reasons combined, an increasing number of studies in the field of developmental cognitive neuroscience have adopted beta versions of WTools before its official release [30–38]. With the present work, we aim to formalize the toolbox, publicly release it together with a clear, step-by-step user-friendly tutorial and promote its usage from the wider developmental cognitive neuroscience community and beyond.
To provide a comprehensive overview of WTools, the paper is structured as follows. First, we describe how WTools implements wavelet transformation and how the signal is processed. Then, we illustrate the main visualization functionalities of WTools. Finally, we compare its time-frequency functionality with state-of-the-art methods implemented in EEGLAB, an established popular free software [26]. WTools scripts are made freely available for the users (under GPL-3.0 license) on GitHub (github.com/cogdevtools/WTools/tree/v2.0). A user-friendly step-by-step tutorial of the entire pipeline for the use of WTools is provided on GitHub, along with an anonymized example dataset (see Data availability statement). We strongly encourage readers to refer to the tutorial for complete details and the latest updates on the toolbox’s functionalities.
Materials and methods
WTools description
The processing pipeline (Fig 1) consists of a sequence of steps, each controlled through a GUI and executed by an independent code module. The paper focuses mainly on the core analytical section of the toolbox. Accordingly, in the following sections we describe the wavelet transformation implemented in WTools. The description is kept at the minimum possible complexity to provide a simple and clear explanation of how WTools transforms the EEG signal into the time-frequency domain.
WTools GUI (A) and schematic representation of the processing pipeline (B). The toolbox is divided into five main sections: Project management (initialize project and import data); Signal processing (run time-frequency analysis); Plots (create time-frequency plots, 2D and 3D scalp maps); Statistics (export numeric values for statistical analyses); Application (configure and monitor the toolbox’s functionalities). The paper focuses mainly on the core analytical section of the toolbox (i.e., Signal processing); for further details on the remaining sections, please consult the step-by-step tutorial accessible from the WTools GitHub project website (see Data availability statement).
Morlet complex wavelets.
A wavelet (small wave) is a mathematical function of time (t) and frequency (f), with the following two features. First, its amplitude approaches zero at positive and negative infinity and it differs from zero only around the origin of the cartesian axes. That is, differently from other mathematical functions such as sinusoidal or infinite waves, a wavelet has a defined temporal length. Second, the sum of the area of a wavelet above the x axis is equal to the sum of the area of the wavelet below the x axis, hence the total sum of the area of a wavelet is equal to zero. Therefore, differently from a filter, a wavelet will not change the power spectrum of a signal. WTools computes Morlet complex wavelets at a 1 Hz sampling frequency according to:
where ,
is the temporal duration of the wavelet expressed in cycles of the oscillation frequency
,
is a Gaussian bell curve,
is a complex sinusoid. Wavelets are normalized depending on the time-frequency transformation measure (see next paragraph): the normalization factor
is equal to
if the amplitude is taken, and it is equal to
if the power is taken [39]. Wavelet normalization is common practice in time-frequency analysis (e.g., in EEGLAB), which we strongly recommend as it allows direct quantitative comparisons of frequency content across frequency values. Nevertheless, we still provide the option to omit wavelet normalization for back-compatibility with previous (beta) versions of WTools. As a sanity check, there is a perfect match between the wavelets specified by WTools and EEGLAB once wavelet normalization is applied to the WTools wavelet (Fig 2).
WTools wavelets (on the left) and EEGLAB wavelets (on the right) for the frequency range used in the present work (10-90 Hz; see section “Data analysis”). Please note that the default WTools pipeline computes wavelets with 1 Hz sampling frequency; here we plot wavelets with 10 Hz sampling frequency for visualization purposes only. The red plots show non-normalized wavelets for WTools. The blue plots show normalized wavelets for WTools and EEGLAB, with a perfect correspondence between the two. X axis: Time (s); Y axis: Wavelet amplitude (a.u.).
Note that WTools uses a default value of for back-compatibility with beta versions of the toolbox and with previous infant EEG research that used the very same approach [2,18–20,1,23]. More precisely, these previous publications report a value of 3.5 cycles, which translates to 7 in the current version of the toolbox to fully align with the EEGLAB’s wavelet formula and resulting cycle value, thus avoiding potential confusion. Consequently, the very small oscillations at the edges of the wavelets are also considered. However, there is no other theoretical reason to choose this value. WTools implements the possibility to choose the number of cycles one thinks is the most appropriate for their experimental purposes. Furthermore, the wavelet transformation GUI enables plotting the Full Width at Half Maximum (FWHM) versus the wavelet frequencies. This feature is particularly useful when determining the appropriate optional padding to apply to the signals before transformation, as it suggests the minimum acceptable duration for the padding, helping to avoid the introduction of distortion at the edges of the EEG segments.
The last term of the equation can be written as a sum of sin and cos waves:
In practice, a wavelet is a complex sinusoidal wave enveloped into a Gaussian bell curve. Because a wavelet is a function depending on a frequency f, at each f the corresponding wavelet works as a magnifier that can reveal how much that frequency is present into the EEG signal. At the same time, because a wavelet has a defined temporal length, it can preserve some time information after the transformation of the signal.
Wavelets are wide at lower frequencies, that is the temporal information is relatively imprecise, but the frequency information is preserved. Wavelets become progressively narrower at higher frequencies, that is the time information is more accurate, but the frequency information is less precise. This creates an important difference with the short-time Fourier transform (STFT) approach, which is also widely used to uncover oscillatory activity in the EEG signal. During the STFT computation, the time information is kept fixed for all frequencies of interest, even when it could be higher (i.e., at higher frequencies). Conversely, wavelets optimize the window length for each frequency by appropriately scaling a unique function, the “mother wavelet”, so that it achieves the best possible compromise between uncovering the EEG oscillatory activity and preserving the maximum possible time information for each frequency of interest. In sum, time and frequency information respond to Heisenberg’s indetermination principle: the more accurately we know one of them, the less accurately we know the other. Given this constraint, wavelet transformation is the most informative approach for time-frequency analysis, preserving the time information as much as possible while reliably uncovering oscillatory information.
Time-frequency transformation.
After computing all the wavelets for each frequency in a range of interest, WTools uses continuous wavelet transformation. By default, all trials are analysed. However, the user can specify a subset of trials or even a specific single trial, enabling single-trial frequency extraction. By convolving the signal s(t) (cleared of its DC component) with the wavelet w(t, f) and taking the modulus of the resulting complex coefficients, WTools obtains the amplitude coefficients (the mean square root) of the wavelet transformation at a specific frequency f. The resulting vector represents how well the signal fits the wavelet at a the frequency f, that is how much of the frequency f is in that signal [39]. WTools performs the convolution for each experimental condition and channel, of each EEG segment and subject, for all frequencies of interest. Transformed segments are then averaged across trials:
where is the time-frequency coefficient at channel c, frequency f, time t and segment n of the EEG signal given by
. Following the ERPWAVELAB data structure [27], the resulting MATLAB variable “WT” is a 3D matrix (Channel × Frequency × Time) that contains the average of the transformed segments. Note that, since WTools by default takes the modulus of the complex coefficients, the data are expressed in amplitude (μV) rather than power (i.e. μV2). As a result, the measure is slightly more sensitive to small frequency changes. However, since other established pipelines [26,28,29] use the power of the wavelet transform as the time-frequency measure, WTools also provides the option to compute and analyse the power. Thus, WTools offers flexibility to work with either the amplitude or the power of the wavelet transform, and users can display the data in dB. Importantly, since wavelet transformation reveals phase information, WTools provides access to the raw complex data before removing the complex components, allowing users to extract phase information directly from the transformed data.
WTools allows computing both total-induced and evoked oscillations [40,41]. Total-induced oscillations are computed by wavelet transformation of each EEG epoch before averaging all of them together (i.e., the pipeline we just described above): in this way, the oscillatory activity non-phase-locked to the onset of the stimulus is preserved. Total-induced oscillations are richer measures compared to evoked oscillations. Evoked oscillations are computed by running the wavelet transformation after averaging all the EEG epochs together, that is the wavelet transformation is performed on the average (i.e., it is the wavelet transformation of the ERP): in this way, the oscillatory activity that is non-phase-locked to the stimulus onset is averaged out and lost before the wavelet transformation. Evoked oscillations are poorer measures compared to total-induced oscillations and are slightly more sensitive to low-level features of the stimulus.
Edges chopping.
The continuous wavelet transformation assumes signal continuity, yet EEG segments inherently lack this continuity: at the segment’s start, a shift from no signal to signal with amplitude occurs, mirrored at the segment’s ends, causing significant frequency changes. This discontinuity distorts coefficient vectors at the edges, particularly noticeable at lower frequencies where wavelets are broader (see Fig 2). To address the impact of this distortion on EEG signal analysis, it is advisable to pre-cut wider segments. Alternatively, WTools offers an edge padding feature to compensate for signal absence at segment edges. Based on empirical evaluation, the minimally necessary length of extra signal needed at each edge can be estimated with the current formula (Gergely Csibra, personal communication):
where f is the frequency range of interest. For instance, if one wants to look at frequencies between 5–15 Hz, then it is necessary to consider t = 400 ms of extra signal at both left and right edges of the segment.
Baseline correction.
Differently from other toolboxes that adopt a divisive baseline [42], WTools performs by default a subtractive baseline similarly to baseline correction for ERPs. The average amplitude in a given time window of the pre-stimulus interval is computed and subtracted from the whole time-varying signal. Notice that there is not a common baseline for all frequencies; instead, each frequency of interest has its own baseline value that is used for correction only for that frequency. This approach makes the resulting spectrograms easy to read and highly comparable to ERPs, which is particularly handy for developmental research. Furthermore, adopting a divisive baseline assumes a multiplicative model, in which oscillations and activity scale by the same factor relative to baseline for each frequency [43]. This assumption may be incorrect when signal and noise contribute independently to the power spectrum (i.e., additive model; Gyurkovics et al., 2021), a very common problem in developmental studies for which a subtractive baseline may be more suitable. Nevertheless, for wider usability of the toolbox, WTools also offers options for subtractive baseline correction with normalization and divisive baseline correction [42].
Dataset description
To examine the time-frequency functionality of WTools, we employed a dataset from a previously published study investigating EEG responses to multimodal ostensive signals in 5-month-old infants [1]. Eighteen infants (9 females; average age = 148.17 days, range = 136–157 days) were included in this previously published study. All infants were born full-term (gestational age: 37–41 weeks) and in the normal weight range (>2500 g). We provide free access to an anonymized dataset containing three representative participants from this study (see Data availability statement). The figures contained in the present paper pertain to one of these participants.
The experiment conformed to a 2 × 2 within-subject factorial design, corresponding to the orthogonal crossing of the factors Modality (visual vs. auditory) and Ostension (ostensive vs. non-ostensive). As a result, the experiment included four within-subject conditions: ostensive visual stimulus of direct gaze (DG); non-ostensive visual stimulus of averted gaze (AG); ostensive auditory stimulus of infant-directed speech (IDS); non-ostensive auditory stimulus of adult-directed speech (ADS).
Visual stimuli (female faces) were presented on a 19-inch CRT monitor operating at 100 Hz refresh rate using Psychtoolbox (v. 3.0.8) and custom-made MATLAB scripts. Auditory stimuli (a pseudo-word pronounced by a female voice) were presented by a pair of computer speakers located behind the monitor. A remote-controlled video camera located below the monitor allowed the recording of infants’ behaviour during the experiment. For further details on the stimuli and setup, please refer to [1].
Infants sat on their parent’s lap at 70 cm from the monitor. At the beginning of each trial, a dynamic visual stimulus appeared on top of the face with closed eyes for 600 ms to grab the infant’s attention. Afterwards, the attention grabber stopped moving and stayed on screen for a random interval between 600 and 800 ms. The attention grabber then disappeared and a visual (DG or AG) or auditory (IDS or ADS) stimulus was presented for 1000 ms. An inter-trial interval between 1100 and 1300 ms was inserted between trials. Infants were presented with a maximum of 192 trials divided into 4 blocks. The behaviour of the infants was video-recorded throughout the session for offline trial-by-trial editing.
High-density EEG was recorded continuously using Hydrocel Geodesic Sensor Nets (Electrical Geodesics Inc., Eugene, OR, USA) at 124 scalp locations referenced to the vertex (Cz). The ground electrode was at the rear of the head (between Cz and Pz). Electrophysiological signals were acquired at the sampling rate of 500 Hz by an Electrical Geodesics Inc. amplifier with a band-pass filter of 0.1–200 Hz.
Data analysis
WTools does not include preprocessing routines, so users can freely choose their preferred pipelines before importing the data into the toolbox. In the following, we describe the preprocessing steps adopted in the original publication from which the sample dataset was taken [1]. The authors used state-of-the-art infant EEG methods available at the time of the original publication. The digitized EEG was band-pass filtered between 0.3–100 Hz and was segmented into epochs including 500 ms before stimulus onset and 1500 ms following stimulus onset for each trial. EEG epochs were automatically rejected for body and eye movements whenever the average amplitude of an 80 ms gliding window exceeded 55 µ V at horizontal EOG channels or 200 µ V at any other channel. Additional rejection of bad recording was performed by visual inspection of each individual epoch. Bad channels were interpolated in epochs in which ≤10% of the channels contained artefacts; epochs in which >10% of the channels contained artefacts were rejected. Infants contributed on average 12.11 artefact-free trials to the DG condition (range: 10–19), 11.67 to the AG condition (10–15), 11.67 to the IDS condition (10–19), 12.61 to the ADS condition (10–22). The artefact-free segments were subjected to time-frequency analysis using WTools and EEGLAB respectively. For both, we applied the following core parameters: frequency range = [10, 90] Hz; time window = [-200, 1200] ms; number of wavelet cycles = 7.
WTools analysis.
To import data into WTools, epochs were transformed from the native EGI format to the MATLAB format using the appropriate NetStation Waveform export tool by EGI, and then the correspondent EEGLAB import plugin (v. 2021.1). In general, WTools calls existing EEGLAB plugins to import data. Each plugin takes as input a specific data format. Users must save the data in a format that is compatible with the EEGLAB plugin of interest, which is called by the WTools import routine (see: eeglab.org/tutorials/04_Import/Import.html). Note that data to be imported into WTools must conform to an event-related within-subject design with one single trigger per segment/epoch indicating the onset of the key event. Epochs were re-referenced to average reference and then subjected to time-frequency analysis. Data were analysed using both the default WTools pipeline (whose code is released with this publication) and custom pipelines that allowed a direct comparison with the EEGLAB output, as outlined below.
In the following, we describe the default WTools pipeline. We computed complex Morlet wavelets for the frequencies 10–90 Hz in 1 Hz steps. We calculated total-induced oscillations by performing a continuous wavelet transformation of all the epochs using convolution with each normalized wavelet (number of cycles = 7) and taking the absolute value (i.e., the amplitude) of the results [2]. To remove the distortion introduced by the convolution, we chopped 300 ms at each edge of the epochs, resulting in 1400 ms long segments, including 200 ms before and 1200 ms after stimulus onset. We used the average amplitude of the 200 ms pre-stimulus window as baseline, subtracting it from the whole epoch at each frequency.
To compare the WTools output to the EEGLAB output, we carried out a custom analysis that deviated from the default WTools pipeline in two ways. First, we took the squared value (i.e., the power) of the complex wavelet coefficient, in line with the EEGLAB pipeline. Second, we skipped baseline correction to avoid a mismatch between the two toolboxes (while WTools performs a subtractive baseline, EEGLAB implements a divisive baseline).
EEGLAB analysis.
Epochs were transformed from the native EGI format to the MATLAB format using the NetStation export tool and then imported by using the correspondent EEGLAB import plugin (v. 2021.1). Epochs were re-referenced to average reference and then subjected to time-frequency analysis. Data were analysed using various EEGLAB pipelines that allowed a direct comparison with the WTools output. Specifically, we carried out a custom analysis that deviated from the standard EEGLAB pipeline in two ways. First, we did not log-transform the results of the wavelet transformation (typically done to bring the results to the standard dB scale). Second, we skipped baseline correction to avoid a mismatch between the two toolboxes. Alongside these custom analyses, we processed the data using the standard EEGLAB pipeline. Please see the Supporting information (S1 Fig) for a comprehensive review of the analysis pipelines. For all analyses, we computed Morlet complex wavelets for the frequencies 10–90 Hz in 1 Hz steps. We calculated total-induced oscillations by performing a continuous wavelet transformation of all the epochs using convolution with each normalized wavelet (number of cycles = 7) and taking the squared value (i.e., the power) of the complex coefficients. Data were automatically chopped by EEGLAB to remove the distortion introduced by the convolution, resulting in 1400 ms long segments, including 200 ms before and 1200 ms after stimulus onset. For baseline correction, we entered the 200 ms pre-stimulus window as baseline.
Ethics statement
This work illustrates a new software toolbox for EEG analysis. As such, the project did not involve the recruitment and testing of human participants. We utilized anonymized EEG data from a previously published study, which was conducted in accordance with the Declaration of Helsinki and approved by the United Ethical Review Committee for Research in Psychology (EPKEB) at Central European University, where data collection was performed. Written informed consent was obtained from all subjects involved in the study.
Results
Illustrating WTools
We illustrate the main visualization functionalities available in WTools using results obtained under the default WTools pipeline. For details of all the available visualization settings, please refer to the step-by-step tutorial of the entire pipeline that is provided on GitHub (see Data availability statement). Three main types of plots are available: time-frequency graphs, 2D scalp maps and 3D scalp maps. For time-frequency graphs, it is possible to plot results from individual channels, from the average of a desired subset of channels, or from all available channels in a topographical arrangement. The possibility to average over a desired subset of channels is particularly convenient: researchers often have a priori hypotheses about which scalp region may show an effect and therefore may be interested in calculating the average over a specific cluster of EEG channels (S2 Fig). WTools incorporates this important functionality under “Channels Average”. For all time-frequency graphs, users can also plot the standard error of the effect relative to baseline, which allows a preliminary descriptive evaluation of the effect size. For 2D and 3D scalp maps, please note that WTools expects to assign a 2D topoplot configuration to any given dataset during the initial data import routine. Optionally, the user can decide to additionally select a spline configuration for 3D scalp maps. Currently, WTools offers several 2D and 3D configuration files (ANT, BIOSEMI, GSN) for 2D and 3D maps of adult and infant data. It is possible to integrate and extend the toolbox with personalized configurations for developmental research (i.e., newborn and infant scalp maps). For 2D scalp maps, the user can obtain a plot corresponding to various possibilities: one timepoint at one specific frequency; average of timepoints at a specific frequency; average of a frequency range at one timepoint. It is also possible to plot a series of scalp maps, either for time or frequency series. This allows the user to create a visualization of time topography over frequency, and vice versa, frequency topography over time. For 3D scalp maps, the user can similarly obtain a plot corresponding to various possibilities: one timepoint at one certain frequency; average of timepoints at a certain frequency; average of a frequency range at one timepoint. Finally, all types of graphs allow plotting results of individual conditions or results of user-defined pair-wise differences between conditions.
For illustrative purposes, we show the time-frequency plots and 2D scalp maps for one representative participant and channel both for individual conditions and for their difference (Fig 3). Furthermore, we show the 3D infant scalp map of the same difference (Fig 4). Results show a higher synchronization for Condition 1 (DG) than Condition 2 (AG) in the gamma frequency-band at 250–350 ms post-stimulus. This result is representative of the final finding of the original paper [1], which replicates and extends previous work [44]. Time, frequency and scale ranges are user-defined before all plotting.
Time-frequency plots (A) and 2D scalp maps (B) for one representative participant (“04”) and channel (“22”, corresponding to Fp2) for individual conditions (“DG”, “AG”) and for their difference (“DG – AG”), under the default WTools pipeline. For all time-frequency analyses, we applied the following core parameters: frequency range = [10, 90] Hz; time window = [-200, 1200] ms; number of wavelet cycles = 7. Scalp maps show the topographies of the time-frequency results in the 250-350 ms time window and 30-40 Hz frequency window (as highlighted with dashed lines in panel A).
Infant scalp maps for the pair-wise condition difference “DG – AG” of one representative participant (“04”) under the default WTools pipeline. Scalp maps show the topographies of the time-frequency results in the 250-350 ms time window and 30-40 Hz frequency window (as highlighted in Fig 3A). In the GUI, users can rotate scalp maps in any directions to optimize scalp visualization as desired.
Finally, WTools has a built-in functionality that allows exporting summary data for later statistical inference. Specifically, users can extract numeric values for each desired subject, condition and channel, computing the average value both in a time window and in a frequency range (via a double average). To retrieve averaged values from an area of interest (e.g., the one highlighted with dashed lines in Fig 3A), the user must enter the desired time range (here, [250 350] ms) and frequency range (here, [30 40] Hz), and then select the desired subjects and conditions (by default, all subjects and conditions are included). Values are stored in a text-tabulated (.tab) file (saved into the project’s “Statistics” subfolder), where rows correspond to subjects, and columns correspond to conditions and channels. Please note that we do not provide statistical results in this paper, since the aim is to illustrate the toolbox’s functionalities using a representative subject from the openly available sample data (see Data availability statement). Once users have extracted the numerical values of interest from their empirical dataset, they can compute statistical analyses using third-party statistical packages.
Comparison with EEGLAB
This section aims at examining the time-frequency functionality of WTools via comparison with state-of-the-art methods implemented in EEGLAB, an established popular free software [26]. First, we report the time-frequency results for one representative participant (“04”), channel (“22”, corresponding to Fp2) and condition (“DG”) under the custom pipelines that allowed a direct comparison of the WTools and EEGLAB outputs. Second, we report the time-frequency results under the standard WTools and EEGLAB pipelines, which are practically used in real research settings.
By removing baseline correction and taking the squared value of the complex wavelet coefficient (see section “Data analysis” for further details), the WTools output perfectly matched the EEGLAB output (Fig 5A). This analysis confirms that WTools produces time-frequency results in line with state-of-the-art EEGLAB outputs (our gold standard for the present work), representing an important sanity check. Then, as expected, the standard pipelines generated slightly different results across WTools and EEGLAB (Fig 5B). Importantly, the two toolboxes still showed qualitatively compatible results, with a pronounced increase of induced gamma-band activity over the forehead (channel 22, corresponding to Fp2) in the 250–350 ms time window, and 30–40 Hz frequency window [1]. Please see the Supporting information (S1 Fig) for a comprehensive review of the results under additional analyses pipelines, which derived from the orthogonal crossing of the settings being manipulated (i.e., baseline correction, complex wavelet manipulation, log-transformation).
Time-frequency plots for one representative participant (“04”), channel (“22”, corresponding to Fp2) and condition (“DG”) under the custom pipelines that allowed a direct comparison of the WTools and EEGLAB outputs (A) and under the standard WTools and EEGLAB pipelines (B).
Discussion
This paper introduced WTools, a new MATLAB-based toolbox for time-frequency analysis of the EEG signal that implements complex wavelet transformation. We provided a detailed description of the WTools algorithm for wavelet transformation, as well as an overview of the main visualization functionalities for data exploration and characterization. Crucially, we compared WTools with state-of-the-art methods implemented in EEGLAB [26]. Finally, we created a step-by-step illustrated and user-friendly tutorial of the entire processing pipeline for easy and transparent access to the toolbox’s functionalities (see Data availability statement).
In terms of usability, WTools features a straightforward, transparent and user-friendly GUI that is particularly handy for non-advanced users (with little to no experience in coding). Furthermore, WTools guarantees high flexibility in data handling, since it takes a huge range of input formats thanks to its direct compatibility with EEGLAB: any dataset that can be imported into EEGLAB can also be imported into WTools.
In terms of data analysis, WTools produces time-frequency results in units of μV and it performs a subtractive baseline correction, very similar to baseline correction for ERPs. This approach makes the resulting spectrograms easy to read and highly comparable to ERPs, which is particularly handy for developmental research. Plotting functions allow for a straightforward visualization and evaluation of the data in terms of time-frequency graphs, 2D and 3D scalp maps (including both infant and adult 3D configurations). Users can also plot the standard error of an effect relative to baseline, which allows a preliminary descriptive evaluation of the effect size. To ensure broad usability within the EEG community, WTools offers options for the main alternative approaches to time-frequency analysis commonly found in the literature, including power computation, divisive baseline correction, and dB visualization. Finally, WTools features a built-in tool for exporting numerical data that can be treated directly by third-party statistical packages.
For these reasons combined, an increasing number of studies in the field of developmental cognitive neuroscience have adopted beta versions of WTools [30–38]. With the current official release, we further foster the transparent and reproducible usage of WTools by the developmental cognitive neuroscience community and beyond.
Supporting information
S1 Fig. Comprehensive time-frequency results.
We show a comprehensive overview of results under all analyses pipelines, which derived from the orthogonal crossing of the manipulated settings (i.e., baseline correction, complex wavelet manipulation, log-transformation). We ran four time-frequency analyses in WTools corresponding to the orthogonal crossing of 1) baseline correction (with or without subtractive baseline) and 2) complex coefficient transformation (absolute or squared value). We ran four time-frequency analyses in EEGLAB corresponding to the orthogonal crossing of 1) baseline correction (with or without divisive baseline) and 2) log-transformation of the time-frequency results to convert them to the standard dB scale (with or without log-transformation). For all time-frequency analyses, we applied the following core parameters: frequency range = [10, 90] Hz; time window = [-200, 1200] ms; number of wavelet cycles = 7. Time-frequency plots correspond to one representative participant (“04”), channel (“22”, corresponding to Fp2) and condition (“DG”).
https://doi.org/10.1371/journal.pone.0323179.s001
(TIF)
S2 Fig. Averaging over channels of interest.
Time-frequency plots averaged over all EEG channels (A) compared to averaging over a desired subset of EEG channels (B). These are the same three frontal channels of interest (“9”, “15”, and “22”, corresponding to Fp1, Fpz, and Fp2, respectively) used in the original publication from which the empirical data were taken [1]. Results were obtained using the “Channels Average” functionality for one representative participant (“04”) and condition (“DG”), under the default WTools pipeline.
https://doi.org/10.1371/journal.pone.0323179.s002
(TIF)
Acknowledgments
We thank Gergely Csibra for providing E.P. with the original core algorithm for complex wavelet transformation, and John E. Richards for providing E.P. with the MRI scan to create the 3D infant head model embedded in WTools. We thank Teodora Gliga and Morgan Whitworth for testing preliminary versions of this WTools release.
References
- 1. Parise E, Csibra G. Neural responses to multimodal ostensive signals in 5-month-old infants. PLoS One. 2013;8(8):e72360. pmid:23977289
- 2. Csibra G, Davis G, Spratling MW, Johnson MH. Gamma oscillations and object processing in the infant brain. Science. 2000;290(5496):1582–5. pmid:11090357
- 3. Jensen O, Tesche CD. Frontal theta activity in humans increases with memory load in a working memory task. Eur J Neurosci. 2002;15(8):1395–9. pmid:11994134
- 4.
Cohen M. Analyzing neural time series data. The MIT Press; 2014
- 5. Jensen O, Mazaheri A. Shaping functional architecture by oscillatory alpha activity: gating by inhibition. Front Hum Neurosci. 2010;4:186. pmid:21119777
- 6. Klimesch W. α-band oscillations, attention, and controlled access to stored information. Trends Cogn Sci. 2012;16(12):606–17. pmid:23141428
- 7. Engel AK, Fries P, Singer W. Dynamic predictions: oscillations and synchrony in top-down processing. Nat Rev Neurosci. 2001;2(10):704–16. pmid:11584308
- 8. Arnal LH, Giraud A-L. Cortical oscillations and sensory predictions. Trends Cogn Sci. 2012;16(7):390–8. pmid:22682813
- 9. Griffiths BJ, Jensen O. Gamma oscillations and episodic memory. Trends Neurosci. 2023;46(10):832–46. pmid:37550159
- 10. Hanslmayr S, Staresina BP, Bowman H. Oscillations and episodic memory: addressing the synchronization/desynchronization conundrum. Trends Neurosci. 2016;39(1):16–25. pmid:26763659
- 11.
Drijvers L, Mazzini S: Neural oscillations in audiovisual language and communication. In: Sherman Murray M editor. Oxford research encyclopedia of neuroscience. Oxford University Press; 2023. p.1–45.
- 12. Poeppel D. The neuroanatomic and neurophysiological infrastructure for speech and language. Curr Opin Neurobiol. 2014;28:142–9. pmid:25064048
- 13. Wang L, Jensen O, van den Brink D, Weder N, Schoffelen J-M, Magyari L, et al. Beta oscillations relate to the N400m during language comprehension. Hum Brain Mapp. 2012;33(12):2898–912. pmid:22488914
- 14. Muthukumaraswamy SD, Johnson BW, McNair NA. Mu rhythm modulation during observation of an object-directed grasp. Brain Res Cogn Brain Res. 2004;19(2):195–201. pmid:15019715
- 15. Brittain J-S, Brown P. Oscillations and the basal ganglia: motor control and beyond. Neuroimage. 2014;85 Pt 2(Pt 2):637–47. pmid:23711535
- 16. Wang X-J. Neurophysiological and computational principles of cortical rhythms in cognition. Physiol Rev. 2010;90(3):1195–268. pmid:20664082
- 17. Buzsáki G, Draguhn A. Neuronal oscillations in cortical networks. Science. 2004;304(5679):1926–9. pmid:15218136
- 18. Begus K, Gliga T, Southgate V. Infants’ preferences for native speakers are associated with an expectation of information. Proc Natl Acad Sci U S A. 2016;113(44):12397–402. pmid:27791064
- 19. Begus K, Bonawitz E. The rhythm of learning: theta oscillations as an index of active learning in infancy. Dev Cogn Neurosci. 2020;45:100810. pmid:33040970
- 20. Kaufman J, Csibra G, Johnson MH. Oscillatory activity in the infant brain reflects object maintenance. Proc Natl Acad Sci U S A. 2005;102(42):15271–4. pmid:16230640
- 21. Maguire MJ, Abel AD. What changes in neural oscillations can reveal about developmental cognitive neuroscience: language development as a case in point. Dev Cogn Neurosci. 2013;6:125–36. pmid:24060670
- 22. Meyer M, Endedijk HM, Hunnius S. Intention to imitate: top-down effects on 4-year-olds’ neural processing of others’ actions. Dev Cogn Neurosci. 2020;45:100851. pmid:32890960
- 23. Southgate V, Johnson MH, El Karoui I, Csibra G. Motor system activation reveals infants’ on-line prediction of others’ goals. Psychol Sci. 2010;21(3):355–9. pmid:20424068
- 24. Xie W, Mallin BM, Richards JE. Development of infant sustained attention and its relation to EEG oscillations: an EEG and cortical source analysis study. Dev Sci. 2018;21(3):e12562. pmid:28382759
- 25. Morales S, Bowers ME. Time-frequency analysis methods and their application in developmental EEG data. Dev Cogn Neurosci. 2022;54:101067. pmid:35065418
- 26. Delorme A, Makeig S. EEGLAB: an open source toolbox for analysis of single-trial EEG dynamics including independent component analysis. J Neurosci Methods. 2004;134(1):9–21. pmid:15102499
- 27. Mørup M, Hansen LK, Arnfred SM. ERPWAVELAB a toolbox for multi-channel analysis of time-frequency transformed event related potentials. J Neurosci Methods. 2007;161(2):361–8. pmid:17204335
- 28. Oostenveld R, Fries P, Maris E, Schoffelen J-M. FieldTrip: open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data. Comput Intell Neurosci. 2011;2011:156869. pmid:21253357
- 29. Gramfort A, Luessi M, Larson E, Engemann DA, Strohmeier D, Brodbeck C, et al. MEG and EEG data analysis with MNE-python. Front Neurosci. 2013;7:267. pmid:24431986
- 30. Pomiechowska B, Csibra G. Motor activation during action perception depends on action interpretation. Neuropsychologia. 2017;105:84–91. pmid:28189494
- 31. Quadrelli E, Geangu E, Turati C. Human action sounds elicit sensorimotor activation early in life. Cortex. 2019;117:323–35. pmid:31200126
- 32. Quadrelli E, Roberti E, Polver S, Bulf H, Turati C. Sensorimotor activity and network connectivity to dynamic and static emotional faces in 7-month-old infants. Brain Sci. 2021;11(11):1396. pmid:34827394
- 33. Southgate V, Vernetti A. Belief-based action prediction in preverbal infants. Cognition. 2014;130(1):1–10. pmid:24140991
- 34. Kolesnik A, Begum Ali J, Gliga T, Guiraud J, Charman T, Johnson MH, et al. Increased cortical reactivity to repeated tones at 8 months in infants with later ASD. Transl Psychiatry. 2019;9(1):46. pmid:30700699
- 35. Piccardi ES, Johnson MH, Gliga T. Explaining individual differences in infant visual sensory seeking. Infancy. 2020;25(5):677–98. pmid:32748567
- 36. Yin J, Tatone D, Csibra G. Giving, but not taking, actions are spontaneously represented as social interactions: evidence from modulation of lower alpha oscillations. Neuropsychologia. 2020;139:107363. pmid:32007510
- 37. de Klerk CCJM, Southgate V, Csibra G. Predictive action tracking without motor experience in 8-month-old infants. Brain Cogn. 2016;109:131–9. pmid:27693999
- 38. Ortiz-Barajas MC, Guevara R, Gervain J. Neural oscillations and speech processing at birth. iScience. 2023;26(11):108187. pmid:37965146
- 39.
Herrmann CS, Grigutsch M, Busch NA. EEG oscillations and wavelet analysis. In: Event-related potentials: a methods handbook. MIT Press; 2005.
- 40. Tallon-Baudry C, Bertrand O, Delpuech C, Pernier J. Stimulus specificity of phase-locked and non-phase-locked 40 Hz visual responses in human. J Neurosci. 1996;16(13):4240–9. pmid:8753885
- 41. David O, Kilner JM, Friston KJ. Mechanisms of evoked and induced responses in MEG/EEG. Neuroimage. 2006;31(4):1580–91. pmid:16632378
- 42. Grandchamp R, Delorme A. Single-trial normalization for event-related spectral decomposition reduces sensitivity to noisy trials. Front Psychol. 2011;2:236. pmid:21994498
- 43. Gyurkovics M, Clements GM, Low KA, Fabiani M, Gratton G. The impact of 1/f activity and baseline correction on the results and interpretation of time-frequency analyses of EEG/MEG data: a cautionary tale. Neuroimage. 2021;237:118192. pmid:34048899
- 44. Grossmann T, Johnson MH, Farroni T, Csibra G. Social perception in the infant brain: gamma oscillatory activity in response to eye gaze. Soc Cogn Affect Neurosci. 2007;2(4):284–91. pmid:18985134