Eeglab Data Processing

Total Page:16

File Type:pdf, Size:1020Kb

Eeglab Data Processing

EEGLab Data Processing

Create EEGLab files

1) Drag raw netstation files into waveform tools box

2) Highlight EEGlab_Export script and Run

3) Transfer to PC compatible USB Stick

4) Move to Hogwarts

5) Move to EEGgrid using WinSCP

************************************************************************************************** Once on EEGGrid

1) Import Raw Data – Save current set in subject’s Folder as “Subject Initials Raw” (e.g., SG_Raw).

2) Add Channel Location

a. Edit

a.i. Channel Locations

a.i.1. Read Locations

a.i.1.a. Navigate to Channel map on desktop (.sfp extension)

a.i.1.b. Autodetect – Ok

a.i.1.c. Ok

3) Filter

a. Tools

a.i. Filter the Data

a.i.1. Basic FIR filter

a.i.1.a. Filter Higher Edge of the bandpass (aka low pass filter) first at 30 Hz

a.i.1.a.i. Close pop-up windows

a.i.1.b. Filter Lower Edge of the bandpass (aka high pass filter) second at 0.1 Hz

a.i.1.b.i. Rename and Save Data Set in “ProcessingMethod3” folder

a.i.1.b.i.1. Initials_filtered (e.g., SG_filtered)

a.i.1.b.ii. Close pop-up windows

4) Average Re-Reference

a. Tools a.i. Re-reference

a.i.1. Select “Compute average reference in pop-up window

a.i.2. Ok

a.i.3. Rename and Save data “initials_reref” (e.g., SG_reref)

5) Import Events

a. Create event file with 5 columns

a.i. Latency type condition condition_expanded accuracy

a.i.1. Extract Frame number for each stim event in the raw EEGlab file

a.i.1.a. Open EEGlab

a.i.1.a.i. Load raw EEGfile for a subject

a.i.1.b. Open script “FrameExtract.m”

a.i.1.c. Copy and paste script into matlab command window

a.i.1.d. Open Latency workbook

a.i.1.e. Save latency.mat file to subject’s folder

a.i.1.f. You now have the exact times for your stim events

a.i.1.g. You MUST close eeglab and open a new session before running the script on another subject.

a.i.2. In excel create your headers for each piece of information you want in your event file (e.g., latency type condition condition_expanded accuracy)

a.i.3. Open the latency.mat file in matlab and copy and paste your values into the latency column in excel.

a.i.4. Create your type column (all stim events are 1)

a.i.5. Use Edat files to create the rest of your event info (e.g., we use condition, condition_expanded, and accuracy info from the edat files)

a.i.6. Copy and paste only the values into a txt file

a.i.6.a. Save as “Initials_EventFile” and transfer to EEGGrid

a.i.7. There should be no headers (text) in your event.txt file

b. Load events

b.i. File

b.i.1. Import Event Info b.i.1.a. From Matlab array or ASCII file

b.i.1.a.i. Browse to event.txt file

b.i.1.a.ii. Ok

b.i.1.a.iii. Input column info (i.e., latency type condition condition_expanded accuracy)

b.i.1.a.iv. Input time info (i.e., 1E-3) for ms

b.i.1.a.v. Enter “NaN” into …

b.i.1.a.vi. OK

b.i.1.a.vii. Save Current Dataset as “initials_eventsloaded” (e.g., SG_eventsloaded)

c. Check that Events Loaded Correctly (only if you have more than one type of event)

c.i. Epoch around event types and make sure that the number of each type of event equals what is in your event file

c.i.1. If you only have one type of event then the number of events should equal the number of rows in your event file

6) Channel Reject manually

a. Identify channels to reject via data scroll (Plot – data scroll)

b. Edit

b.i. Select Data

b.i.1. Check on -> remove these

b.i.2. Enter channels to remove in Channel Range box – must put and “E” before each channel

b.i.2.a. (e.g., E256 E45 E22)

b.i.3. Ok

b.i.4. Save data set as Initials_channelrej

7) Extract Epochs

a. Tools

a.i. Extract Epochs

