psychopy.org | Reference | Downloads | Github

Unable to provide accuracy feedback

In my online experiment, I want to start the main experiment only if participants get an accuracy score of more than 75 percent in the practice session. I am able to test for just a few images, such as 1-4 images (total will be 8 images with the requirement of scoring correctly for 6 images), then the experiment ends by this error. TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit

I assumed the problem derives from the fact that answers in “Resp1” should contain the capitals letter, for example, the allowed keys are “x,” “y,” “X,” “Y.” Despite the fact that in the file that loads in pracTrialLoop, the $correctAns variable is set to either “x” or “y”. I’d tried only to set lower case letter or disabling/enabling my caption key while testing the experiment, but it had no effect. My guess is that the error stems from the codes I applied, but I’m not sure where I went wrong. Any suggestions about how to resolve this issue will be greatly appreciated!

noted that I set nReps to 8 in the pracTrialLoop.

Here are the codes that I implemented for both countCorrt and Feedback:
For countCorrt:

  • Before Experiment:
    nCorrect=0
  • End Routine
    if prackey_resp.corr:
    nCorrect += 1
    if (pracTrialLoop.thisN+1)%8 and nCorrect >= 6/8:
    pracTrialLoop.finished = True
    else:
    nCorrect = 0

For Feedback:

  • Begin Experiment:

if prackey_resp.corr:
msg= “Correct”
else:
msg = “Sorry, incorrect”

MacOS 11.3.1 BigSur
PsychoPy version (2.10)

I used the following issues as a reference point in case someone else runs into a related problem:

Change this to snapshot.thisN on the JS side only (switch the code component to Both)

Thank you for your response; however, it only succeeds in part because the feedback seems to be missing. It did not show how accurate the participants would be by the end of the practice. I thought the codes in the feedback will print out the accuracy in the end.

Is it possible to end the experiment if the participants’ accuracy falls below 75% after this practice session?

Thank you so much!

This should be Begin Routine in a code component above the text.

One way of ending an experiment is to have a routine that only ends if performance is high enough.

I tried implementing the codes in the Begin Routine component either in the Feedback routine or countCorrt routine, but none of them shows any feedback. Noted that the prackey_resp is the variable name defined for Keyboard response in the Resp1 routine

Can you see why Begin Experiment isn’t going to work?

Try moving the code component above the text component in your feedback routine.

Will make sense to you if I create a routine after Feedback and implement the codes below in the code coponenment in End Routine

if (nCorrect >= (6 / 8)) {
continueRoutine = true;
}

thanks!

There is rarely any reason to write this because it’s the default. You write continureRoutine=False when you want to end a routine early.

thanks a lot, it works now :slight_smile: