PennController for IBEX › Forums › Support › Need help implementing an “abort trial” option for a SPR design
Tagged: abort trial, dashed sentence, SPR
- This topic has 4 replies, 2 voices, and was last updated 1 year, 5 months ago by
Jeremy.
-
AuthorPosts
-
August 21, 2023 at 2:54 pm #10826
newebste
ParticipantHello,
I am running a specific type of Self-Paced Reading experiment called SMS (“Stops Making Sense”), where trials proceed as simple self-paced reading, but with the option to “abort” the trial if they find the sentence really “bad”/”unacceptable”. I found another thread in this forum that talked about implementing an abort trial keypress for a different reason (re: loading media issues), and saw that one option could be to create a new command like this:
newKey(“Q”).callback( end() )
Unfortunately, I am a complete novice with IBEX and am not entirely sure how exactly to incorporate this into the code, and also, what it would look like in the results file. Ideally, I want to be able to see the word at which a participant decided to abort the trial, and the RT of all preceding words and the abort trial button press.
I have currently successfully set up the experiment to run as just the SPR design, using DashedSentence.
Any help would be appreciated! Apologies for my inexperience.
I will include my demonstration link here: https://farm.pcibex.net/r/FEXIqU/
August 24, 2023 at 4:51 am #10833Jeremy
KeymasterHello,
Since you are using exclusively IBEX code, and no PennController code like the
newKey
you mention, it’s probably simpler to just edit the DashedSentence controller to add an abort key. Just edit the file DashedSentence.js from your project’s Modules folder:1. Insert a new line between line 203 (
}
) and line 204 (else {
) and paste this:else if (code == 81) { t.sprResults[t.currentWord-1][0] = time; t.sprResults[t.currentWord-1][1] = t.previousTime; t.processSprResults(t.currentWord); t.finishedCallback(t.resultsLines); }
2. Edit line 291 (previously line 285 before the aforementioned insertion) and change if from
processSprResults: function () {
toprocessSprResults: function (abortAt=-1) {
3. Just a couple lines below, you have a block of 10 lines that start with
for
and end with}
. Replace them with this:for (var i = 0; i < nonSpaceWords.length; ++i) { if (i==abortAt) this.resultsLines.push([ ["Word number", i], ["Word", "__ABORT__"], ["Reading time", "NA"], ["Newline?", false], ["Sentence (or sentence MD5)", this.sentenceDesc] ]); this.resultsLines.push([ ["Word number", i+1], ["Word", csv_url_encode(nonSpaceWords[i])], ["Reading time", abortAt>=0 && i>=abortAt ? "NA" : this.sprResults[i][0] - this.sprResults[i][1]], ["Newline?", (! this.display == "in place") && boolToInt(((i+1) < this.wordOSpans.length) && (this.wordOSpans[i].offset().top != this.wordOSpans[i+1].offset().top))], ["Sentence (or sentence MD5)", this.sentenceDesc] ]); } if (abortAt==nonSpaceWords.length) this.resultsLines.push([ ["Word number", nonSpaceWords.length], ["Word", "__ABORT__"], ["Reading time", "NA"], ["Newline?", false], ["Sentence (or sentence MD5)", this.sentenceDesc] ]);
Now you can press Q to abort the self-paced reading instance. The results file will report a line that says “__ABORT__” for the last word shown on the screen, and the reaction times will be NA from there on (because the next words won’t have been displayed)
If you want to use a different key from Q, you can look up the event.which column from this table and replace
81
in the bit from step 1 above with the value of your choice (for example,27
if you’d rather use the Escape key)Jeremy
September 3, 2023 at 8:32 pm #10847newebste
ParticipantHi Jeremy, thank you very much for the thorough response and assistance! I will give this a try and see how it works.
September 3, 2023 at 9:00 pm #10848newebste
ParticipantA small update: I edited DashedSentence.js in the modules folder as suggested, but I am now getting a new error that states:
“[17:51:18] Invalid controller reference: ‘DashedSentence’—Did you mean to type FlashSentence? (newTrial: 0)”.
Any thoughts on why this new error is happening/how I can circumvent it? Thank you so much again in advance.
Demonstration link: https://farm.pcibex.net/r/FEXIqU/
September 3, 2023 at 9:00 pm #10849newebste
ParticipantA small update: I edited DashedSentence.js in the modules folder as suggested, but I am now getting a new error that states:
“[17:51:18] Invalid controller reference: ‘DashedSentence’—Did you mean to type FlashSentence? (newTrial: 0)”.
Any thoughts on why this new error is happening/how I can circumvent it? Thank you so much again in advance.
Demonstration link: https://farm.pcibex.net/r/FEXIqU/
September 20, 2023 at 9:46 am #10857Jeremy
KeymasterSorry for the late reply. I see that the error no longer appears when running the experiment, so I imagine you have fixed the issue in the meantime
Jeremy
-
AuthorPosts
- You must be logged in to reply to this topic.