Published on *elan* (http://elan.lyon.inserm.fr)

*Description**Usage*- 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,…. - randomization : number of randomizations performed on shuffled pairs.
- option :

+v : verbose mode on: all events are displayed during the processing progress. If omitted, verbose mode off. *Fields of parameter file and example**Examples**Comments**Current version**History*- 1.00 01-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 13-08-2007 (PEA) : minor modification (event file reading).
- 1.16 21-05-2008 (PEA) : minor modification.
- 1.17 17-02-2011 (PEA) : updates to use cmake and free release of Elan. Removes static memory allocations.
- 1.18 12-06-2012 (PEA) : minor modification : output file name creation.
- 1.19 23-09-2014 (PEA) : fix memory fault. Memory allocation change. Use thread version to compute TF.
- 1.20 08-03-2017 (PEA) : remove events without enough samples in analysing period before computation.
*Files**See also*

Computes, in the time-frequency domain, a statistical test of cross-channel synchrony from an EEG file. The test is based on the randomization of shuffled channel pairs. The resulting probability values (p values) are stored in TF files **.vchan1.vchan2.p.stat.tf**. The synchrony test can be performed on the original or re-referenced channels. This allows to determine in the time-frequency domain whether the phase-locking factor represents a statistically significant synchrony.

tfstatsync myeegfile.eeg myeventfile.pos myparfile.par subsampling randomization [+v]

with :

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. |

This par file should be identical to the one used to compute synchrony by tfsync. 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. Probability values will be computed by randomization for the synchrony factors 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 statistics are: (1-2) vs (2-3), (1-2) vs (4-5), and (2-3) vs (4-5).

Output files :

Name | Comments# |

myfilename.2.v1-v2.v2-v3.p.stat.tf myfilename.2.v1-v2.v4-v5.p.stat.tf myfilename.2.v2-v3.v4-v5.p.stat.tf myfilename.5.v1-v2.v2-v3.p.stat.tf myfilename.5.v1-v2.v4-v5.p.stat.tf myfilename.5.v2-v3.v4-v5.p.stat.tf |
Values, in the time-frequency domain, of the probability (0 < p <1) of existence of cross-channel synchrony (phase-locking factor). One output file per event code and per channel pair. |

1.20 08-03-2017

$ELANPATH/bin/tfstatsync

**Links:**

[1] http://elan.lyon.inserm.fr/?q=tfavg

[2] http://elan.lyon.inserm.fr/?q=tfsync