Skip to main content
  • Description
  • Computes, in the time-frequency domain using wavelet transform, the cross-channel synchrony factor from an eeg file. The test is based on the randomization of shuffled channel pairs. The resulting synchrony phase-locking factor is stored in tf files (.vchan1.vchan2.pl.tf), and the resulting cross-channel phase difference in a. tf file format (.vchan1.vchan2.ph.tf).

  • Usage
  • tfsync myeegfile.eeg myeventfile.pos myparfile.par subsampling [+s] [+v]

    with :

    • myeegfile.eeg : input EEG file name (with extension).
    • myeventfile.pos : event position file (with extension) (this is usually the output pos file of eegavg, after artifact rejection).
    • myparfile.par: text file containing computation parameters (with extension).
    • subsampling : time-subsampling factor applied to the TF file created. In all cases, the time sample corresponding to the event onset (0 msec) is kept.
      1: all time-samples are saved,
      2: one over 2 samples are saved,
      3: one over 3 samples are saved,….
    • options :
      +v : verbose mode on: all events are displayed during the processing progress. If omitted, verbose mode off.
      +s : all cross-channel synchronies or phase are stored in one single file.


  • Fields of parameter file and example
  • fileprefix myfilename Prefix of the output TF files.
    nb_eventcode 2 Number of event codes to process.
    list_eventcode 2 5 List of the event codes to process.
    prestim_nbsample 400 400 List of the numbers of samples in the prestimulus period; one value for each event code.
    poststim_nbsample 1000 1000 List of the numbers of samples in the poststimulus period; one value for each event code; the total number of samples of the analysis is prestim_nbsample + poststim_nbsample + 1, the extra sample corresponds to the event itself.
    tf_channel_flag 1 1 0 1 0 0 0 List of the channels to process: 1/0 for selected/unselected channels; the total number of flags is N+2, N being the number of recorded channels in myeegfile.eeg file; the last 2 flags should be set to 0.
    In this example, N=5, and only channels number 1, 2, 4 will be processed.
    tf_channel_ref 2 3 0 5 0 0 0 List of the new reference for each channel before processing (bipolar montage for instance):
    0: no change of the reference,
    ≠0: electrode number (rank) to which the current channel should be re-referenced.
    The total number of values is N+2, N being the number of recorded channels in myfile.eeg file; the last 2 flags should be set to 0.
    If omitted, the channels are not modified.
    In this example, N=5, and channel 1 is referenced to channel 2, channel 2 re-referenced to channel 3, and channel 4 re-referenced to channel 5.
    tf_freq_start 10 10 List of the starting frequencies (in Hz) for the time-frequency analysis (one value for each event code).
    tf_freq_stop 80 80 List of the ending frequencies (in Hz) for the time-frequency analysis (one value for each event code).
    tf_freq_step 2 2 List of the frequency steps (in Hz) for the time-frequency analysis (one value for each event code).
    tf_nb_sample_blackman 100 100 List of the number of samples in the rise or fall time period of the blackman window applied on the single trials before the wavelet transform (one value for each event code).
    tf_wavelet_type 1 1 List of the types of wavelet used for the time-frequency analysis (one value for each event code):
    1: Morlet wavelet.
    2: Gabor wavelet.
    tf_morlet_m 7 7 In case of Morlet wavelet, list of the m ratio used for the time-frequency analysis (one value for each event code): m=f0/sigmaf
    Suggested values for m: m>5, usually m=7.
    This determines the number of cycles of the wavelet.
    tf_gabor_sigmat 100 100 In case of Gabor wavelet, list of the half-window durations of the wavelets (in msec) irrespective of the frequency band (one value for each event code).
    nbsync_perchannel 2 1 0 0 0 0 0 Indicates, for each channel, the number of the channels for which synchrony will be computed with another channel:
    - 0: no synchrony computed from this channel,
    - ≠0: synchronies computed from this channel with the indicated number of channels (channel number specified in sync_list).
    The total number of values is N+2, N being the number of recorded channels in myeegfile.eeg file; the last 2 flags should be set to 0.
    In this example, N=5 channels, and the synchrony will be computed with 2 channels for channel 1, and with 1 channel for channel 6.
    sync_list 2 4
    4
    Indicates the channel ranks (starting from 1) with which synchrony will be computed, for each channel with a non-zero flag in nbsync_perchannel. According to tf_channel_ref, each channel may be re-referenced prior to computing synchrony.
    In this example, synchrony will be computed for the pairs channel 1-channel 2, channel 1-channel 4 and channel 2-channel 4.


  • Examples
    1. In this example, for both event codes (2 and 5), the time-frequency analysis will be performed from 18 to 80 Hz by steps of 2 H with a Blackman window having 100 samples for the rise- and for the fall-time, and with Morlet wavelets with a m ratio set to 7. Synchrony factors will be computed between channels: 1 vs 2, 1 vs 4, 2 vs 4. Before computing synchrony, those channels have been re-referenced, and the actual computed synchrony factors are: (1-2) vs (2-3), (1-2) vs (4-5), and (2-3) vs (4-5).
    2. Output files :

      Name Comments#
      myfilename.2.v1-v2.v2-v3.pl.tf
      myfilename.2.v1-v2.v4-v5.pl.tf
      myfilename.2.v2-v3.v4-v5.pl.tf
      myfilename.5.v1-v2.v2-v3.pl.tf
      myfilename.5.v1-v2.v4-v5.pl.tf
      myfilename.5.v2-v3.v4-v5.pl.tf
      Values, in the time-frequency domain, of cross-channel synchronies (phase-locking factor). One output file per event code and per channel pair.
      myfilename.2.v1-v2.v2-v3.ph.tf
      myfilename.2.v1-v2.v4-v5.ph.tf
      myfilename.2.v2-v3.v4-v5.ph.tf
      myfilename.5.v1-v2.v2-v3.ph.tf
      myfilename.5.v1-v2.v4-v5.ph.tf
      myfilename.5.v2-v3.v4-v5.ph.tf
      Values, in the time-frequency domain, of cross-channel phase difference (phase difference between first and second channels, in degrees). One output file per event code and per channel pair.
    3. 2) When using the +s option, the cross-channel synchrony can be computed for all channels with respect to one particular channel. See an example of the .par file below for MEG, with synchrony of all channels computed with respect to channel #100 (including channel #100 with respect to itself):

    4. nbsync_perchannel
      0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
      0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1 0 0 0 0

      sync_list
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
      100 100 100 100 100 100 100 100 100 100 100 100 100 100 100

      Output files :

      Name Comments#
      myfilename.2. sync.pl.tf Values, in the time-frequency domain, of cross-channel synchronies (phase-locking factor). One single output file per event code for all channel pairs.
      myfilename.2. sync.ph.tf Values, in the time-frequency domain, of cross-channel phase difference (phase difference between first and second channels, in degrees). One output file per event code for all channel pairs.


  • Comments


  • Current version
  • 1.21 12-06-2012

  • History
    • 1.00 02-02-2001 (OB/CTB) : 1st documented version.
    • 1.10 09-12-2001 (PEA) : minor modification.
    • 1.11 04-02-2002 (PEA) : minor modification.
    • 1.12 17-06-2002 (PEA) : minor modification (event file reading).
    • 1.13 18-09-2003 (PEA) : minor modification.
    • 1.14 24-11-2003 (PEA) : supports 32 bits EEG.
    • 1.15 29-09-2005 (PEA) : fixes quit when not enough samples after last event.
    • 1.16 13-04-2007 (OB) : supports large files (> 2GB). Adds +s option to save all pair of channel in one file.
    • 1.17 20-04-2007 (OB) : fixes TF header for +s option.
    • 1.18 13-08-2007 (PEA) : minor modification.
    • 1.19 22-02-2011 (PEA) : updates to use cmake and free release of Elan. Removes static memory allocations.
    • 1.20 20-06-2011 (PEA) : uses threads to compute TF transform (TF transform function of libelansignal).
    • 1.21 12-06-2012 (PEA) : minor modification : output file name creation.


  • Files
  • $ELANPATH/bin/tfsync

  • See also
  • tfavg, tfstatsync