From Lupyan_Lab_Wiki
Jump to: navigation, search


Exercise 8[edit]

In this exercise, you will write a script that's going be useful for when you want to be blind to the conditions in your study. You will code(rename) the stimuli with random letters & numbers. Your script should also output a file called key.txt that contains the information needed to identify the stimuli after study completion.


There are two directories in your dropbox.

  • pos_gaped - 58 Positve images: Mainly by human and animal babies as well as nature sceneries.
  • neu_gaped - 45 Neutral images: Mainly inanimate objects

These are a small subset of images from the Geneva Affective Picture Database (GAPED). If you're interested in the GAPED you can find more info at the lab's website and this research article. The complete stimulus set can be downloaded here here.


  • Have the script make two new directories (cond1, cond2).
  • Randomly assign the positive and neutral images to a condition.
  • Rename each image with a random numbers/letters code and copy it into its appropriate condition directory.
  • Write the following attributes to key.txt:
    • Condition (cond1, cond2)
    • Code (new filename)
    • Old filename
    • Old directory (pos_gaped, neu_gaped).

Useful python commands[edit]

shutil.copyfile and os.makedirs will be useful for this exercise. Examples are posted on the Python part of the wiki.