Can't get results properly recorded

PennController for IBEX Forums Support Can't get results properly recorded

Tagged: 

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #5002
    kaylac
    Participant

    Hi,

    I am writing a script to integrate Stroop tasks and self-paced reading task. I have added .log() to newKey element and Controller-DashedSentence element, but I can’t get proper results.

    The stroop keys are 1, 2, and 3, corresponding to charcodes 49, 50, and 51. The code can run well but I got “NA … (failed keypresses happened)” every time in the result file. This is my code:

    newText("stroop_word", row.Word)
        .color(row.FontColourCode)
        .css("font-size", "1.5em")
        .print("center at 50%", "middle at 37.5%")
    ,
    newTimer("delay1", 1000)
        .start()
    , //timer.stop will stop timer and will not continue it again
    newKey("re_stroop", 49, 50, 51)
        .callback(getTimer("delay1").stop())
        .log()
    ,
    getTimer("delay1")
        .wait()
    ,
    getText("stroop_word")
        .remove()
    ,
    newTimer(200)
        .start()
        .wait()

    Then the Controller-DashedSentence can’t get the reaction times for every word. In the result file, all the words in the same sentence have the same event time, but I’m sure I press the space bar slowly so that there must be some gap between each word. Below is my code. The results of Controller-Question element are fine, but I included the code to be complete.

    newController("DashedSentence",{s:row.Sentence})
        .center()
        .print("center at 50%", "middle at 37%")
        .log()
        .wait()
        .remove()
    ,
    newTimer(200)
        .start()
        .wait()
    ,
    newController("Question", {q:row.Question, as: ["yes","no"]})
        .center()
        .print("center at 50%", "middle at 44.5%")
        .log()
        .wait()
        .remove()
    ,
    newTimer(200)
        .start()
        .wait()

    Could you help me figure out the problem? Thanks a lot!

    #5003
    kaylac
    Participant

    Hi,

    The problem of Controller-DashedSentence is solved. I see there is another column called “reading time” that shows the reading times for every word.

    However, I still can’t get the keypress recorded. Here is one line in the result file: “1586082589,1baa4fb752f7ebba39b52132ef756e46,PennController,1,0,test,NULL,Key,re_stroop,Key,NA,Never,undefined,(failed keypresses happened)”. I am sure that I have pressed the key because the .callback(getTimer("delay1").stop()) executed well. I tried to put the .log() before the .callback(getTimer("delay1").stop()) (i.e. right after newKey("re_stroop", 49, 50, 51)), but I still get “NA … (failed keypresses happened)”.

    I also tried:

    newKey("re_stroop", 49, 50, 51)
        .log()
        .wait()

    I can get the keypress recorded by this code. A line of result: “1586081680,1baa4fb752f7ebba39b52132ef756e46,PennController,1,0,test,NULL,Key,re_stroop,PressedKey,2,1586081657979,undefined,Wait success”, but it seems that .log() can’t work along with .callback()?

    #5004
    Jeremy
    Keymaster

    Hi,

    Yes, by default the log command on the Key element will only record keypresses corresponding to a wait command, in an effort to reduce the number of lines it adds to the results file (participants can technically press the same key many times in the course of one trial). In your case you probably want to use .log("first") to record the first keypress that happens. More info on the documentation.

    Jeremy

    #5005
    kaylac
    Participant

    Hi Jeremy,

    Thanks for you reply. I read the documentation and tried it. Good news is that the .log(“first”) does work, but the problem is that it seems that the key element must receive a response before the script can go on. If I disable the key after time out, the script will get stuck at the end of the trial; if I don’t disable it, it will record the keypress that doesn’t correspond to the Stroop trial but the comprehension question later in the trial (the response key for the comprehension question is the same as that of Stroop). Could you help me out?

    Best,
    Kayla

    #5006
    Jeremy
    Keymaster

    Well, this is a bug, I’ll fix it in the next release

    In the meantime you can use .log("all") which does not bug and still records the first (and subsequent) keypress(es)

    Jeremy

    #5007
    kaylac
    Participant

    I found the speeded-decision example provided by this website and got inspired! I used a selector and four dummy text to record the results and it works well. Thank you for your reply and developing new versions of PennController. It would be more convenient if we can get results directly from the key element and .log(). Good luck!

    Kayla

    #6848
    Elise
    Participant

    Hi Jeremy,

    I have the same problem as Kayla. I also cannot use .log(“first”) or .log(“all”) for the same reasons and I additionally need the script to report when no key is pressed.

    Is there already any fix? I am not sure how to implement the alternative that Kayla proposed. I would really appreciate any help!

    Elise

    #6849
    Jeremy
    Keymaster

    Hi Elise,

    I’m confused, why can’t you use .log("all")?

    In any case, yes, the bug has been fixed in newer releases of PennController. Here is a minimal adaptation of the Stroop Task template which gives 2s to press the F or J key and will log whether/which key was pressed: https://farm.pcibex.net/r/CNZftL/

    Jeremy

    #6850
    Elise
    Participant

    Hi Jeremy,

    Thanks for the fast reply!

    I couldn’t use .log(“all”), because when no key was pressed the participant had to confirm a timeout message with another keypress. So instead of getting a “Never” in the results file, it saved the keypress from the timeout message.
    Anyway, I now managed to implement the workaround and it works perfectly fine.

    Thanks a lot for your help!

    Elise

    #6851
    Jeremy
    Keymaster

    Oh, I see, then you could have disabled the Key element after the timeout has elapsed, but it’s great if the workaround did the job

    Jeremy

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