-
Notifications
You must be signed in to change notification settings - Fork 73
Studio Tutorial: Events and the EventList
Events are so important in ERP research that “event” is the first word in the term “event-related potential.” When we created ERPLAB, we therefore enhanced the event information stored by EEGLAB. EEGLAB stores events in a relatively simple data structure named EEG.events, and ERPLAB creates a more detailed and user-friendly structure called an EventList (stored in a Matlab variable named EEG.EVENTLIST).
EEGLAB allows you to use either text or numbers for event codes in EEG.events, but that can be confusing. The EventList structure in ERPLAB allows you to have both a numeric code and a text label for a given event (e.g., both code #221 and the string “Unrelated Target, List 1” for the same event). However, ERPLAB doesn’t make much use of the text labels, and a numeric code is required for each event. We hope to change this in the future, but for now you need to make sure you have numeric event codes. If your EEGset was stored with text labels rather than numeric codes, ERPLAB can create numeric codes for you.
When EEGsets are created, they do not contain an EventList structure. Let’s see how to create this structure.
To make things simpler, let’s make sure that only 6_N400_filt is loaded in the EEGsets panel. You can do this by selecting the other EEGsets in the EEGsets panel and clicking the Clear button (and then loading 6_N400_filt if it wasn’t already loaded). Or you can just quit and restart ERPLAB studio and then load 6_N400_filt.
Now go to the EventList panel. You can see that it contains a table showing the different event codes that are present in the EEGset and the number of occurrences of each event code. You can see that we have 30 occurrences of each stimulus code, 110 occurrences of the code for a correct response (201), and 12 occurrences of the code for an incorrect response (202).
Click the Create button, and then you’ll see the window for creating the EventList. Set it up as shown in the screenshot below. Make sure to select the option labeled Export EventList to text file and name the file elist. This isn’t something you’ll normally need to do, but it will be useful for explaining how EventLists work.
Note that the option should be set to convert the string boundary to numeric code -99. A boundary event occurs when there is a temporal discontinuity in the EEG data (e.g., because recording was paused between trial blocks; click here for details). ERPLAB uses numeric code -99 to indicate these boundary events.
You should also set the option labeled Create numeric equivalents of nonnumeric event codes when possible. If ERPLAB encounters text event labels that can be easily converted into numeric codes (like converting ‘S12’ to 12), it will do the conversion automatically.
If you have a more complex situation (e.g., labels such as “target”, or ambiguous cases like labels of both “S12” and “R12”), you can click the Advanced button. That button will bring up a window that allows you to convert any text label to any desired numeric code. For more information, see the manual page for creating an EventList. But you won’t need to click the Advanced button for this EEGset.
Once you have everything set up as shown in the screenshot above, click the Create button. You will then get the standard window for naming and saving the new EEGset. Click OK, and you will then see an EEGset named 6_N400_filt_elist in the EEGsets panel. Click the View button in the EventList panel to see the contents of the EventList (see screenshot below). At the top, you can see a bunch of general information about the EEG recording, such as the number of channels and the sampling rate. Then you’ll see a list of the event codes, with one per line. The key columns are item (which indicates the ordering of the event codes), ecode (which is the numeric event code), label (which holds the text label for the event code, which we have not set), onset (which is the time of the event code in seconds relative to the beginning of the recording), and diff (which is the amount of time between the current event code and the previous event code, in milliseconds. In principle, event codes can have a duration (listed in the dura column), but this feature is not used by ERPLAB (i.e., the duration is assumed to be 0 milliseconds).
Note that ERPLAB Studio contains code that keeps EEG.events and EEG.EVENTLIST synchronized, but if you change something manually in one of these structures, you will need to manually synchronize them by clicking the Transfer event info to EEG.event button in the EventList panel.
Now take a look at the main Matlab window. As shown in the screenshot below, you can see that ERPLAB printed a bunch of information in the Command Window when you created the EventList. Most ERPLAB functions print information like this, and it can be very useful to look at this information (a) when you are first learning how to use ERPLAB and (b) if things aren’t working the way you expect them to work.
You can also see the files that are present in the Current Folder section of the window. You should see a file named elist.txt, which exists because you selected the option labeled Export EventList to text file when you created the EventList.
Double-click on the elist.txt file in the Current Folder section of the main Matlab window to open the file in Matlab’s text editor (see screenshot). This is much like the information shown in the EventList table that you created by clicking the View button.
You can actually modify the text file and import it back into ERPLAB to modify the event codes in an EEG dataset (using the Import.txt button in the EventList panel). This is often easier by exporting the EventList as a .xls file (by clicking the Export.xls button), editing it in a spreadsheet program (such as Excel or Google Sheets), and then importing it (by clicking the Import .xls button).
This gives you a lot of power and flexibility. For example, if the event codes were incorrect for one subject, you could change them in the exported file and then import the modified file back into the EEGset. Similarly, if you used software that detected heartbeats and saved them in a file during the experiment, you could add event codes corresponding to these heartbeats to the EEGset. However, complicated scenarios like this are usually best accomplished by writing a simple Matlab script that directly modifies the EventList structure without saving it as a text file.
Previous Page | Next Page | 🏠 |
---|---|---|
BINLISTER |
Home |