0

I just downloaded psychopy this morning and have spent the day trying to figure out how to work with builder view. I watched the youtube video "Build your first PsychoPy experiment (Stroop task)" by Jon Pierce. In his video he was explaining how to make a conditions file with excel that would be used in his experiment. I wanted to make a very similar test where images would appear and subjects would be required to give a yes or no answer to them (the correct answer is already predefined). In his conditions file he had the columns 'word' 'colour' and 'corrANS'. I was wondering if instead of a 'word' column, I can have an 'image' column. In this column I would like to upload all my images to them in the same way I would words, and have them correlated to a correct answer of either 'yes' or 'no'. We tried doing this and uploaded images to the conditions file, but we haven't had any success in running the test successfully and were hoping somebody could help us.

Thank you in advance.

P.S. we are not familiar with python, or code in general, so we were hoping to get this running using the builder view.

EDIT: Here is the error message we are receiving when running the program

#### Running: C:\Users\mr00004\Desktop\New folder\1_lastrun.py

4.8397 ERROR Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path? Traceback (most recent call last): File "C:\Users\mr00004\Desktop\New folder\1_lastrun.py", line 174, in image.setImage(images) File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\image.py", line 271, in setImage maskParams=self.maskParams, forcePOW2=False) File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.80.03-py2.7.egg\psychopy\visual\basevisual.py", line 652, in createTexture % (tex, os.path.abspath(tex))#ensure we quit OSError: Couldn't find image file 'C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide102.JPG'; check path? (tried: C:\Users\mr00004\Desktop\New folder\PPT Retention 1\ Slide102.JPG)

2 Answers2

1

Yes, certainly, that is exactly how PsychoPy is designed to work. Simply place the image names in a column in your conditions file. You can then use the name of that column in the Builder Image component's "Image" field. The appropriate image file for a given trial will be selected.

It is difficult to help you further, though, as you haven't specified what went wrong. "we haven't had any success" doesn't give us much to go on.

Common problems:

(1) Make sure you use full filenames, including extensions (.jpg, .png, etc). These aren't always visible in Windows at least I think, but they are needed by Python.

(2) Have the images in the right place. If you just use a bare filename (e.g. image01.jpg), then PsychoPy will expect that the file is in the same directory as your Builder .psyexp file. If you want to tidy the images away, you could put them in a subfolder. If so, you need to specify a relative path along with the filename (e.g. images/image01.jpg).

(3) Avoid full paths (starting at the root level of your disk): they are prone to errors, and stop the experiment being portable to different locations or computers.

(4) Regardless of platform, use forward slashes (/) not backslashes (\) in your paths.

Michael MacAskill
  • 2,411
  • 1
  • 16
  • 28
  • Thank you for your help! I’ve edited my question to include the error message. We changed everything to be saved to the same folder. We also tried switching the slashes around as well, wich didn't work. Is the way in which we put the file name of the images in the excel conditions file correct? This is an example of what we had inside one cell of image column in Excel: C:/Users/mr00004/Desktop/New folder/PPT Retention 1/ Slide10.JPG perhaps the way we are inputting this command into Excel is incorrect(this was tried with both forward and backslashes) Thank you! – user3850647 Jul 18 '14 at 18:44
  • As recommended above, don't use full paths to your file, they only cause heartache. The entries in your conditions file should just look like this: 'PPT Retention 1/Slide102.JPG' (without the quotes). At a guess, I would say the problem is that you have a space character before your filenames (i.e. between the last slash and the first character of the filename). Remove that and see what happens. It is often worth pasting text like this into a plain text editor to spot things like this: it isn't obvious in Excel. – Michael MacAskill Jul 20 '14 at 21:16
0

make a new folder in H drive and fill in the column of image in psychopy as e.g. 'H:\psych\cat.jpg' it works for me

Ika
  • 1