Problem with presenting stimuli in OpenIAT

URL of experiment: https://run.pavlovia.org/Drifters-escape/implicit-association-test/html

Description of the problem: Hi, I have a problem with the presentation of stimuli in an implicit association test. As shown in the attached image, the text “NaN” is on top of the presented picture. It does this in every picture in this specific block, namely when the category “Danish” is to the left. Otherwise, it works perfectly. The problem also occurs when I open the test off-line in PsychoPy.

I have translated the test into Danish, but the problem also seems to occur in other versions of the test, although a bit differently. In other versions available on PsychPy the text on top of the picture is not “NaN”, but rather the last word presented for categorization (in the ‘problematic’ block words and pictures are presented randomly).

I case it has something to do with my computer: I run the latest version of PsychoPy on a MacBook pro (MacOS 10.13.6)

Hopefully, someone can help.
Thank you :slight_smile:

1 Like

I think this is just the text_stim component of the trial not being set to anything. You should be able to either turn it off in the builder or add it to whatever is controlling the loop with the text ‘’, which should render as blank.

1 Like

Would it be alright to ask for an explanation on how to turn off the text_stim component of the trial on the builder? I’ve been running into the OP’s problem as well. Thank you for your help!

@drifters-escape were you able to figure out the issue?

The easiest way is probably to click on it and then go to the “testing” tab and check “disable component”. Or just right-click on it and hit “remove”.

Thanks for your input, but the text_stim component needs to be enabled in the trial because the point of the test is to present affective words and concepts interchangeably. So if the text component is disabled, it will only be a black screen when the word is supposed to be displayed.
As I mentioned, this problem only happens in one particular trial/block, namely when “Danish” and positive words are to the left (the other trial has “Chinese” and positive words to the left). As far as I can tell both trials are controlled by the same code, included below. I can’t wrap my head around why it works perfectly in one trial and not in the other… Does it mean the problem lies somewhere else than in the code, for example in designating conditions and parameters to each trial? I have tried all sorts of adjustments in the .xlsx files that come with the test, but to no avail.

@AmphritriteL, unfortunately, I have not been able to figure this out. I’ll be sure to let you know if I do, and hope you’ll do the same :slight_smile:

The code (line 164):
image_stim = visual.ImageStim(
win=win,
name=‘image_stim’, units=‘height’,
image=‘sin’, mask=None,
ori=0, pos=[0, 0], size=[0.5, 0.5],
color=[1,1,1], colorSpace=‘rgb’, opacity=1,
flipHoriz=False, flipVert=False,
texRes=128, interpolate=True, depth=-1.0)
text_stim = visual.TextStim(win=win, name=‘text_stim’,
text=‘default text’,
font=‘Arial’,
units=‘height’, pos=(0, 0), height=0.05, wrapWidth=None, ori=0,
color=‘white’, colorSpace=‘rgb’, opacity=1,
languageStyle=‘LTR’,
depth=-2.0);

That’s all Python code, which isn’t all that helpful for figuring out the behavior online. Do you have a link to your pavlovia repository? Be sure to make it public (settings -> permissions).

It’s almost certainly an issue of the conditions file, but I need a closer look at the actual code to be sure.

Ahh… I’m pretty new to this.
Here is the pavlovia repository: https://gitlab.pavlovia.org/Drifters-escape/implicit
Here is a link to the test if you want to try it out: https://pavlovia.org/run/Drifters-escape/implicit/html/

Thanks alot!

I fiddled around with the code with some friends (who were CS majors) last night, and we were able to remove the text! What we did was insert text_stim.setText(“”) right under the line of code reading currentLoop = trials

@drifters_escape your best bet is probably to put a blank space or the text “” in the cells where there is no text stim.

I found that a space character worked in PsychoPy, while an empty cell worked in PsychoJS. To be clear, I was assigning a variable read from my Excel conditions file to the text field of a text component and I wanted the text to show up as blank when there was no value in the cell of the conditions file. In PsychoPy, the text showed up as blank when the cell contained a space character, but showed up as ‘default text’ when the cell was empty. In PsychoJS, the text showed up as blank when the cell was empty, but showed up as ‘NaN’ when the cell contained a space character.

It is possible to maintain two different Excel conditions files, one for PsychoPy in the main project folder and one for PsychoJS in the html/resources/ folder, but only when the conditions file is not directly referenced in a loop, but referenced indirectly via a variable (itself defined in a code component). If the conditions file is directly referenced in a loop, the version that is in the html/resources/ folder is overwritten by the version that is in the main project folder every time the project is synched.

1 Like

Hi, I have a similar problem in which I’m trying to pull an empty text from the excel condition file. In Pavlovia I get “NaN” instead of nothing… When there is text, it works well. Does anyone have a solution for this?

https://pavlovia.org/Weinbach/iat_weight_o1

My solution was to add the following code onto the JS section of “Begin Routine” for the “check_correct” component in the “trial” routine:

if (stimWord == "empty") {
    text_stim.setText("");
}

And then in the .xlsx files, I wrote “empty” (no quotations) where there is an empty cell for stimWord.

2 Likes

Hi! I need to bring this up again, because I have the same issue with NaN appearing when there is a space in the condition file, while I want it to show a blank screen.
Thanks for sharing this piece of code, but may I ask you if I need to add this is in the .js file by opening it on Coder? Because I made the mistake to edit it directly through gitlab and I created other issues. If I open it on Coder will I still be able to see the updates even if my whole experiment is made on Builder?

You could use the solution I present here (which I used in my edition of public-iat): "NaN" appears when using spacebar to denote empty cell in pavlovia - #18 by wakecarter