LCE Kotisivu

S-114.3760 Practical 2


Design your own EEG experiment

In the second practical, the idea is that you have control of the complete EEG experiment. You can think of it as the first pilot experiment of your new study, and your task is to report the success or failure of it to your professor and suggest future improvements. Report what has to be changed in future measurements, did the data look good enough as is or should the experiment be longer, is there need for longer ISI, modified stimuli or similar.

What you need to do / What you will do

For the second practical, you will design and create the complete EEG experiment by yourself with Psychophysics toolbox or Presentation software. The rest is similar to what you did in the first practical, so you will measure EEG, analyze the data and write a scientific report.

Some useful links

1. Write a research plan

You will write a research plan for the experiment and return it to the course assistant (one plan per group). The plan will be evaluated, so please be thorough in it.

The plan should include at least the following information:

Working title of the research

Aims of the study / Hypothesis

Measurement setup / Methods

2. Create the EEG experiment script

You will create both the experiment files for the experiment and the stimuli. Simple MMN script using Matlab Psychophysics toolbox will be given as a template. Remember to keep it simple.

I. Experiment creation

Your group has various options in the creation process

  1. Use "Sequence Maker" to create oddball sequence or use the MMN template
  2. Use some ready-made experiment template (from your own research, from internet, example files in help) and modify it accordingly
  3. Start from scratch; slow and tedious method, but practically anything can be done

Option 1, use Sequence Maker / MMN template given during practical session
You will use Sequence maker to create MMN/oddball paradigm similar to Practical 1. NOTE: download the source code (Matlab code) of the program. This process can be done during the 3h computer class session. Sequence Maker is used just to output a basic Presentation/Psychophysics toolbox scenario file, you still have to create the stimuli by yourself. Updated version of Sequence maker should be ready during experiment design sessions.

Option 2, use a ready-made template
Probably the most common method of doing things in practice, as experiments are usually follow-up studies with some modified parameters. Some ready-made experiments are available at archive http://www.neurobs.com/ex_files/, e.g. P300 experiment (Wisconsin card sort) or Sternberg's memory test. Also, you can ask a more experienced researcher using Presentation for a template file.

You can utilize example scenarios that come with Presentation software (for example adaptive staircase method for finding threshold of hearing, some visual discrimination experiment) and check the online help file for hints and useful snippets of code. Most of the included demos seem to use PCL language for their function, so they may be hard to interpret.

Option 3, make your own script from scratch
If you select this, the experiment design should be started as soon as possible. Coding the complete experiment from scratch not possible during 3h computer session.

Our suggestion is to download the required software before and use it. Psychophysics toolbox is free, but Matlab is not. At TKK, Matlab is installed to practically all computer classrooms. Presentation software can be downloaded from http://www.neurobs.com to install the time-limited demo version to some Windows computer. Or, if you have access to Presentation software yourself in your laboratory, use it. Don't use too new features of Presentation, we have version 9.81 currently installed in the EEG laboratory.

Check the included demos and the online help file and remember to output port codes for the EEG acquisition. Anything from 1 to 255 can be used as port code to differentiate your stimuli from each other. For example, in the first practical, only port codes 1 and 2 were used (standard and deviant beep).

II. Create the stimuli

You can use any program you like to create the stimuli. Audio files can be recorded/created with Audacity or in Matlab. If you use downloaded audio files, convert the files to 44.1 kHz or 48 kHz sampling rate in Audacity. Matlab .m file to generate sine tones similar to ones in Practical 1 will be given in Experiment design session.

Visual stimuli can be simple bitmaps or video (MPEG/AVI). Bitmap creation and editing is done again with your favorite software. Direct video support in Presentation is quite a new feature, so it should be used with caution (it works at least for longer video clips, but short, repetitive stimulus as video files might be problematic due to jitter). Simple text boxes like instructions for the subject can be created with Presentation.

III. Testing

Test the experiment in Psychophysics toolbox / Presentation BEFORE coming to EEG measurement. Only small changes in Presentation settings can be done right before the experiment.

Note that the audio/video drivers in Windows Vista computers in the main building are limited in such way that exact audio output is not possible with Psychophysics toolbox. The minimum ISI that you can use there is something like 1.2 seconds, shorter ISIs will not work reliably as the audio drivers have a large onset delay. In the EEG laboratory at Magnet house, ISIs down to 0.2 seconds work OK without any problems, even shorter ISIs should be possible after some manual tweaking.

More exact instructions on how to start the Matlab with Psychophysics toolbox will appear here later.

3. EEG experiment

The experiment is done in our lab on the 4th floor of the magnet house Otakaari 5I. If your experiment is at 4 pm make sure you have Jaakko's phone number to get in as the doors are closed.

BE ON TIME! If your exercise starts at 16 it will start at 16:00 (unless otherwise stated).

Even though the computer used for Presentation has network access, take all the required files (both experiment and stimuli) in USB memory stick or CD/DVD as a backup.

What is done during the experiment

  1. Test your experiment in our lab, check that the EEG triggers work and the setup is otherwise ok.
  2. One of you in each group will act as a subject, whose task during the EEG measurement depends on your experiment (it can be passive task as in first practical, or for example a simple response to target stimuli). If you are interested in being a subject, bring a towel so that you can wash the electrode gel out of your hair. The gel itself is in no way harmful and you can also wash it away at home. The others will prepare the EEG cap and use the software.
  3. The testing takes about 15-30 min, preparing takes about 30 min, and the experiment itself should last at max about 45 min (30 min recommended).

4. EEG data analysis

Instructions on how to do the basic analysis in EEGlab: ( .pdf).
Note that now you can concentrate on anything you like in the analysis, even try to go to single-trial analysis or ICA. But still, create some traditional ERP curves to be shown in the report if only possible.

