Howdy, Stranger!

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

Supported by

Accuracy feedback after setting 'correct' in inline script

edited October 2015 in OpenSesame

Possibly something very trivial:
I'm using an inline python script to set the accuracy of a response based on where the participant clicks the mouse in the display (using the 'correct' variable). If I then try to give feedback using 'acc', only the last response is provided, not the average. How do I change this to the percentage correct?
Thanks!

Comments

  • edited October 2015

    Hi,

    You said you're using an inline_script to set the accuracy of a response. Do you mean the accuracy of a single response, e.g. the further away from a target, the lower the acc? If so, then the variable acc is only the last response per definition. Why not create a variable that is updated with every response, so that it represents the average accuracy across trials? You could keep the original acc variable, and create a list (before entering the block loop) by means of resp_accs = [].
    In the inline script in the block loop, below the line where you create acc you can add the lines

      resp_accs.append(acc)
      exp.set('average_acc', round((sum(resp_accs)/float(len(resp_accs))),2)
    

    Cheers,

    Josh

  • edited June 2016

    Thanks! It worked when I changed the code slightly:

    av_correct=100*sum(resp_accs)/len(resp_accs)

    exp.set('Av_acc',av_correct)

  • edited 9:58AM

    Hi Frouke,

    You could also use the set_response() function, which will update the feedback variables automatically:

    Cheers!
    Sebastiaan

Sign In or Register to comment.