ebook img

Building experiments in PsychoPy PDF

353 Pages·2018·4.928 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Building experiments in PsychoPy

Building Experiments in PsychoPy 2 Building Experiments in PsychoPy Jonathan Peirce & Michael MacAskill 3 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 Mathura Road New Delhi 110 044 SAGE Publications Asia-Pacific Pte Ltd 3 Church Street #10-04 Samsung Hub Singapore 049483 © Jonathan Peirce and Michael MacAskill 2018 First published 2018 Original creation of PyschoPy software Jonathan Peirce © all screenshots taken directly from PyschoPy, created and maintained by Jonathan Peirce, notable contributors: Jeremy Gray, Sol Simpson, Mike MacAskill, Jonas Lindelшv, Richard Hцchenberger, Hiroyuki Sogo, Yaroslav Halchenko, Erik Kastman, William Hogman, Ilixa Ltd., Gary Strangman. PsychoPy is developed almost entirely by volunteers, please see a full list of contributors at Ohloh.net 4 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. Library of Congress Control Number: 2017958160 British Library Cataloguing in Publication data A catalogue record for this book is available from the British Library ISBN 978-1-4739-9138-5 ISBN 978-1-4739-9139-2 (pbk) Editor: Becky Taylor Editorial assistant: Katie Rabot Production editor: Imogen Roome Copyeditor: Neville Hankins Proofreader: Neil Dowden Marketing manager: Lucia Sweet Cover design: Wendy Scott Typeset by: C&M Digitals (P) Ltd, Chennai, India Printed in the UK 5 Contents Acknowledgments How to use your book 1 Introduction 1.1 Creating experiments 1.2 Building versus coding 1.3 Pros and cons of open-source software 1.4 Understanding your computer 1.5 What is PsychoPy? 1.6 Getting started 1.7 Going further 1.8 Conventions of this book I For the beginner 2 Building your first experiment 2.1 The Builder interface 2.2 Building the Stroop task 2.3 Define your conditions 2.4 Defining the trial structure 2.5 Adding a loop to repeat trials 2.6 Varying your stimuli on each trial 2.7 Add some instructions 2.8 Add a thank-you slide 2.9 Changing your info dialog 2.10 Analyze your data 3 Using images: a study into face perception 3.1 Accuracy versus reaction time 3.2 Testing face recognition 3.3 Image sizes in different units 3.4 Comparing inverted and correctly oriented faces 3.5 Additional options for images 3.6 Using Opacity 3.7 Using Masks 3.8 Present a movie instead of an image 4 Timing and brief stimuli: Posner cueing 4.1 Presenting brief stimuli precisely 4.2 Posner cueing 5 Creating dynamic stimuli (revealing text and moving stimuli) 5.1 What does dynamic mean and why is it useful? 6 5.2 Inserting code into parameters 5.3 Example 1: Revealing text gradually 5.4 Example 2: Spinning, expanding images 5.5 Example 3: Change colors through the rainbow 5.6 Example 4: Make a heart that has a pulse 5.7 Going further 6 Providing feedback: simple Code Components 6.1 Providing feedback 6.2 Updating the feedback color 6.3 Reporting the reaction time 6.4 Ideas for useful code snippets 6.5 Reporting performance over the last five trials 7 Ratings: measure the ‘Big 5’ personality constructs 7.1 Instruments for the measurement of personality 7.2 Categories, Likert or continuous ratings 7.3 Controlling when the Rating is finalized 7.4 What to store 7.5 Finishing your task and scoring the data 8 Randomization, blocks and counterbalancing: a bilingual Stroop task 8.1 Blocking trials 8.2 The bilingual Stroop task 8.3 Build a blocked version of the Stroop task 9 Using the mouse for input: creating a visual search task 9.1 Getting spatial responses 9.2 Visual search 9.3 Implementing the task 9.4 Introducing the Mouse Component 9.5 Control stimulus visibility from a conditions file 9.6 Control stimulus positions using code 9.7 Responding to mouse clicks spatially 9.8 Selectively skipping a routine 9.9 Making smooth trial transitions 9.10 Pointing rather than clicking II For the professional 10 Implementing research designs with randomization 10.1 How can we assign subjects to conditions or groups? 10.2 Understanding loop ordering options 10.3 Summary 11 Coordinates and color spaces 11.1 Coordinate systems 7 11.2 Color spaces 11.3 Phase of textures 12 Understanding your computer timing issues 12.1 Understanding screen refresh rates 12.2 Testing your stimulus timing 12.3 Timing by screen refresh 12.4 Images and timing 12.5 Response-time precision 13 Monitors and Monitor Center 13.1 Computer display technology 13.2 Monitor Center 13.3 Monitor calibration 13.4 Spatial calibration 13.5 Gamma correction 13.6 Color calibration 13.7 Procedure 14 Debugging your experiment 14.1 Common mistakes 14.2 Common error and warning messages and what they mean 14.3 How to debug an experiment 14.4 Writing a better query to the forum 15 Pro tips, tricks and lesser-known features 15.1 Adding a README file to your experiment 15.2 Expand or shrink the Flow and Routine 15.3 Copying and pasting Routines and Components 15.4 Online repositories for sharing your experiments 15.5 Using variables from the dialog box in your experiment 15.6 Controlling names of your data files and folders 15.7 Running in windowed mode 15.8 Recreating your data files 15.9 Skipping a part of your experiment 15.10 Turn tips back on III For the specialist 16 Psychophysics, stimuli and staircases 16.1 Gratings and Gabors 16.2 Smooth-edged masks (Gaussian and raised cosine) 16.3 Using images as masks 16.4 Element arrays 16.5 Random Dot Kinematograms 8 16.6 Staircase and QUEST procedures 17 Building an fMRI study 17.1 Detecting trigger pulses 17.2 Non-slip timing 17.3 How to calibrate a monitor for fmri 18 Building an EEG study 18.1 What is special about EEG studies? 18.2 Sending EEG triggers 18.3 Communicating by parallel port or LabJack 18.4 Sending EEG triggers by network connections 18.5 Using custom libraries 19 Add eye tracking to your experiment 19.1 Eye tracking in Builder 19.2 Configuring ioHub 19.3 Programming ioHub 19.4 Add eye tracking to the visual search task 19.5 Data storage via ioHub 19.6 Saving image stimuli to disk 19.7 Conclusion Appendix A Mathematics refresher A.1 Sine and cosine A.2 Rescaling and changing start points A.3 Pythagoras’ Theorem Appendix B Exercise Solutions Bibliography Index 9 Acknowledgments This book wouldn’t have been possible without the help and support of many people. Jon is very grateful to the support he has had from his family who have at times been left holding the baby (literally) while he has spent his evenings and weekends writing this book. Shiri Einav, in particular, has often had to fill in the bits of life that he hasn’t been doing while working on this endeavor! Michael thanks Sarah Kirk and Paige MacAskill for putting up with his absences on the home front. He’d also like to thank Jon himself, for creating PsychoPy in the first place, but also setting the tone for the good-natured and enthusiastic community that has grown up around it. Our respective institutions (University of Nottingham and New Zealand Brain Research Institute) have paid us throughout this period and allowed us to work on these projects, for which we are also grateful. It hasn’t just been about the writing of the book though. The book couldn’t have been written without PsychoPy and there are many more people involved in that project that must all be thanked. PsychoPy is a community project, driven by people volunteering their time, in between running experiments and teaching students in their universities. These volunteers are helping in various ways: some are writing the software itself and fixing bugs they find; others are helping out on the forum so that new users can get their questions answered. The people asking those questions also contribute, by showing where software features aren’t obvious or need improvement, and what sorts of areas need to be covered in a book like this. A few of the contributors need special mention because of the vast number of hours they have put into the project. Jeremy Gray and Sol Simpson have both put in ridiculously large amounts of time in both development and user support. Some very notable features are theirs entirely (like the Rating Scale and the ioHub) but they have contributed to code across the entire project. They, and their families, have sacrificed a lot for the sake of this project, for no financial gain, solely to help users run experiments. Richard Höchenberger, Hiroyuki Sogo, Jonas Lindeløv, Damien Mannion, Daniel Riggs, Oliver Clark, Yaroslav Halchenko, Jan Freyberg and Eric 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.