About recording key response reaction time

PennController for IBEX Forums Support About recording key response reaction time

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9729
    xkyan
    Participant

    Hi Jeremy!

    I encountered a problem in recording the key response time.

    
        // set key response
        newKey("flan_RespKey", "FJ")
            .log("flan_RespKey", getKey("flan_RespKey"))
            .wait()
            .callback(
                getVar("RT1").set( v => Date.now() - v )
                    .log( "flanRT" , getVar("RT1") )
            )
        ,
        // record RT
        getVar("RT1").set( v => Date.now() - v )
            .log( "flanRT" , getVar("RT1") )
    

    What I want to have in the result file is a column “flanRT” that records the duration that subjects take to press on either F or J. Currently what I have is “Wait success” in the result file. I understand that we can always calculate it by subtracting the event times. I’m just curious if we can get this calculated results in the result file directly. Thank you for your help in advance!

    Best,
    Karen

    #9744
    Jeremy
    Keymaster

    Hi Karen,

    You don’t need the callback here, since you already have a wait that ensures that the following code will always be executed after the key has been pressed

    You also seem to confuse key.log and var.log with newTrial().log

    newTrial(
        // ...
        newVar("RT1").global().set( () => Date.now() )
        ,
        newKey("flan_RespKey", "FJ")
            .log()
            .wait()
        ,
        getVar("RT1").set( v => Date.now() - v )
        // ...
    )
    .log("flanRT",getVar("RT1"))

    Jeremy

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.