The data analysis practicals are held in computer classroom (see the place from main page)

Some tips and instructions for the data analysis

Speed of the analysis

For speed reasons, it might be a good idea to copy the EEGLab toolbox and the EEG raw files to local temporary directory. With restricted normal user accounts in TKK, one place to copy the files is

%temp%

This redirects in Windows Vista to C:\Users\[username]\AppData\Local\Temp\, which is a local drive (faster than memory stick / network drive) and will not affect your profile size. Still, remember to copy the resulting files to a safe place!

Channel locations

All groups used channels 31 and 32 for the nose reference and EOG (in either order). This information should be written in your notes. However, when you load up your data in EEGLab, Ch31 can be named as 'EOG' and Ch32 as 'ECG'. To overwrite the channel names and locations to your main dataset in EEGlab, go through Edit/Channel locations, or load up the location file and edit it to your needs. Edit the last two lines with Notepad based on what you had. For example, if the Ch31 was your EOG channel (below right eye) and Ch32 your nose reference, the last two lines should be like below

31	      18	 0.62222	     EOG
32	       0	 0.62222	     Ref

First value is the channel number, second value polar angle (0 for the nose reference, similar to Fz which is also in midline), and third value polar radius (distance from Cz).

UPDATE:
Ready-made location files: Ch31=Ref,Ch32=EOG, Ch31=EOG,Ch32=Ref.
Artifact rejection

Traditionally epochs exceeding certain voltage limits (for example -75..75 μV) are rejected, as they are most probably created by extracerebral activity like eyeblinks. Also, with such high values in single epochs the averaging will be more or less messed up. This kind of artifact rejection should be enough for the second practical. For instructions on artifact rejection based on extreme values, see EEGLab tutorial. The safest option is to use semiautomatic rejection even though it takes time: you have to manually go through the data scroll after automatic rejection and accept/reject the artifacts found by EEGlab.

Responses

Those groups who had a task, should also reject the epochs where the subject gave the response due to motor artifacts (this is, in case the responses overlapped the presentation of interesting stimuli). To do this automatically:

  1. Extract a long epoch (-1..2 seconds) around stimuli.
  2. Reject the epochs that contain the trigger for both the desired stimuli and response. Go to Edit/Select epochs/events, write the stimuli AND response port codes (e.g. 'S 1';'S 10') to "Event type" and put tick mark to line end ("Select all BUT these"). Keep the tick mark in "Remove epochs not referenced by any selected event" and press OK.
    EEGlab screenshot on response rejection
  3. Re-extract the data to shorter epochs as in Practical 1.
Shifting the event codes

Some groups had audiovisual stimuli, where the trigger ("Event" in EEGLab) in and the onset of the stimuli did not happen at the same time. To fix this for nicer plots and easier analysis, follow instructions below
Event code shift for the whole EEG dataset

  1. Check the amount you need to shift the triggers in samples. All groups used 500 Hz sampling rate which corresponds to 2 ms sampling interval, so the amount is simply time_in_milliseconds/2 (e.g. 110 for 220 ms shift).
  2. Change window to MATLAB and run following code which shifts ALL events in the EEG data (change SHIFT_VAL if needed)
    SHIFT_VAL=110; % Amount to shift the events in samples 
                   % With 500 Hz sampling rate, value of 110
                   % corresponds to 220 ms shift
    
    for i=1:length(EEG.event),
        EEG.event(i).latency=EEG.event(i).latency+SHIFT_VAL;
    end
    
    Note that variable EEG refers only to the current dataset (all EEG data in this case).
  3. Extract epochs and do further analysis as normal.

Event code shift for EEG dataset(s) where epochs have already been extracted

  1. Check the amount you need to shift the triggers in samples. All groups used 500 Hz sampling rate which corresponds to 2 ms sampling interval, so the amount is simply time_in_milliseconds/2 (e.g. 110 for 220 ms shift).
  2. Change window to MATLAB and run following code (change SHIFT_VAL if needed)
    SHIFT_VAL=110; % Amount to shift the events in samples 
                   % With 500 Hz sampling rate, value of 110
                   % corresponds to 220 ms shift
    
    for i=1:length(EEG.event),
        EEG.event(i).latency=EEG.event(i).latency+SHIFT_VAL;
    end
    
    Note that variable EEG refers only to the current dataset.
  3. Change window back to EEGLab and select menu item Event / Event values. All events should now have the same Latency (ms) value in milliseconds (e.g. 220 ms, not 0 as normally on epoched dataset)
  4. Extract epochs again, with new start and end time (e.g. [-0.1 0.5]) and check the resulting ERP. Note that the NEW end time has to be at least 220 ms earlier than the previous one.

Other problems? First check the Matlab command window for a possible error message. If you're stuck in some part of the EEGLab analysis, send e-mail to Jaakko.

5. Scientific article

You have now done a first EEG pilot experiment and want to report it in some scientific journal. How do you convince the editor that your paper is worth publishing?

Instructions on how to write your article: ( .pdf)

Learn from the first report, and try to improve. The schedule is not too tight, so you can use more time in the writing process. The paper itself and how you have presented your results will be graded and not how you do the measurements or analyze the data. Again, every student hands in an own paper.

Deadline: 31.1. by 15:45. TKK: magnet house, the blue post box on the 4th floor; HY: to Christina Krause: Siltavuorenpenger 20 C, 5th floor.



Tästä sivusta vastaa jkaurama(at)lce.hut.fi
Sivua on viimeksi päivitetty 28.11.2007
URL: http://www.lce.hut.fi/teaching/S-114.3760/