Image not appearing on screen

So I have created an image file which I have put into the same file as my PsychoPy2 experiment and my conditions excel doc. In my images file I have the black dot that will precede my sample stimuli, one of the sample stimuli I will be using for my experiment, and the cross that will follow the sample stimuli and precede the comparison stimuli. There is a column in my conditions file titles image_file that has below it those three images with the titles images/47_25_27_29.jpg black-dot.jpg and cross.jpg respectively. I tried putting the place dot image into PsychoPy2 by typing $black-dot.jpg into the image field, but it will not run because it says NameError: name ‘black_dot’ is not defined. How do I define my image?

Update: I have put all of the different images into their own columns and their own image folders (by which i mean the dot is in its own folder, as is the cross, and the sample stimuli are all together in one folder, and the comparison stimuli are together in another). I have finally been able to define my images, or so it says, because now the experiment actually runs when I press the green running man. However, when the experiment runs, instead of the images I put in, i just get blank white screens. Any suggestions on how to fix that?

Hi Finbik,

it results difficult to give you any advice without more details of your experiment.

Just in case, have you checked the images position and size? Specifically, check the units you have set for each of these parameters. It is probable that you are not seeing the images because the size and/or position of it do not show it on the screen.

Good luck with your experiment!

1 Like

I think you may be right, but I’m not sure. I changed the size parameters to be the same width and height as my image, but it just made my white background bigger and still didn’t include my image. Would changing the position help, did I change the size incorrectly, or is there another factor I’m missing? To give you an explanation of the experiment, it is essentially a matching to sample task. Dot, then sample stimuli, then cross, then comparison stimuli. Once the comparison stimuli is on the screen, the participant will have to choose whether it was in the sample or not. Hope that helps you help me. Thanks for the help you’ve given me and the help you will hopefully now also give me.

Hi Finbik,

take a look to the following link:

http://www.psychopy.org/general/units.html#units

If your background turned bigger when you changed the size parameter, then it is probable that you are close to solve it out.

Check also the Monitor Center settings: it is probable that your default monitor is not set as the real size of your screen.

As a general advice: you must “sync” the units of your experiment, the units for size and position for your stimuli, to make it visible in the size of your screen.

Good luck with it!

Fer

I have a conditions folder. In that conditions folder is another folder named Image. In that folder are my stimuli. In my conditions file is a column titled Image_file with my stimuli in it written as image/example.jpg but when I run my experiment I only get a white screen instead of my stimuli. In the Image field of my image component I have inserted $Image_file. Can anyone tell me why my screen is still a white background, and not my stimuli? I have fiddle with the size a bit but when I make it smaller it just becomes a white background in a gray background. Any advice? The stimuli I put directly into my conditions folder show up fine, but the ones in their own image folders aren’t showing up. I need them this way because those stimuli should be different after each repeat.

I don’t believe it is the monitor screen, as my stimuli that aren’t in the images folder are showing up fine.

I’m wondering why you expect the path image/example.jpg would be expected to point to a file that is apparently actually located at conditions/image/example.jpg?

Michael: I am finally getting my image to appear using the path you suggested. Unfortunately, using that rout only lets on of the images in my image folder appear. I want to make it so that after each trial it’ll use a different one of the images in my image folder.

And you have:

  • each of those paths in a conditions file column,
  • with that column name in the image field of an image component, preceded by a $, and
  • the button next to that field set to update “every repeat”,
  • and the conditions file is linked to a loop,
  • the loop is set to cycle through all of the rows in your conditions file, and
  • the loop surrounds the routine that contains the image component?

I only have 2 images in my Image_file now for simplicity. I will add more once I have this figured out. But $Image_file is in the image field, the button is set to “every repeat,” the conditions file is linked to a loop, and the loop surrounds the routine that contains the image component. What needs to be done for the loop to cycle through all of the rows in my condition file?

You don’t have image names defined on each row. So the black dot and cross images for example will only show on the first trial.

This is why you are getting blank images on screen: you’re not informing PsychoPy what to use on each trial. Computers only do what they are told to do.

But if the latter two images are constant in your experiment, they don’t need to be in your conditions file at all. Just put the literal file name (i.e. without the $ prefix) in the image field, and set it to be “constant” rather than update “every repeat”.

should that work?

Disregard that. I didn’t see your last paragraph.

Ok so now my task looks like this and my conditions folder looks like this. While this may help with the dot and the cross, my Image folder (SampleStim in my builder) and CompStim folder are still issues. These are the files that have multiple images because they need to be different for each trial.

Also, in case this wasn’t clear, thank you Michael. I really appreciate all of the help you are giving me.

That image (47_25_27_29w16.jpg) is in my Images folder which should be linked to the Image_file column of my conditions document. My image field still says $Image_file. Do you know what is wrong?

No, you’ve cut off the most informative part of the error message.

But didn’t you establish earlier that these paths are not correct? i.e. image/example.jpg should be something like conditions/image/example.jpg? The path to your image files must be relative to the location of your Builder .psyexp file.

Wouldn’t that only allow for 1 of the images in my image folder to be shown? As in it would only show example1.jpg and never example2.jpg? It needs to be able to show a different image for each trial.

And here’s the rest of the error message. Again, your earlier path suggestion (reiterated in your most recent advice) has succeeded in getting an image to appear, but I need to create a situation in which all of the images in my Image folder can appear in a random order, with a different one appearing for each trial. Does my most recent conditions excel file (unchanged since I posted it last night with my task) solve the problems you mentioned? If so, what problems still remain? And what do I have to do to check if the loop is set to cycle through all of the rows in my conditions file?