a.i.1. Enter Event of interests (in our case it is 1 to epoch around the stim)

a.i.2. Enter the length of the epoch (currently we are using -0.2 1)

a.i.3. Name new data set “initials_epochs” (e.g., SG_epochs) a.i.4. Save new data set

a.i.5. OK

a.i.6. Ok to baseline removal

8) Examine data epochs and remove bad epochs

a. Tools

a.i. Reject data epochs

a.i.1. Reject by inspection

a.i.1.a. Click second checkbox to reject data at once (instead of simply marking epochs for rejection)

a.i.1.b. OK

a.i.2. In scrolling window click epochs to reject

a.i.3. Reject

a.i.4. Save data set as Initials_epochrej

9) Run ICA – After ICA completes save data

a. “initials_ICA”

10) Review ICA components

a. Tools

a.i. Reject Data using ICA

a.i.1. Remove components by map

a.i.1.a. If you don’t know what you’re looking for then don’t do this step.

a.i.2. Tools

a.i.2.a. Remove Components

a.i.2.a.i. Make sure rejected components are entered into components to reject or enter components to retain.

a.i.2.a.ii. OK

a.i.2.a.iii. Save data as “Initials_Pruned_ICA_xx” the xx represents the attempt number.

11) Check ERPs a. Create averages for events of interest (Distractors; 2=Fear, 3 = Sad, 5 = Neu: Targets; 22 = TaFear, 33 = TaSad, 55 = TaNeu)

b. Plot

b.i. Sum/compare ERPs

b.i.1. Enter datasets to use

b.i.2. Uncheck avg and Check all ERPS

b.i.3. In last box Change -1 to 1 to have positive voltage going up on the y-axis

12) Check ERPs to make sure they look good and (if appropriate that patterns are retained from the non-pruned data)

a. If they don’t look good compared to the non-pruned data

a.i. 1) retry pruning the ICA with different components.

a.ii. Repeat until you are satisfied with the pruned data.

a.iii. Record final Pruned data set chosen in EEG data processing record kept on Hogwarts and delete other pruned ICAs that are no longer necessary.

13) Channel Interpolate - Once you have finalized ICA artifact rejected data set then re-interpolate your missing channels.

a. Clear all data sets

a.i. Load data set with full channel array (Initials_reref)

a.ii. Load data set to be interpolated (Initials_pruned_ICA_xx)

a.iii. Tools

a.iii.1. Interpolate Electrodes

a.iii.2. Select data from another dataset

a.iii.2.a. Enter number of dataset with full channel array (1)

a.iii.2.b. Ok

a.iii.2.c. Select every channel

a.iii.2.d. OK

a.iii.2.e. Interpolation method = spherical

a.iii.2.f. Ok

a.iii.2.g. Save as “Initials_InterpolatedElect”

14) Plot ERPs by condition – make sure you do this on ‘Initials_Interpolated_Elect’ a. Edit

a.i. Select epochs or events

a.i.1. Conditions to Create

a.i.1.a. Initials_NeuPics, Initials_FearPics, Initials_SadPics, Initials_TaT, Initials_TaN, Initials_TaF, Initials_TaS

a.ii. Only create for correct trials by entering 1 in the accuracy slot

15) Make Arrays to Export

a. Must Export each condition separately

a.i. Select Condition to export by ensuring it is your working dataset in eeglab

a.ii. Size(EEG.data)

a.ii.1. To double check you have correct dataset.

a.ii.2. This command outputs a 1x3 array (channels, frames, trials)

a.ii.3. Average all trials

a.ii.3.a. Condition e.g., Fear = mean(EEG.data,3);

a.ii.3.b. Need to flip array

a.ii.3.c. So that channels are in columns and frames are in rows

a.ii.3.d. Enter Condition’ e.g., Fear_b = Fear’

a.ii.3.e. Change directory to where file is to be saved

a.ii.3.f. Write csv file

a.ii.3.f.i. Csvwrite(‘MT_Fear.txt’, Fear_b) Plot(ERP(15,: ))

Figure

Plot(ERP(15,:))

Recommended publications