psychopy.org | Reference | Downloads | Github

Will not load stimuli

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): 10.13.6
PsychoPy version (e.g. 1.84.x): 3.1.5
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?: present experiment, it will not load.

I have an experiment that will present a stimuli (.bmps or sound), then loop through 4 questions prompting for categorical responses.

I am getting the following error for the stimuli:

#### Running: /Users/casey/Desktop/ratings_study_AN/FacesRatings_lastrun.py ####
2019-08-27 12:39:24.357 python[60310:9949611] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)
Traceback (most recent call last):
  File "/Users/casey/Desktop/ratings_study_AN/FacesRatings_lastrun.py", line 225, in <module>
    face.setImage((StimName+'.bmp'))
TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U21') dtype('<U21') dtype('<U21')

What did you try to make it work?:

I thought there might be a problem with calling to the stimuli as I am using filenames within an excel without extensions. The variable column is named “StimName” and I am calling ($StimName+’.bmp’)

To verify that this wasn’t the problem, I modified the faces/houses demo so that the extensions were removed from the excel and called, instead, to ($stimFile+’.jpg’) -->> This worked but my experiment didn’t.

My files are named 1-48 (as in: 1.bmp, 2.bmp, 3.bmp) is that a problem?

Might be a couple of issues here.

Firstly, remove the round brackets around (StimName+'.bmp'). This makes the value a tuple containing a string, rather than just the string itself. (A tuple is like a non-modifiable list, and you want to pass a single value, rather than a list).

Secondly, if your conditions file contains just numbers in the StimName column, Builder will likely interpret those values as numbers rather than strings. So to construct the filenames, you should explicitly convert them so they can be added to the .bmp string suffix, like this:

$str(StimName) + '.bmp'

Thank you! That fixes it!