Tutorial 4: Time-frequency

This tutorials explains how to compute a time-frequency representation of the first 10 seconds of the seizure.

Multitaper decomposition

Seizure recordings

  • Select the menu Time-frequency > Compute:    ImaGIN_spm_eeg_tf.m
  • Interactive options:
    • Select EEG mat file: All the bipolar seizure recordings: bSZ1.mat, bSZ2.mat, bSZ3.mat
    • Prefix of new file: (leave empty)
    • Time-frequency decomposition: Multitaper
    • Frequencies: 10:3:230
    • Factor of modulation: 10
    • Time window width [sec]: 1
    • Time window of analysis [sec]: [-10 10]
    • Time resolution [sec]: 0.1
    • Number of segments: 1
    • Taper: Hanning
    • Select channels: [ ]  (this will select all the channels from the input files)
  • Selecting multiple files in input of this functions executes the same operation sequentially on the files, it is equivalent to running it on each file separately. In output, we obtain 3 new datasets, one for each input file: m1__bSZ1.mat, m1__bSZ2.mat, m1__bSZ3.mat

Baseline recordings

  • Repeat with the same operation with the Baseline files. Select the menu Time-frequency > Compute:
  • Select same interactive options as previously except for the two following options:
    • Select EEG mat file: All the bipolar baseline recordings: Baseline_bSZ1.mat, Baseline_bSZ2.mat, Baseline_bSZ3.mat
    • Time window of analysis [sec]: [ ]   – Leaving this option empty will use the entire file
  • In output, we obtain 3 new datasets: m1__Baseline_bSZ1.mat, m1__Baseline_bSZ2.mat, m1__Baseline_bSZ3.mat

Normalise with baseline

  • We want now to normalize the time-frequency maps of the seizures with respect to their matching baseline.
  • Select the menu Time-frequency > Normalise:    ImaGIN_NormaliseTF.m
  • Interactive options:
    • Select EEG .mat file(s) to normalise: TF file for the seizure SZ1: m1__bSZ1.mat
    • Select EEG .mat file(s) (baseline): TF file for the matching baseline: m1__Baseline_bSZ1.mat
  • This function computes a Z-score with respect to the selected baseline: it evaluates the mean and standard deviation over the baseline, then subtracts the mean and divides by the standard deviation all the values in the first input file. It creates one new dataset: nm1__bSZ1.mat
  • Repeat the same steps for the two other seizures: SZ2 and SZ3

Display the results

  • Click on the button [Time-frequency] in the Display panel, then select a nm1* or m1* file. You can compare the non-normalized (left) and normalized (right) time-frequency maps for the first seizure. To browse through the channels, use the slider at the top-left corner of the graphics window. To edit the color scaling, edit the text boxes at the bottom-left of the figure.   ImaGIN_DispTF.m
  • Channel g'5g'4 for the second (left) and third (right) seizures:


In order to get a better representation of the seizure for this subject, we can compute an average of the time-frequency maps for the three seizures we have.

  • Select the menu Time-frequency > Average:     ImaGIN_AverageTF.m
  • Interactive options:
    • Select EEG mat file:  All the nm1__SZ*.mat files
    • Type of averaging: Mean
    • Name of new file: mean_tf_multitaper
  • This creates a new file mean_tf_multitaper.mat, that you can display with the [Time-frequency] button from the Display panel. Below, the average for most channels on the g' electrode:


  • These figures are useful to identify a frequency band specific of the fast rhythmic activity after the seizure onset. To create the epileptogenicity maps in the next tutorial, we will use a frequency band for which we observe a significant increase after t=0 with the highest possible frequencies. The underlying physiological hypothesis is that the frequency is higher in the seizure onset zone, and decreases with the propagation: the highest the frequency, the highest the spatial specificity.
  • Our goal is to identify a few contacts, among the ones showing a sustained significant activity after t=0, for which the spectrum expands in higher frequencies than the others. As a guideline to what is significant and what is not: the values represented here are Z-scores, and a value of Z=5 is already very significant. You can increase the saturation of the image by setting manually the highest value in the color bar (text box colour/max at the bottom of the figure).
  • Example of several signals, the first one possibly very close to the seizure onset zone (g'8g'7), and the second one a bit further away (c'10c'9):
  • Based on similar observations on several channels, we select the frequency band 120-200Hz as possibly specific for the seizure onset zone.

Alternate normalization procedure [Advanced]

  • Another solution for normalizing the seizure time-frequency map is to use the baseline immediately preceding the seizure onset, instead of using the baseline file epoched separately.
  • Interactive options for menu Time-frequency > Normalise:

    • Select EEG .mat file(s) to normalise: All the TF files from the previous step: m1__bSZ1.mat, m1__bSZ2.mat, m1__bSZ3.mat
    • Select EEG .mat file(s) (baseline): Close the window, this means that we will pick a baseline directly in the files we normalise
    • Baseline time window (s): [-10, -1]  (ignore the last second before the seizure onset)
  • Results obtained with this procedure, after averaging:
  • The maps are very similar and lead to similar interpretation, except for the 2s immediately before the seizure onset.


Next tutorial: Tutorial 5: Epileptogenicity maps