| Reference | Downloads | Github

Dual correct answer in one routine

Hello all,

I am working on an experiment where participants are to respond to a test image that has 5 figures presented on the screen. On the left side, the target figure is presented. On the right side, 4 figures are presented where TWO correctly correspond to the target image. The goal is to have participants correctly answer which 2 images correspond to the given target image. The figures are listed 1 - 2 - 3 - 4 respectively.

The images are organized in an Excel file where CorrANS1 and CorrANS2 are identified. Column 1 for the first image, listing first correct response, and column 2 listing the correct 2nd response for the first image. The issue is that for every answer, the reversed presentation is technically considered correct. For example, for the first stimulus, a response of 1 and 3 is correct, as well as 3 and 1.

Attached are images of what my routine currently looks like and variable names.
I am looking for assistance on how to include code to allow reversed responses to be also considered correct with notice in the excel .csv data file.

I separated each stimulus response as one routine in order to use the Forced end routine function to obtain the correct answer. In the correct answer field, I was able to insert $CorrAns1 OR $CorrANS2 although the data file listed all keys in .corr as correct (indicated with ‘1’).

I have tried various custom codes in order to tailor it to my project needs although all seem to run into errors. If there may be a better suggestion in how to best analyze/present my given stimulus, please do share.

Many thanks in advance!

You can have a piece of code that checks keyboard inputs every frame. Assuming CorrAns1 is ‘1’ and CorrAns2 is ‘3’ this should work.

pressedKey = event.getKeys(keyList=['1','2','3','4'])
if len(pressedKey) > 0:
    if num==CorrAns1 or num==CorrAns3:
        corr = True
        corr = False
    continueRoutine = False

Hello niclai,

Thank you for your response!

I have attempted the code in the code component under the each frame tab, although seem to still have issues.

My assumption is because $CorrANS1 and $CorrANS2 refer to the designated correct answer pair for each of the stimuli (photo attached).

So for each stimuli, the answer pair will differ, changing CorrANS1 and CorrANS2 values every time.

I will continue to work with the code you have provided. If you have other tips/suggestions, please let me know. Thank you so much for you help.

That should work. Please could you show your code?

Sorry – when do you want the routine to end? When two keys have been pressed?

continueRoutine=True does nothing.
You should delete you keyboard component since you are using one in the code.

Hello wakecarter,

Thank you for your assistance!
I prefer to have my routine end when the entire block of stimuli (20) has been completed. I’m not sure if this is optimal way to set it up although this is what I have so far.

In my testing loop, it has one routine for first answer, a blank (.5 s duration), another routine for the second answer, followed by another blank (.5s duration again).

Each of the answer inputs are forced end routines. By your suggestion, I will remove the keyboard component, although I assume I would need other specific code to verify my key inputs.

Ideally, I wish for the 2 key responses participants make to be assessed as correct (reversed or not) by their order in the excel, following the $CorrANS1 and $CorrANS2 columns.

Many thanks in advance!

I’m sorry but this doesn’t make sense with the PsychoPy meaning of the word routine (which you have in the following paragraph).

I’m suggesting that you have one routine in your testing loop with presents your stimuli and then waits for two keyboard responses (which would need to be coded). Is there a reason why you want the two responses to be in separate routines? If so then you could just add scoring code in the End Routine tab for each of the two.

Hello wakecarter,

I apologize, I seem to be using Psychopy terminology incorrectly.

Below I have a photo to show my routines; the block of stimuli I was referring to are my test stimuli images denoted with $ in the excel that are presented in 20 rows. Each testing trial has a keyboard component to register a participant’s first (testingtrials1) and second (testingtrials2) response for the same stimuli image.

In one loop, the same stimuli image is presented twice in which the participant is to respond 2x with a keyboard press. The keyboard presses are separated since testingtrials1 and 2 are forced end routines.

In this photo, my .csv file shows the output of the stimuli and keyboard presses I have ran. Ideally, I wish to have some code that allows for the reversed sequence of dual answers (in respTest1.keys and respTest2.keys) to be correct (.corr) in a separate column (i.e. in the far right side highlighted in orange). Just as in Stimuli/Test/1.png, the correct answer that a participant is to respond with is 1 (CorrANS1) and 3 (CorrANS2), although I have inputted 3 and 1 – which is technically still correct.

I had the two responses in separate routines in order to see the exact responses participants selected per stimuli to limit confusion. I’m unfamiliar with the scoring code although if that seems to be a better set-up for this design, I can give it a try. I’m not sure if in that case a keyboard component would be re-added?

Many thanks once again.