EEG Methods for the Psychological Sciences
Publication Year: 2014
“A unique and important resource, full of critical practical knowledge and technical details made readily accessible.”
- Tiffany Ito, University of Colorado at Boulder
“A comprehensive and engaging guide to EEG methods in social neuroscience; Dickter and Kiefabber offer practical details for conducting EEG research in a social/personality lab, with a broad perspective on how neuroscience can inform psychology. This is a unique and invaluable resource - a must-have for scientists interested in the social brain.”
- David M. Amodio, New York University
Electroencephalography (EEG) has seen a dramatic increase in application as a research tool in the psychological sciences in recent years.
This book provides an introduction to the technology and techniques of EEG in the context of social and cognitive neuroscience research that will appeal to investigators (students ...
- Front Matter
- Back Matter
- Subject Index
- Chapter 1: Introduction to Social Neuroscience
- Chapter 2: From Cortex to Computer: The Principles of Recording EEG
- Chapter 3: The EEG Laboratory
- Chapter 4: Getting Started with Data Analysis: Data Pre-Processing
- Chapter 5: Time-Domain Analysis
- Chapter 6: Frequency-Domain Analysis
- Chapter 7: Time-Frequency Analysis
- Chapter 8: Current Domains and Future Directions
SAGE has been part of the global academic community since 1965, supporting high quality research and learning that transforms society and our understanding of individuals, groups, and cultures. SAGE is the independent, innovative, natural home for authors, editors and societies who share our commitment and passion for the social sciences.
Find out more at: http://www.sagepublications.com
© Cheryl L. Dickter and Paul D. Kieffaber 2014
First published 2014
Apart from any fair dealing for the purposes of research or private study, or criticism or review, as permitted under the Copyright, Designs and Patents Act, 1988, this publication may be reproduced, stored or transmitted in any form, or by any means, only with the prior permission in writing of the publishers, or in the case of reprographic reproduction, in accordance with the terms of licences issued by the Copyright Licensing Agency. Enquiries concerning reproduction outside those terms should be sent to the publishers.
An imprint of SAGE Publications Ltd
1 Oliver's Yard
55 City Road
London EC1Y 1SP
SAGE Publications Inc.
2455 Teller Road
Thousand Oaks, California 91320
SAGE Publications India Pvt Ltd
B 1/I 1 Mohan Cooperative Industrial Area
New Delhi 110 044
SAGE Publications Asia-Pacific Pte Ltd
3 Church Street
#10-04 Samsung Hub
Library of Congress Control Number: 2013937182
British Library Cataloguing in Publication data
A catalogue record for this book is available from the British Library
ISBN 978-1-4462-8300-4 (pbk)
Editor: Michael Carmichael
Editorial assistant: Keri Dickens
Production editor: Imogen Roome
Copyeditor: Elaine Leek
Proofreader: Mary Dalton
Indexer: Adam Pozner
Marketing manager: Alison Borg
Cover design: Wendy Scott
Typeset by: C&M Digitals (P) Ltd, Chennai, India
Printed in India at Replika Press Pvt Ltd
About the Authors
Neuroscience methods have become integrated with nearly all domains of psychological inquiry over the past several decades. Once thought to be an archaic technology likely to fade into the shadow of techniques like functional magnetic resonance imaging, electroencephalography (EEG) as a research tool in social and personality psychology has instead seen dramatic increases in application. This trend is likely due to both rapid advances in desktop computing, making possible highly sophisticated analysis of the information-rich EEG signals, and to the afford-ability and accessibility of EEG by comparison with other brain imaging technologies. Our foremost goal in authoring this book was to provide an introduction to the technology and techniques of EEG in the context of social neuroscience research that would appeal to both individuals wishing to broaden their research aims to include EEG measures and to individuals already using EEG, but wishing to develop a better understanding of the technology and methods. This book provides an introduction to the theory, technology, and techniques of EEG data analysis with a focus on providing practical skills required to engage this popular technology.
Beginning with a brief history of EEG and an important background in the neural basis and electric principles involved in recording EEG, readers will be introduced to many practical considerations of EEG recordings and guidelines for the configuration of an EEG laboratory including hardware and software considerations. This book will also provide readers with practical skills required to perform conventional analyses with EEG data in the context of contemporary social neuroscience research. Analyses covered include event-related potentials, spectral asymmetry, and time-frequency analysis. For each type of analysis, we provide a conceptual background, a review of the application of that method to contemporary research within the fields of social and personality psychology, and a guided analysis including step-by-step instruction for performing the analysis in EEGlab. Sample datasets are provided for each of the analyses on a companion website (http://www.sagepub.co.uk/dickter). Finally, we end with a review of several additional research areas within social and personality psychology to provide a demonstration of how EEG measures have been used to answer important research questions, and provide suggestions for future directions for using EEG methods to study additional social and personality psychological issues.
This book will likely be particularly appealing to new investigators setting up an EEG laboratory, especially those in the social and personality psychology fields. In addition, researchers who already use EEG techniques in their laboratory will find this book useful as an instruction manual to help new research assistants with [Page ix]background and instructional information. This book will also serve well as a textbook in a graduate or an upper-division undergraduate course in any area of behavioral neuroscience such as social neuroscience or cognitive neuroscience, as it provides a solid introduction to EEG and its techniques while also supplying datasets with step-by-step instructions in which students will be able to obtain practical experience with EEG data analysis using free, easily accessible software. Finally, this book is a good reference text for graduate students, post-doctoral students, and faculty studying social and personality psychology who currently employ EEG techniques.[Page x]
Appendix: Generating a Simple Experiment with PsychoPy[Page 145]Introduction to PsychoPy
PsychoPy (Peirce, 2009) is an open-source application for the design and presentation of experimental protocols for a wide range of neuroscience, psychology, and psychophysics research. PsychoPy is a free, powerful alternative to Presentation™ or E-Prime™ and is written in Python, a free alternative to Matlab™. To begin programming an experiment, you must first download and follow the installation instructions for PsychoPy (http://www.psychopy.org/). The following tutorial was generated using version 1.76.00. However, because PsychoPy is under perpetual development, you may notice subtle changes to the user interface. All screen captures of the PsychoPy interface were reproduced with permission.
One advantage of PsychoPy is that it offers the full flexibility of the Python programming language but additionally includes a user-friendly GUI, obviating knowledge of the Python programming language. In fact, there are three ways to generate experiments with PsychoPy. The GUI, called the ‘Builder view’, provides a simple user interface for anyone with or without knowledge of programming in Python. The ‘Coder view’ permits basic interaction with the Python code underlying the experiment generation in the Builder view and is best for individuals with some knowledge of programming, but who are less experienced with Python. Finally, the application programming interface (API) provides a complete interface between Python and PsychoPy for experienced Python programmers. In the demonstration that follows, we will provide an introduction to generating a simple experiment in the Builder view with a simple example of how to insert time-locking triggers for an EEG-based experiment.
Begin by opening the stand-alone PsychoPy application. You will notice that there are several frames internal to the GUI. The central frame displays the current timeline. This frame will be used to visualize the component timing for each routine. The components that can be part of each routine include stimulus events such as the presentation of text, images, and videos and/or response events such as key [Page 146]presses and verbal responses. Routines in PsychoPy describe the major elements of the experimental procedure. For example a ‘trial’ routine might contain all of the events (e.g., stimulus, response, and feedback) that constitute a single trial of the experiment. The flow of the various routines over the course of the experiment is displayed as a flowchart in the ‘Flow’ frame at the bottom of the GUI. Finally, the ‘Components’ frame on the right of the GUI provides an interactive list the various components (i.e., events) available (see Figure A1).Figure A1Components of the Protocol
Before beginning to build an experiment, it is important to have a clear idea about the major components of the protocol and how they will be compiled into routines and ultimately constitute the flow of the experiment. For present purposes, we will develop an experiment that is similar to that used by Dickter and Gyurovski (2012) which was used to generate the data for the guided analysis in Chapter 5. Briefly, the protocol involved an impression-formation procedure wherein participants' expectations regarding the race of a subsequent target were persuaded by a descriptive sentence read by participants immediately prior to seeing a target image consisting of a Black or White male. The sentences could be positive or negative in valence and consistent with stereotypes associated with either Black or White Americans. Target stimuli consisted of headshot photographs of Black and White males. Each trial consisted of a fixation cross which appeared for 500 ms, followed by the impression-formation sentence (which remained on the screen until participants indicated by button press that they had finished reading), [Page 147]followed by the target face, which remained on the screen for 500 ms. Participants were asked to indicate whether the target could be the person described in the preceding sentence by pressing one of two keys on the keyboard. The inter-trial interval (ITI) varied randomly between 2000 and 4000 ms. The experimental task included five blocks of 16 trials each. EEG data were time-locked to the onset of the target faces. From this description, the major elements of the protocol can be distilled in terms of components, routines, and flow. These elements are depicted in Figure A2.Figure A2
As is illustrated in Figure A2, the procedure can be conceptualized as consisting of two primary routines. The first is the Impression Formation Routine, which begins with a fixation cross and ends when the participant responds to indicate he/she is finished reading the impression formation sentence. The second is the Target Image routine, which presents the target image and then collects the participant's response regarding the perceived association between the content of the sentence and the individual pictured in the target image. Thus, the first step is to create placeholders for these two routines. Click ‘Insert Routine’ button on the left side of the ‘Flow’ frame at the bottom of the GUI and select ‘(new)’. Enter a name for the first routine (e.g., ‘Impression Formation’) and click ‘OK’. Then click on a position to the right of the default ‘Trial’ routine in the flowchart in order to place the new routine. Repeat this process to create a Target Image routine to the left of the Impression Formation routine. Finally, right-click the default ‘Trial’ routine and [Page 148]select ‘Remove’ to delete that routine. Notice that each of the routines has its own tab labeled at the top of the timeline window. Select the Impression Formation tab before continuing.Impression Formation RoutineFixation Cross
The first component of the Impression Formation routine is the fixation cross, which is presented to the center of the monitor and remains on screen for 500 ms. Click the ‘Text’ icon in the Components frame of the GUI. This will open a ‘Text Properties’ dialog with various presentation options (see Figure A3). There are many parameters that can be set using this dialog. For present purposes, enter ‘Fixation’ in the ‘Name $’ field, change the ‘Stop’ duration to 0.5 seconds, change the color to black by right-clicking inside the ‘Color’ field and using the color-picker, and change the ‘Letter height’ to 0.1. Finally, enter a ‘+’ in the ‘Text’ field (this is the text that will be displayed). Press ‘OK’ to insert the text component into the Trial routine's timeline.Figure A3[Page 149]Sentence
The next component of each trial is the impression-formation sentence, which is displayed to the screen until the participant presses a key to indicate that he/she has finished reading. Again, click the ‘Text’ icon in the Components frame of the GUI to open a new ‘Text Properties’ dialog (see Figure A4). This time, enter ‘Sentence’ for the name, set the ‘Start time (s)’ to 0.5 so that the sentence appears immediately following the fixation cross. Next, set the stop duration to infinite by leaving the field blank, and set the color to black. Entering the literal text of each sentence into the ‘Text’ field (like we did with the fixation cross) would require the creation of as many separate text displays as there were sentences to be presented. Instead, we will take advantage of PsychoPy's ability to load information from external files and use the information in those lists to automatically populate the ‘Text’ field on each trial. For now, simply leave the default value of the ‘Text’ field. Press ‘OK’ to insert the Sentence component into the timeline.Figure A4Sentence Response
Recall that we set the duration of the Sentence component to be infinite. Thus, we need a way to terminate the display of the sentence once the participant has [Page 150]finished reading. Click the ‘Keyboard’ icon in the Components frame of the GUI to open the ‘Keyboard Properties’ dialog (see Figure A5). Enter a name for this component (e.g., ‘Sentence_resp’). Set the ‘Start’ time to 1.5 seconds in order to make the keyboard response available to participants no sooner than 1 second following the onset of the sentence (recall that the first 0.5 seconds of the routine consists only of the fixation cross). Next, set the ‘Stop’ duration to be infinite (by leaving the field blank). This will cause the experiment to pause indefinitely until a response is pressed. Check the box next to ‘Force end of Routine’. Enter the word ‘space’ (including quotation marks) into the ‘Allowed keys $’ field so that the only legal response to the sentence is the spacebar. Finally, use the drop-down menu to set the value of the ‘Store’ parameter to ‘nothing’ since we are not interested in logging response data here.Figure A5Target Image Routine
Before continuing to construct the Target Image routine, be sure to select the ‘Target Image’ tab at the top of the timeline window. Notice that the timeline associated with the Target Image routine is empty.Target Image
The first component of the Target Image routine is the image itself. Click the ‘Image’ component in the Components frame on the right to open the ‘Image Properties’ dialog (see Figure A6). Enter a name for the image component (e.g., ‘TargetImage’) and set the Start time and duration to 0.0 and 0.5 seconds [Page 151]respectively. Leave the ‘Image’ field at its default value. Similar to the Sentence component above, we will later use PsychoPy's ability to import trial information from an external file so that it is not necessary to create a separate image component for each of the faces we wish to show. Click ‘OK’ to place the TargetImage component in the timeline.Figure A6Target Response
The second component of the Target Image routine is the response by the participant, indicating whether they believe that the sentence described the person in the target image. This can be accomplished in the same way that responses were required following presentation of the sentence in the Impression Formation routine. In short, we will present a text message following the target image and then place a keyboard component to collect the response. In the TargetImage routine, click the ‘Text’ component to add the message text and open the ‘Text Properties’ dialog (see Figure A7). Enter a name for the component in the ‘Name’ field (e.g., ‘TargetResponseText’). Enter 0.5 for the ‘Start’ time so that it immediately follows the target image. Set the ‘Stop’ time to be infinite (i.e., leave field [Page 152][Page 153]blank) so that the component remains on screen indefinitely or until a response is made. Set the color to black. Enter the text message for participants in the ‘Text’ field (e.g., ‘Does the sentence describe the person in the image? … Enter Y for YES or N for NO’). Click ‘OK’ to insert the text component into the timeline. Next, click to add a ‘Keyboard’ component. Enter a name (e.g., ‘TargetResponse’) for the component. Set the start time to 0.5 so that response collection becomes available at the offset of the target image and set the duration to be infinite (i.e., leave the ‘Stop’ field empty). Next, enter ‘y’,‘n’ in the ‘Allowed keys $’ field. Finally, ensure that the ‘Force end of Routine’ option is selected and that ‘last key’ is selected for the ‘Store’ option (this tells PsychoPy to record the response made by participants).Figure A7
Having created the two primary routines for the experiment, the next step is to consider the flow of the experiment. For example, Dickter and Gyurovski (2012) separated each trial by an inter-trial interval that varied randomly between 2 and 4 seconds. One simple way to place an interval between trials is to add a routine with a blank Text component that follows Target Image routine. Click the ‘Insert Routine’ button on the bottom left of the GUI and select ‘(new)’. Type a name for the [Page 154]new routine (e.g., ‘ITI’) and press ‘OK’. Click on the icon for the new ITI routine in the flowchart and then click to add a Text component (see Figure A8). Give the component a name (e.g., ‘RandomITI’), leave the ‘Start’ time at 0 seconds and set the ‘Stop’ duration to ‘random.uniform(2,4)’, which is a python function that will return a random number drawn from a uniform distribution over the interval 2 to 4 seconds. Then delete any text in the ‘Text’ field and press ‘OK’.Figure A8
Because the RandomITI component uses the ‘random.uniform’ function, which is not available by default in PsychoPy, it is necessary to import the ‘random’ library (a collection of functions) when the experiment is executed. To do this, click the ‘Code’ component in the Components frame to open the ‘Code Properties’ dialog. Code components permit the insertion of Python code into an experiment, providing a great deal of additional flexibility. Enter a name for the component (e.g., ‘ImportLibraries’) and enter the text ‘import random’ to the ‘Begin Experiment’ field, then click ‘OK’ (see Figure A9).Figure A9[Page 155]Using Loops to Create Blocks of Trials
At this point all of the components necessary to generate a block of trials are now in place. Each trial will begin with the Impression Formation routine, followed by the Target Image and ITI routines. Trial blocks can be created in PsychoPy using a ‘loop’ that will repeat the presentation of these routines a number of times. Click the ‘Insert Loop’ button at the bottom left corner of the GUI. Then click at a point just to the left of the Impression Formation routine and then again at a point just to the right of the ITI routine to indicate the start and end points in the loop. When the ‘Loop Properties’ dialog appears (see Figure A10), enter a name for the loop (e.g., ‘BlockLoop’) and set the ‘nReps’ field to 1 (this will make sense soon). The experiment now consists of a single trial, as described by Dickter and Gyurovski (2012), and should appear similar to Figure A11. You may want to save your experiment at this point by selecting ‘File>Save as’ and entering a name for the experiment (e.g., ‘MyExperiment.psyexp’).Figure A10Figure A11
The purpose of this loop added in the previous step is to repeat the series of components that make up each trial. Setting the ‘nReps’ field of the BlockLoop properties dialog to 16 would yield a full block of 16 trial repetitions, but the text of the sentence presented by the Sentence component and the image presented by the TargetImage component would be the same on each cycle of the loop. Recall that we earlier left the ‘Text’ field of the Impression Formation component and the ‘Image’ field of the Target Image component at their default values because we would later add functions to automatically populate the fields using a list of trial parameters. In order to automatically populate those fields on each cycle of the loop, we will attach a list of values to the BlockLoop loop. This list can be conveniently stored in either a comma-delimited (i.e., CSV) text file or a Microsoft™ Excel spreadsheet (XLSX format only!). The list must be formatted such that the values of each variable are listed in a separate column and the first row of the list contains [Page 156][Page 157]variable labels. For example, in order to provide PsychoPy with a unique sentence for each cycle of the Impression Formation component and a unique image for each cycle of the Target Image component, we will generate a list with two columns, one labeled ‘SentenceText’ and the other labeled ‘TargetFile’. Each row of the Sentence-Text column contains a complete sentence to be used by the Impression Formation component. Each row of the TargetFile column contains the complete file path of an image file. Images for this sample experiment were generated using the FaceGen Modeler software (Toronto, on; http://www.facegen.com) and can be found in the ‘Faces’ folder on the companion website (http://www.sagepub.co.uk/dickter). Be sure to place a copy of the ‘Faces’ folder in the same directory as your PsychoPy experiment. Finally, create a comma-delimited list using your favorite text editor (see Figure A12) or mstm Excel and save the file to the same directory as your experiment (e.g., ‘TrialInfo.csv’).Figure A12
Once the list has been created, it is necessary to attach the list to the BlockLoop loop. Click once on the ‘BlockLoop’ label in the flowchart inside the ‘Flow’ frame to open the ‘BlockLoop Properties’ dialog. Click the ‘Browse’ button next to the ‘conditionsFile’ field and then select the ‘TrialInfo.xlsx’ file created in the previous step. If the file loads without any errors, the number of conditions (i.e., trials; 16) and parameters (i.e., columns; 2) will be displayed inside the ‘BlockLoop Properties’ window (see Figure A13).Figure A13
Notice that because the list has 16 conditions, a single cycle of the BlockLoop loop is interpreted as one cycle of the list of 16 trials. Next, it is necessary to instruct the Sentence component about which column of the list contains the sentences and instruct the Target Image component about which column contains the image filenames we wish to display. Click the icon for the Impression Formation routine in the flowchart, then click on the Sentence component (anywhere in the timeline) to open the Sentence properties. Type ‘$SentenceText’ into the ‘Text’ field of the properties dialog and click ‘OK’. The dollar symbol instructs PsychoPy that what follows is the name of a variable (i.e., parameter) rather than the literal text we wish to display. In this case, the variable ‘SentenceText’ refers to that column of the ‘TrialInfo’ file [Page 158]attached to the loop. It is also necessary to select ‘set every repeat’ in the drop-down menu to the right of the ‘Text’ field in order to let PsychoPy know that the text will be changing from trial to trial. Next, click the icon for the Target Image routine in the flowchart, then the Target Image component in the timeline to open the Target Image properties dialog. Enter ‘$TargetFile’ into the ‘Image’ field of the dialog, instructing PsychoPy to use the image files designated on each row of the TargetFile column in the TrialInfo file. Select ‘set every repeat’ from the drop-down menu to the right of the ‘Image’ field. Save your work (‘File>Save’).Controlling the Flow of the Experiment
As it stands, the experiment will cycle randomly through the list of 16 sentence-image pairs a total of one time. We could repeat the BlockLoop loop four times instead of just once in order to achieve the desired number of trials; however, doing so would simply repeat the trials seamlessly in one block of 64 trials. The purpose of dividing the trials into blocks of 16 is usually to provide participants with a chance to rest periodically throughout the experiment. Thus, it is necessary to provide an occasional respite from the experiment, by placing a break routine to follow the BlockLoop loop. Click ‘Insert Routine’ in the Flow frame of the GUI and select ‘(new)’. Type a name (e.g., ‘Break’) for the break routine, press ‘OK’, and place the Break to the right of the BlockLoop loop (see Figure A14). Now select the Break routine and add two components to the timeline. Add a Text component that includes a brief text message to the participants, such as, ‘Take a break and press any key when you are ready to [Page 159]continue’. Set the start time of the Text component to zero and set its duration to infinite (i.e., leave the ‘Duration’ field blank). Next, add the ‘Keyboard’ component. Set the start time of the keyboard component to 1 and the duration to be infinite. Leave the ‘Allowed keys’ field empty (this will permit any response) and select the check-box for ‘Force end of routine’, which will force termination of the Break routine as soon as a key is pressed and allow the experiment to proceed.Figure A14
Notice that the Break routine, combined with the components of the BlockLoop loop, constitutes all of the elements needed for the experimental procedure – that is, a block of 16 trials followed by a brief break. All that is needed is to instruct PsychoPy to repeat these routines a total of four times using a routine loop. Click ‘Insert Loop’ and then click on the left side of Impression Formation routine in the flowchart to indicate where the loop will start and then click to the right of the Break routine to indicate where the loop will stop. Enter a name for the loop (e.g., ‘ExperimentLoop’) and set the ‘nReps’ field to 4. The ExperimentLoop loop will repeat the BlockLoop and Break routines a total of four times (see Figure A14), yielding the desired total number of 64 trials separated into blocks of 16.
If you were to run the experiment at this point, the program would immediately begin with the first trial. Although verbal instructions can be provided to the participant prior to execution of the task, it is common to present task instructions to the computer screen. To add an instructions screen at the beginning of the experiment, click the ‘Insert Routine’ button in the Flow frame and select ‘(new)’. Provide a name for the new routine (e.g., ‘Instructions’) and place it at the very beginning of the flow chart. Next, click the new Instructions icon in the flowchart to view its timeline. Add a Text component to the timeline and name it ‘InstructionsText’. Set ‘Duration’ to be infinite (leave it blank), change the ‘Color’ property of the InstructionsText component to black and enter the text of the instructions into the ‘Text’ field. Next, add a keyboard component and give it a name (e.g., ‘Inst_resp’). Set the duration to be infinite and leave the ‘Allowed keys’ field blank (i.e., any response is allowed). Be sure the ‘Force end of Routine’ option is selected and click ‘OK’. The Instructions routine will now display the InstructionsText component and wait (indefinitely) for a keypress. Once a key is pressed, the routine will terminate and PsychoPy will move on to the ExperimentLoop routine. The experiment is now ready to run. Save your work!Adding Triggers for Time-Locking ERPs
At this point, the experiment is complete. However, if one wishes to use the experiment in conjunction with EEG recordings, it is necessary to add a little Python code for sending event triggers over the parallel port to an EEG acquisition system. In fact, there are a number of ways to accomplish this task of interacting with the parallel port and not all solutions will work with all systems. Solutions will sometimes also vary by operating system (e.g., Windows, Mac, Linux), making it difficult to provide a complete guide for setting up EEG [Page 160]triggers. Here, we provide an outline of just one solution that worked in our lab on both Windows XP (32-bit) and Windows 7 (32-bit) computers. There are two prerequisite steps that must be completed prior to modifying the PsychoPy experiment to send event triggers. The first requirement is that a ‘driver’ must be installed that permits communication between Python and the parallel port. The present method of event triggering will make use of the ‘DLPORTIO’ (short for DriverLINX Port I/O) driver, which is widely used and freely available on the Web (a self-installing executable is available from http://real.kiev.ua/2010/11/29/dlportio-and-32-bit-windows). The second prerequisite is that one must know the physical ‘address’ of the parallel port on the computer. This can most easily be obtained in Windows by the following steps: (1) click the ‘Start’ button, (2) right-click ‘Computer’ (or ‘My Computer’ if using Windows XP), (3) select ‘Manage’, (4) click ‘Device Manager’ in the left frame of the Computer Management window, (5) click the ‘+’ symbol next to ‘Ports (COM & LTP)’, (6) right-click the label referring to your parallel port in the list of devices and select ‘Properties’, (7) click the ‘Resources’ tab in the Properties window. The port's address will be listed in hexadecimal format next to the label ‘I/O Range’. The hexadecimal address (e.g., D050) can be converted to decimal format (e.g., 53328), which is the address of the port that will be provided to PsychoPy.
The primary aim of this experiment is to measure ERPs to the onset of the face stimuli. Thus, the goal is to send event triggers that are synchronized to the onset of the Target Image component of the Target_Image routine. To insert the event triggers, select the Target_Image routine to view its associated timeline. Next, click the ‘Code’ component in the Components frame to open the ‘Code Properties’ dialog. Give the Code component a name (e.g., ‘Trigger’) and fill in the fields of the ‘Code Properties’ dialog as specified in Figure A15, replacing ‘53328’ with the parallel port address retrieved in the previous step. Note that you should check the resolution of the digital input on your EEG amplifier. Digital inputs commonly have a resolution of 8 bits, meaning that they can only resolve 256 (28) unique values, meaning that you will only be able to use event trigger values ranging from 1 to 256.Figure A15
Table A1 Field Name Value Explanation Begin Experiment from psychopy import parallel Import the ‘parallel’ module parallel.setPortAddress(#) Set the ‘address’ of the parallel port to # Begin Routine parallel.setData(VALUE) Send a trigger value to the port Each Frame End Routine parallel.setData(0) Close the port by sending a value of 0 End Experiment
[Page 161]These instructions describe EEG trigger synchronization in its most elementary form. That is, the program was instructed to send a trigger at the same time that it began the Target Image routine. In practice, however, the start time of a Routine [Page 162]and the time at which an image actually appears on the monitor may not be very precise, leading to some variability in the timing of EEG triggers and stimulus presentation. This is where some familiarity with Python can help. For example, PsychoPy includes a ‘callOnFlip’ function that attempts to synchronize the execution of Python commands with a particular stimulus display. It is highly recommended that users explore options like this for improving stimulus timing in cases where precise synchronization is required.References2012). The effects of expectancy violations on early attention to race in an impression-formation paradigm. Social Neuroscience, 7(3), 240–251. http://dx.doi.org/10.1080/17470919.2011.609906, & (2007). PsychoPy – Psychophysics software in Python. Journal of Neuroscience Methods, 162(1–2), 8–13. http://dx.doi.org/10.1016/j.jneumeth.2006.11.017(