Find and analyse TEP peaks

This function finds peaks within a time window defined by user for either ROI or GMFA analyses. Either positive or negative peaks are detected. Peaks are defined as a data point which is larger/smaller than +/- x data points (default = 5, however this can be defined by user). If multiple peaks are found within the window, either the largest peak or the peak closest to the defined latency are returned (as specified by the user). Results are saved in EEG structure under (either EEG.ROI or EEG.GMFA). If no peak is found in the defined window, the amplitude at the defined latency is returned, and a NaN is returned in latency. The analysis is run on all existing outputs from tesa_tepextract (e.g. ROIs or GMFA), unless the user opts to run the analysis on one specific ROI or GMFA.

Note that following peak detection, results can be plotted using tesa_plot.

Peak analysis results plotted using tesa_plot. Three positive peaks were identified (P45, P80 and P280) and three negative peaks (N20, N65 and N100). One positive peak was not found (P200; plotted in red). The windows for peak search are plotted with dotted boxes.

EEGLAB user interface

1. Select which input analysis to run the analysis on.

2. Select the direction of the peak for detection. If both positive and negative peaks require detecting, run the analysis a second time.

3. [Required]. Define the peaks that require detecting. See the window for examples.

4. [Required]. Define the time windows for the peak search. For each peak, two values must be given - the start and end of the search window in ms (e.g. 15,45). For multiple peaks, time window pairs need to be separated by a ; (e.g. 15,45; 46,75). The number of time window pairs must match the number of peaks.

5. Select which method to use for selecting a peak if multiple peaks are detect within one window. Largest: the peak with the largest amplitude will be returned. Centre: the peak with the latency closest to the value in 3 will be returned.

6. Define the number of samples for determining a peak. Peaks are defined as a data point which is greater than (positive) or less than (negative) +/- the number of samples defined in this window.

Scripts

Base function

EEG = tesa_peakanalysis( EEG, input, direction, peak, peakWin ); Default use.

EEG = tesa_peakanalysis( EEG, input, direction, peak, peakWin, 'key1', value1... ); Custom inputs.

Pop function

EEG = pop_tesa_peakanalysis( EEG ); Pop up window.

EEG = pop_tesa_peakanalysis( EEG, input, direction, peak, peakWin ); Default use.

EEG = pop_tesa_peakanalysis( EEG, input, direction, peak, peakWin, 'key1', value1... ); Custom inputs.

Required inputs

Optional inputs (key/value pairs)

Outputs

Examples

EEG = pop_tesa_peakanalysis( EEG, 'ROI', 'negative', 100, [80,120] ); Find a negative peak in all ROI analyses at 100 ms searching between 80 and 120 ms.

EEG = pop_tesa_peakanalysis( EEG, 'GMFA', 'positive', [30,60,180],[20,40;50,70;170,190] ); Find 3 positive peaks in the GMFA analysis at 30 ms (between 20-40ms), 60 ms (between 50-70 ms), and 180 ms (between 170-190 ms).

EEG = pop_tesa_peakanalysis( EEG, 'ROI', 'positive', [25,70], [15,35;60,80], 'method', 'centre', 'samples', 5, 'tepName', 'motor'); Find 2 positive peaks at 25 ms (15-35 ms), and 70 ms (60-80 ms) using the peak closest to the central peak (i.e. 25 ms or 70 ms), defining a peak as a data point that is larger than all data points +/- 5 samples and only for the ROI analysis named 'motor'.

Last updated