IAT script?

663 views
Skip to first unread message

John Allen

unread,
Nov 1, 2013, 11:55:15 AM11/1/13
to psychop...@googlegroups.com
Does anyone have an IAT script written in PsychoPy that they would be willing to share? [I'd be happy to offer back any code changes we make]

There was a similar post to this back in January but I understand that Matthew ended up using a .Net app called FreeIAT from ncsu rather than using PsychoPy. I'd rather stick with PsychoPy though.

Many thanks,

John

Jeremy Gray

unread,
Nov 1, 2013, 12:13:40 PM11/1/13
to psychop...@googlegroups.com
I have a creative-practical x good-bad IAT (all text) and will send it along in a separate email. Its not yet tidy enough to be a demo included with PsychoPy, but I'm happy to share it with interested people.

--Jeremy


--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/2ee352bf-bbfa-4e21-8d57-579a9d440b07%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Adam Lawrence

unread,
May 14, 2014, 10:00:25 AM5/14/14
to psychop...@googlegroups.com
Hi Jeremy,

Did this IAT script get developed any further? Would it be possible for me to also request a copt of the script?

Many thanks

Adam

Jeremy Gray

unread,
May 14, 2014, 10:03:50 AM5/14/14
to psychop...@googlegroups.com
Hi Andrew,

Yes. An implementation of an IAT (words only) is slated to be in an upcoming release of PsychoPy as a Builder demo. Meanwhile, you can get the same code from here: https://github.com/GrayLabCode/public/tree/master/IAT

--Jeremy


--Jeremy


Adam Lawrence

unread,
May 14, 2014, 10:26:02 AM5/14/14
to psychop...@googlegroups.com
Thanks very much Jeremy.

Adam

Jeremy Gray

unread,
May 14, 2014, 10:27:39 AM5/14/14
to psychop...@googlegroups.com
oops: Adam (not Andrew, sorry!)

--Jeremy


kate.c.d...@gmail.com

unread,
May 14, 2014, 1:36:19 PM5/14/14
to psychop...@googlegroups.com
Hello Jeremy,

I'm also very interested in using the IAT through psychopy but unfortunately, I'm new to psychopy and still very much unsure on using coder.

I have downloaded your IAT scripts (thank you for these) but cannot seem to get them to open on my computer. Is there something I need to do first? Do I need to amend anything before opening them?

Many thanks in advance,
Kate


On Wednesday, May 14, 2014 3:03:50 PM UTC+1, Jeremy wrote:

Jeremy Gray

unread,
May 14, 2014, 1:43:00 PM5/14/14
to psychop...@googlegroups.com
Hi Kate,

To use these scripts, I think you will need a recent-ish version of PsychoPy (1.79.00 works for me, have not tried in 1.80.x). Running the task is done completely through the Builder. Scoring the data is done via command line.

You'll need a folder on your computer that has all of the files from the line (https://github.com/GrayLabCode/public/tree/master/IAT). All are needed. Run the IAT.psyexp script by double clicking, or by dragging to a PsychoPy window or drop on the PsychoPy icon (may depend on your operating system).

If that does not work, please send details about what you tried, what happened, and what OS and version of PsychoPy.

--Jeremy


kate williams

unread,
May 14, 2014, 1:50:33 PM5/14/14
to psychop...@googlegroups.com
Hi Jeremy,

Thanks for getting back to me so quickly. I tried doing that, but for some reason I get an error message back (I've pasted it below). Does that mean anything to you?

Thanks again,
Kate


v1.80.01
Failed to load P:\PhD\Tasks\SC_task\IAT\IAT_psychopy\IAT.psyexp. Please send the following to the PsychoPy user list
Traceback (most recent call last):
  File "C:\Program Files\PsychoPy2\lib\site-packages\psychopy-1.80.01-py2.7.egg\psychopy\app\builder\builder.py", line 4057, in fileOpen
    self.exp.loadFromXML(filename)
  File "C:\Program Files\PsychoPy2\lib\site-packages\psychopy-1.80.01-py2.7.egg\psychopy\app\builder\experiment.py", line 337, in loadFromXML
    self._doc=etree.XML(f.read(),parser)
  File "lxml.etree.pyx", line 2733, in lxml.etree.XML (src/lxml\lxml.etree.c:54427)
  File "parser.pxi", line 1578, in lxml.etree._parseMemoryDocument (src/lxml\lxml.etree.c:82764)
  File "parser.pxi", line 1457, in lxml.etree._parseDoc (src/lxml\lxml.etree.c:81562)
  File "parser.pxi", line 965, in lxml.etree._BaseParser._parseDoc (src/lxml\lxml.etree.c:78232)
  File "parser.pxi", line 569, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml\lxml.etree.c:74488)
  File "parser.pxi", line 650, in lxml.etree._handleParseResult (src/lxml\lxml.etree.c:75379)
  File "parser.pxi", line 590, in lxml.etree._raiseParseError (src/lxml\lxml.etree.c:74712)
XMLSyntaxError: Specification mandate value for attribute data-pjax-transient, line 31, column 40



--
You received this message because you are subscribed to a topic in the Google Groups "psychopy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/psychopy-users/Ips409jq7-Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to psychopy-user...@googlegroups.com.

To post to this group, send email to psychop...@googlegroups.com.

Jeremy Gray

unread,
May 14, 2014, 2:07:31 PM5/14/14
to psychop...@googlegroups.com
This is unfortunate, its not something I can easily fix. The error means that the xml library PsychoPy uses is not able to interpret the .psyexp file (which is in xml format). I don't get an error in 1.79 or 1.80.04, running on Mac.

Hopefully someone else has ideas about the xml parsing, would be nice to know what is going on.

--Jeremy


kate williams

unread,
May 14, 2014, 2:50:37 PM5/14/14
to psychop...@googlegroups.com
Thanks, Jeremy.

Hopefully someone may have an idea,
Kate


Jeremy Gray

unread,
May 15, 2014, 10:11:10 AM5/15/14
to psychop...@googlegroups.com
This issue appears to have been due to copy & paste from github, and is not a limitation or bug in PsychoPy. Just download the files directly.

--Jeremy

Jon Roberts

unread,
May 16, 2014, 4:50:54 PM5/16/14
to psychop...@googlegroups.com
We have put together a python library that can be used in conjunction with PsychoPy for running IAT and GNAT (Go/NoGo) blocks as well as for simple IAT-like Categorization tasks. While we made this for internal use, we are happy to share it with the PsychoPy community. Documentation and a download link can be found at:  http://psych.colorado.edu/wiki/doku.php?id=labs:clipr:iatgnat

We also have a library for presenting a number of different kinds of questionnaire type questions in PsychoPy. Documentaion and download link: http://psych.colorado.edu/wiki/doku.php?id=labs:clipr:qlib

These are both works in progress, so test your program thoroughly before using this code to collect real data. Please tell us of any bugs you find. Suggestions are welcome also...

Jon Roberts
Computer Laboratory for Instruction in Psychological Research
Department of Psychology and Neuroscience
University of Colorado Boulder

Adam Lawrence

unread,
Jun 5, 2014, 10:46:47 AM6/5/14
to psychop...@googlegroups.com
Hi Kate, Just to let you know I was having the same issues till today since I was unfamiliar with how to use GitHub. I've registered an account and been able to download the files correctly and I have it working on my local machine now.

I assume you already have PsychoPy installed
First register for an account on GitHub
Go to the link provided by Jeremy: https://github.com/GrayLabCode/public/blob/master/IAT/IAT.psyexp (This link is for the builder file specifically)
Click the button that says OPEN (It has a little picture of a monitor next to it)
To open the file you will first need to install GitHub for Windows or Mac whichever you have. If you don't have this installed already you will be prompted to do so when you click the OPEN button.
Provided you have GitHub already installed, after a few seconds the GitHub should open the program in PsychoPy.
Once it's loaded you can then save a copy on your local machine.

Hope this helps.

Adam

v.les...@gmail.com

unread,
Dec 2, 2014, 6:43:01 PM12/2/14
to psychop...@googlegroups.com

Hello Jeremy,

 

I am very pleased I found your IAT script. I have to use Cyrillic font, and if I change the stimuli in the csv file I get an error message. I would be very grateful if you could tell me how to fix this, I am very recent to PsychoPy and I don’t know programming.

In addition, I noticed that target and attribute trials in the critical IAT blocks are presented in a randomized fashion. I think, according to Greenwald,  McGhee & Schwartz, (1998)  the trials should be presented in an alternating fashion:

In all combined tasks, items for the target-concept discrimination and the

attribute discrimination appeared on alternating trials.”  p.1467

also in Greenwald, Nosek, and Banaji (2003) :

“The procedure in Blocks 3, 4, 6, and 7 is to alternate trials that present either a pleasant or an

unpleasant word with trials that presented either a Bush or Gore image” p.198

 

 

Thank you in advance.

Best regards

Jeremy Gray

unread,
Dec 2, 2014, 9:29:35 PM12/2/14
to psychop...@googlegroups.com
Hi v.leshoska,
 

I am very pleased I found your IAT script. I have to use Cyrillic font, and if I change the stimuli in the csv file I get an error message. I would be very grateful if you could tell me how to fix this


We can try. Please post the full error message, otherwise its too hard to tell what is happening. 

I put Cyrillic in the CreatPrac.csv file and it worked fine, so its likely that it will work for you eventually.
 

In addition, I noticed that target and attribute trials in the critical IAT blocks are presented in a randomized fashion. I think, according to Greenwald,  McGhee & Schwartz, (1998)  the trials should be presented in an alternating fashion...


There are many IAT variations, including presentation details, and also for scoring. You can adapt the task to meet your needs in whatever way you wish. 

 --Jeremy

vaska leshoska

unread,
Dec 3, 2014, 10:39:27 AM12/3/14
to psychop...@googlegroups.com

Hi Jeremy,


Thank you very much for the prompt reply. I changed the file format from .csv to .xlsx and now it works well (I can write in Cyrillic). Regarding the presentation randomized vs. alternating, I was writing because I don’t know how to adapt the task. It may be done with sequential loop type but I want only attribute vs. concept differentiation to alternate and the stimuli to be random.

 

Best regards

Vaska


--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

Jeremy Gray

unread,
Dec 3, 2014, 10:46:14 AM12/3/14
to psychop...@googlegroups.com
Hi Vaska,

Thank you very much for the prompt reply. I changed the file format from .csv to .xlsx and now it works well (I can write in Cyrillic).


great.
 

Regarding the presentation randomized vs. alternating, I was writing because I don’t know how to adapt the task. It may be done with sequential loop type but I want only attribute vs. concept differentiation to alternate and the stimuli to be random.


I am too busy to help in depth with this. Start with a simpler script, perhaps the stroop demo, and play around with random vs sequential, and so on. That is, learn how things work in a simpler script, and then apply that knowledge to your IAT.

--Jeremy

 
On Wed, Dec 3, 2014 at 3:29 AM, Jeremy Gray <jrg...@gmail.com> wrote:
Hi v.leshoska,
 

I am very pleased I found your IAT script. I have to use Cyrillic font, and if I change the stimuli in the csv file I get an error message. I would be very grateful if you could tell me how to fix this


We can try. Please post the full error message, otherwise its too hard to tell what is happening. 

I put Cyrillic in the CreatPrac.csv file and it worked fine, so its likely that it will work for you eventually.
 

In addition, I noticed that target and attribute trials in the critical IAT blocks are presented in a randomized fashion. I think, according to Greenwald,  McGhee & Schwartz, (1998)  the trials should be presented in an alternating fashion...


There are many IAT variations, including presentation details, and also for scoring. You can adapt the task to meet your needs in whatever way you wish. 

 --Jeremy

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/CANqwJFhYoYZ95R_D8f01g_hsjkSpk%2BmD6121i_EAau%3DPsKqGtQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

vaska leshoska

unread,
Dec 3, 2014, 10:49:16 AM12/3/14
to psychop...@googlegroups.com
Thank you very much.


Best regards

Vaska


Reply all
Reply to author
Forward
0 new messages