J Edyta
J Edyta

Reputation: 13

Defining a correct answer for a staircase in PsychoPy

I am tring to create a task were right or left oriented gabor is presented at the middle of the screen. Then 'right' is a correct key for the right-oriented gabor, and 'left' for the left-oriented one. When I use the loopType (in trials Properties):

  1. random - I can define the correct answer in the "conditions" file, but then I do not know how to add the staircase (adding another loop does not help)
  2. staircase - I get the parameters of the staircase, but I do not know how to add a "correct answer" (which depends on the orientation of the stimuli). By code component? What should I write there?
  3. interleaved staircases - I do not know how to define both: the correct answers and the parameters of the staircase in the 'conditions' file (so PsychoPy did not tread different rows as different trials).

I apologize for these probably very basic questions, but I am just starting with programming. I would be very happy if someone could help me with this staircase.

Upvotes: 1

Views: 885

Answers (1)

Jon
Jon

Reputation: 1223

When you add a response option, like a Keyboard Component that supports the option of Storing Correct and, when you tick that box you can specify what the correct answer should be on this trial (a variable with value matching a key name). See the demos, like stroop task, where we set a correct answer key.

So then the question is how to make your stimulus come up in different orientations and connect that to a particular response. You could do this with a single staircase (from what you've told us so far) not interleaved ones and then you'd need a code component in your trial that did something like this in the Begin Routine code section:

if random()>0.5: # 50:50 probability
    ori = 45
    corrAns = 'left'
else:
    ori = -45
    corrAns = 'right'
# store the info we created in the data file
trials.addOtherData('corrAns', corrAns)
trials.addOtherData('ori', ori)

Then set your keyboard response to treat $corrAns to detect correct response

Upvotes: 1

Related Questions