PennController for IBEX › Forums › Support › Log additional data from table with DashedSentence
Tagged: DashedSentence, logging
- This topic has 3 replies, 2 voices, and was last updated 5 years ago by Jeremy.
-
AuthorPosts
-
September 22, 2019 at 5:43 pm #4184adamliterParticipant
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.
September 22, 2019 at 6:20 pm #4187JeremyKeymasterHi 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
September 22, 2019 at 7:21 pm #4190adamliterParticipantThanks, 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.
September 23, 2019 at 2:06 pm #4219JeremyKeymasterHi 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
-
AuthorPosts
- You must be logged in to reply to this topic.