Changing coherence with simple staircase

256 views
Skip to first unread message

Luke Bratton

unread,
Feb 22, 2015, 1:27:51 PM2/22/15
to psychop...@googlegroups.com
Hi all,

I'm in builder view, on OS X 10.10, with the PsychoPy v1.81.03.

I'm building an experiment whereby a RDK moves left or right with varying coherence levels to test the threshold for motion coherence.

I'm simply trying to make the coherence variable of a dotStim hook up to the simple staircase (i.e. I want coherence to change by my step size).
Nothing I type in the coherence parameter box seems to give it access to the step sizes. Any idea what i'm doing wrong?

Thanks,
Luke.

Axel Kohler

unread,
Feb 23, 2015, 3:26:07 AM2/23/15
to psychop...@googlegroups.com

Hi Luke,

I do feel that the documentation especially for the Builder part should be enhanced here. Maybe I overlooked something, but there are a few things you have to do to use the staircase in the builder:

  1. The only thing the staircase loop will provide automatically is a level variable that contains the current level value for your staircase.
  2. First, you need to hook up this level variable with your stimulus coherence. So in your Dots component, coherence should be defined as $level (don't forget "set every repeat"). Now, you already need a code component because you will get an error since level won't be defined yet at the beginning of the experiment. In the "Begin Experiment" tab of your code component, add "level = 1.0" (this has no effect; just to get no error). For now, you'll get the random dots at a constant coherence value corresponding to your staircase loop start value; no adaptive part yet.
  3. You need to tell the staircase procedure what the last response was (correct/incorrect) for it to calculate the new coherence value (apply the step size). For a first try, let's just say the response is always correct. Add in the "End Routine" tab of your code component "trials.addResponse(1)".
  4. If you now have in your staircase loop: start value = "1.0", N down = "1", step type = "lin", step sizes = 0.1, you will get a sequence of coherences like "1.0, 0.9, 0.8 ...". For debugging, you can add "print level" in the "End Routine" tab.
  5. Well, that's fine. But now you still have to make the addResponse part consistent with the actual behavior.

I hope this helps a little bit to get started.


Cheers,

Axel

Axel Kohler

unread,
Feb 23, 2015, 4:15:58 AM2/23/15
to psychop...@googlegroups.com

Actually, you don't need to set "level = 1.0" in the "Begin Experiment" tab. It should work alright without it.

Cheers,

Axel

Luke Bratton

unread,
Feb 26, 2015, 7:53:57 AM2/26/15
to psychop...@googlegroups.com
Hi Axel,

Thanks for your reply, I'm using what you recommend and I'll see how it goes.
I agree with you about the documentation for builder, it doesn't seem to tell you how to tie a stimulus parameter to the staircase.

Thanks,
Luke

Luke Bratton

unread,
Feb 26, 2015, 1:20:11 PM2/26/15
to psychop...@googlegroups.com
Hi again,

Upon a little bit of playing around, I have a staircase that changes values in response to correct/incorrect answers. In the output file there is a column which alters a value based on my response, in an increment of my staircase's step size (great); however, the visual display of dots does not actually change in coherence.

In other words, the stimulus isn't being updated with the new coherence value on screen (in each trial it simply reappears with the initial value).
It appears that defining the coherence of the dots as $level doesn't actually feed that forwards to the next stimulus for some reason.

Am I missing something obvious here do you think?

Thanks again,
Luke.

Axel Kohler

unread,
Feb 26, 2015, 4:36:24 PM2/26/15
to psychop...@googlegroups.com

Hi Luke,

It is sometimes hard to tell visually how the coherence of a random-dot display has changed. A few easy things to check:

  1. Just to be sure: I assume you have set the dropdown menu next to the Dots coherence field to "set every repeat". I know it's trivial, but often I also still forget it.
  2. Compile your Builder experiment to code and (in the Coder) look for a line of code that says "level = thisTrial". Then level is defined and should also be updated. There might be differences between versions etc. So better check.
  3. To make sure that stimulus coherence has actually changed, you can use the debugging code "print dots.coherence" in a code component, similar to what I suggested in a previous response. If coherence changes with your step size, you should be fine.

I definitely have a minimal Builder experiment in which dot coherence is updated. So let me know if you still want to have a look at it.

Best,

Axel

Luke Bratton

unread,
Feb 26, 2015, 5:22:15 PM2/26/15
to psychop...@googlegroups.com
Hi Axel,

Thanks for your responses, you're really helping out.

1) I was pretty certain that it must be something this simple, but it is indeed set to "set every repeat".

2) Having set the basis for the experiment in builder I have now opened the script and continue to work on it entirely in coder view. Level is correctly defined but;

3) upon printing the dot coherence, even though during trials the dot coherence does not appear to change (I am able to respond with 100% accuracy) I record coherence values such as:
"0.506172839506
0.296296296296
0.0987654320988
0.0
0.0
0.0
0.0
0.0
0.0
0.0"
on the first 10 trials, with an initial stepsize of 0.2. Again, I am responding with 100% accuracy to 0.0 coherence...

...Just out of interest I ran the code again, purposefully responding incorrectly to the first 5 trials, and the subsequent trials correctly. My stepsize progresses correctly from 0.2, to 0.1 after the first reversal.

0.506172839506
0.703703703704
0.901234567901
1.0
1.0
0.901234567901
0.802469135802
0.703703703704...

Again that is a large change in coherence, but the 0.5 and the 1.0 levels of coherence look identical.

I must be overlooking something.

Many thanks,

Luke.

Luke Bratton

unread,
Feb 27, 2015, 4:36:33 AM2/27/15
to psychop...@googlegroups.com
Hi again,

The problem I introduced above happens only when the random dots are set to 'walk', but is alleviated when the random dots are set to 'direction' (only tested when the signal dots are set to different).

Could this be just a bug?

Luke.

Axel Kohler

unread,
Feb 27, 2015, 5:25:52 AM2/27/15
to psychop...@googlegroups.com

Hi Luke,

At least for a minimal example, the stimulus seems to work alright with different settings. At least I don't see a reason to assume a major bug for now. Depending on the settings, the subjective appearance of the random-dot displays will vary a lot. Apart from the classical reference, the PsychoPy random dots are based on:

Scase MO, Braddick OJ, Raymond JE (1996) What is noise for the motion system? Vision Res 36:2579–2586


I would suggest reading the following article if you use random dots:

Pilly PK, Seitz AR (2009) What a difference a parameter makes: A psychophysical comparison of random dot motion algorithms. Vision Res 49:1599–1612.


There are many pitfalls when working with random dots.

Best,

Axel
Reply all
Reply to author
Forward
0 new messages