Skip to content

E_epoching

Douwe Horsthuis edited this page Feb 28, 2024 · 3 revisions

This is the last file for pre-processing the data (unless you want to look at ERPs). In this script the interpolated data get epoched, cleaned, and transformed into an ERP. Some of these functions are ERPlab based.

Firstly, the data needs to have their events (or triggers) to be updated. You need to create a text file that assigns this info. There are 2 ways of doing this.
You can define all trials using an eventlist. This is more restrictive, because it seems like you cannot add a sequence of triggers, only individual ones See this tutorial for more info..
Instead, we use the Binlist option. You can create as many bins as needed. Each bin will create a different ERP, and if you want to use ERPlab to plot ERPs you can choose which ones to plot. If you want to use another program it might be worth it to just save the ERPs of 1 specific bin and run the script multiple times. see this for information on how to create a binlist.txt file, or see this tutorial, or for more info see this tutorial that includes RTs

After that you set the time for the epoch. This is pre-defined in the variable epoch_time and baseline_time at the start. After that we use the pop_artmwppth function to flag all the epochs that are too noisy. We save this info, after which we delete them.
bug when using EEGlab V2019_1
You need to create at least 2 bins, or ERPlab breaks when you want to average the ERPs. When plotting you can always choose not to use one of the two bins. Later on in the F_individual_trials_export script you can choose to only include the bin you want to (or multiple if that is what you want). This is not the case if you use EEGlab V2021.1 bug when using EEGlab V2019_1 Lastly we create the ERPs and save the data as a final .set file. You will also have a file at the end with each participant's ID number and the percentage of data that got deleted.

You can choose to use the pop_binlister function (see line 35).

If you end up wanting Reaction time for the ERPs, consider including the pop_rt2text function. For this to work you need to define the event that reflects the reaction you want to measure in the eventlist. We created a different script for this

These are the variables you NEED to change:

subject_list = {'some sort of ID' 'a different id for a different particpant'}; 
name_paradigm = 'name'; % this is needed for saving the table at the end
participant_info_temp = []; % needed for creating matrix at the end
home_path  = 'the main folder where you store your data\';
eventlist_location = 'the folder where you stored your eventlist\'; %event list should be named event.txt
epoch_time = [-50 400]; %epoch start and end time in ms
baseline_time = [-50 0];%baseline start and end time in ms

These you can change if you want to change settings

EEG = pop_interp(EEG, ALLEEG(1).chanlocs, 'spherical');% 

Back to the home page
Back to the D_reref_exclextrn_interp_avgref_ica_autoexcom page
To the F_RT page

Clone this wiki locally