Log additional data from table with DashedSentence

PennController for IBEX Forums Support Log additional data from table with DashedSentence

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4184
    adamliter
    Participant

    Is it possible to log additional information from a CSV via DashedSentence? I have not been able to find a straightforward way to do this. Here’s a minimal main.js file (taken from the documentation). How would I additionally log “Condition” in each row that DashedSentence generates? Is there a straightforward way to do this in PCIbex?

    PennController.ResetPrefix(null);
    
    PennController.AddTable( "mytable" ,
        "Type,Condition,Sentence\n"+
        "Test,A,The cat that is chasing the mouse runs fast\n"+
        "Test,B,The mouse that the cat is chasing runs fast"
    );
    PennController.Template( "mytable" ,
        row => [
            "DashedSentence", {s: row.Sentence},
        ]
    );
    • This topic was modified 5 years ago by adamliter.
    #4187
    Jeremy
    Keymaster

    Hi Adam,

    Unfortunately the only way to add columns to your results file at the moment is to use .log which is only defined on the object returned by PennController(), so it’s not possible to use it with the DashedSentence controller…

    One option would be to re-code the DashedSentence controller, but unfortunately there seems to be a bug with having multiple Key elements using the same key within the same trial… So the code below is functional but will fail to log response times!

    dashed = (sentence, remove) => {
      let words = sentence.split(' ');
      let blanks = sentence.split(' ').map(w=>w.split('').map(c=>'_').join(''));
      let textName = 'dashed'+words.join('');
      let cmds = [
        newText(textName, blanks.join(' '))
          .print()
      ];
      for (let i = 0; i < words.length; i++){
        cmds.push(newKey('dashed'+i+words[i], " ").settings.log().wait());
        cmds.push(getText(textName).settings.text( blanks.map((w,n)=>(n==i?words[n]:w)).join(' ') ));
      }
      cmds.push(newKey('dashed'+words.length+" end", " ").settings.log().wait());
      cmds.push(getText(textName).settings.text( blanks.join(' ') ));
      if (remove)
        cmds.push(getText(textName).remove());
      return cmds;
    }
    
    PennController.Template( "mytable" ,
        row => PennController(
            ...dashed(row.Sentence)
        )
        .log('Condition', row.Condition)
    )

    I’ll work on fixing the key bug for the next release, and in the meantime I’ll try to see if I can find a hack adapted to your situation

    Jeremy

    #4190
    adamliter
    Participant

    Thanks, Jeremy. I really appreciate it. Don’t worry too much about finding a hack. It’s easy enough to add the information back in during the data analysis, since the sentence itself is recorded, but it would be nice if it were possible to log additional information somehow.

    #4219
    Jeremy
    Keymaster

    Hi Adam,

    Just to let you know, I’ve released PennController 1.6, which fixes the logging issue of the Key element, so the code above would properly report the timestamps of each press on the space key (see the the documentation for installation/update instructions).

    Jeremy

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