Logging key press for each trial within template?

PennController for IBEX Forums Support Logging key press for each trial within template?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9741
    mwf2120
    Participant

    Hi! I have set up a trial template, and its working great, except that the output is hard to use. Ideally, I’d like for each time that the spacebar is clicked in each trial to be logged in a new column (named, for example, “ResponseTime1”, “ResponseTime2”). I’d also like for the identifier (randomized as either “friend”, “stranger”, “thief”, or “ball”) and video stimuli that they see to be logged in new columns (named, for example, “Identifier1” and “VideoFile1”). As of now, each of the text input and key press selections are in one column, and its hard to use. I plan to combine this with Qualtrics data, so would like new columns for each element within participants’ trials.

    Is there a way to do this?

    Here is the template code:

    Template(
        GetTable("eCIDEx.csv")
        ,
        row => newTrial("Experiment1",
            newText(row.identifier)
                .css("font-size", "2.5em")
                .css("text-align", "center")
                .settings.center()
                .print()
                .log()
            ,
            newVideo(row.videofile)
                .size("60vw", "auto")
                .settings.center()
                .print()
                .play()
                .disable(0.01)
                .log()
            ,
            newTimer("7.2s", 7200).start()
            ,
            newKey(" ").log("last").callback( getTimer("7.2s").stop() )
            ,
            getTimer("7.2s").wait()
            , 
            getVideo(row.videofile)
                .remove()
            ,
            newImage("Fix", "Focus_Point.jpg")
                .settings.center()
                .print("middle at 50%", "middle at 50%")
            ,
            newTimer("Timer1", 1000).start()
            .wait()
        )
        .log("id", getVar("subjID"))
        .log("identifier", row.identifier)
        .log("videofile", row.videofile)
        .log("qualID", getVar("qualID"))
    )
    • This topic was modified 1 year, 4 months ago by mwf2120.
    #9748
    Jeremy
    Keymaster

    Hi,

    The identifier and video file are already logged as extra columns in the code that you posted. As far as I can tell, there is a single response time in that code, which corresponds to how much time elapsed since the beginning of the timer and when the participant presses space. So you could add a Var element to log the response time as an extra column like this:

    Template( "eCIDEx.csv" , row => 
        newTrial("Experiment1",
            newText(row.identifier)
                .css("font-size", "2.5em")
                .css("text-align", "center")
                .settings.center()
                .print()
                .log()
            ,
            newVideo(row.videofile)
                .size("60vw", "auto")
                .settings.center()
                .print()
                .play()
                .disable(0.01)
                .log()
            ,
            newVar("RT").global().set( () => Date.now() )
            ,
            newTimer("7.2s", 7200).start()
            ,
            newKey(" ").log("last").callback( getTimer("7.2s").stop() )
            ,
            getTimer("7.2s").wait()
            ,
            getVar("RT").set( v => Date.now() - v )
            ,
            getVideo(row.videofile).remove()
            ,
            newImage("Fix", "Focus_Point.jpg")
                .center()
                .print("middle at 50%", "middle at 50%")
            ,
            newTimer("Timer1", 1000).start().wait()
        )
        .log("id", getVar("subjID"))
        .log("identifier", row.identifier)
        .log("videofile", row.videofile)
        .log("ResponseTime", getVar("RT"))
        .log("qualID", getVar("qualID"))
    )

    Then you can systematically look at a single line in the results file (eg. the Text element’s log line) and get all the information you want in it

    Jeremy

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