Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Defining many variable (i.e. 7 ) in one inline script and then using them one by one in a loop item

edited May 2018 in OpenSesame


Very new to OpenSesame, python and psychopy so apologise.
I am using a MacBook pro 2017.

1) I have defined 7 variables/objects in one inline script by using the GratingStim class. Each variable acts as a different level of 2 of my experimental variables defined in the loop item. I am using somethng like this


var.noise_rc = GratingStim(win, tex='raisedCos', mask='gauss', sf=0.9, size=1000, phase=0.3, opacity=1, contrast=Noise_rc)


on 7 different occasions so is like noise_rc, noise_rc_2 etc up to 7.
All this is done in the Prepare window and the inline script that I define all these is before the loop item.

noise_rc is then defined in as level on two variable sin the loop, however I am getting this:
" python2.7/site-packages/libopensesame/", line 161, in _exec
exec(bytecode, self._globals)
Inline script, line 20, in
NameError: name 'noise_rc' is not defined"

how can I define all this variables and feed them to the loop item without problems? Do psychopy objects requires specific things to be able to do that?
2) I want one variable to be presented before and after the target in congruent and incongruent style. so one inline script to define these variables is OK, no?

Preliminary version




  • Hi Stavros,


    Does it work if you use var.noise_rc?


    Yes, one script should be fine. The exact implementation depends on what it is exactly that you want to present. But with the right if/else construction you should be good.


Sign In or Register to comment.