PennController for IBEX › Forums › Support › Adding break trials
- This topic has 7 replies, 4 voices, and was last updated 3 years, 10 months ago by aliona.
-
AuthorPosts
-
June 15, 2020 at 7:32 pm #5646angelicaParticipant
Hi Jeremy,
I’m working on a speeded grammaticality judgment task, and I’d like to insert a break trial every n experimental trials, so the participant has an opportunity to rest.
I modified the running order manually :
PennController.ResetPrefix(null); // Initiates PennController // source: https://github.com/addrummond/ibex/blob/master/docs/manual.md#modifying-the-running-order-manually function modifyRunningOrder(ro) { var n = 5 ; for (var i = 0; i < ro.length; ++i) { if (i % n == (n-1)) { ro[i].push(new DynamicElement( "PennController", newTrial("break", ... ) , false )); } } return ro; } Sequence("practice", rshuffle("vpe", "fillers"), "exit", "send", "confirmation") //////////////////////////////////////////////////////////////////////////////// // Experiment // Trial template customTrial = label => variable => newTrial( label , ... , // RSVP sentence newController("dash", "DashedSentence", {s:variable.sentence, "mode":"speeded acceptability", "display":"in place", "wordTime":200}) .cssContainer({"margin":"110px 0 0 0", "font-size": "150%",}) .log() .print() .wait() .remove() , ... ) // Items Template("practice.csv", customTrial("practice")) Template("fillers.csv", customTrial("fillers")) Template("vpe.csv", customTrial("vpe")) // Post-experiment newTrial("exit", ... ) // Send results PennController.SendResults("send"); // End-of-experiment confirmation newTrial("confirmation", ... )
Is it possible to restrict modifyRunningOrder() to certain parts of a Sequence()? I set n to 5 for testing, and so the “break” trial displays after the fifth “practice” trial. However, I’d like to only insert break trials in the rshuffle(“vpe”, “fillers”) section.
Best,
AngelicaJune 15, 2020 at 8:12 pm #5647JeremyKeymasterHi Angelica,
Rather than using modifyRunningOrder, prefer using a custom function in Sequence, as described on this thread. You could do this to insert a break-labeled trial every 5 trials into your rshuffle subsequence:
Sequence("practice", sepWithN( "break" , rshuffle("vpe", "fillers") , 5 ) , "exit", "send", "confirmation")
Best,
JeremyJune 15, 2020 at 8:53 pm #5648angelicaParticipantHi Jeremy,
I completely missed that thread, thank you for the help!
June 17, 2020 at 11:04 am #5659mrhelfrichParticipantThis was very helpful but I am encountering a minor problem with the the Break trial as it was described in this thread and the linked one. My experiment has 63 trials and the number of breaks I want to include doesn’t cleanly fit into that number (I also don’t need to give the participant a break after they have completed all 63 trials, they can just reach the end of the experiment at that point.
I first tried to give breaks every 16 trials in the hopes that it would give a break at 16, 32, and 48, and since my .csv file only has 63 trials it would skip doing a fourth break since no 64th trial exists but I still get the break occurring. I even tried 17 just to see if it had something to do with 63 being so close to 64 and it still occurred.For reference, the code I am using is
function SepWithN(sep, main, n) { this.args = [sep,main]; this.run = function(arrays) { assert(arrays.length == 2, "Wrong number of arguments (or bad argument) to SepWithN"); assert(parseInt(n) > 0, "N must be a positive number"); let sep = arrays[0]; let main = arrays[1]; if (main.length <= 1) return main else { let newArray = []; while (main.length){ for (let i = 0; i < n && main.length>0; i++) newArray.push(main.shift()); for (let j = 0; j < sep.length; ++j) newArray.push(sep[j]); } return newArray; } } } function sepWithN(sep, main, n) { return new SepWithN(sep, main, n); }
And my sequence looks like this:
Sequence(sepWithN("break",randomize("exptrial"),17),"endexp")
Thanks for the help,
Max- This reply was modified 3 years, 10 months ago by Jeremy. Reason: replaced main.pop() with main.shift()
June 17, 2020 at 11:09 am #5660JeremyKeymasterHi Max,
Replace this line:
for (let j = 0; j < sep.length; ++j)
with this:
for (let j = 0; j < sep.length && main.length>0; ++j)
Jeremy
November 30, 2020 at 8:39 am #6400alionaParticipantHi Jeremy,
would it be possible to use the above mentioned SepWithN function while having different number of critical and filler items? In our experiment we have 20 criticals and 30 fillers devided into three blocks by 2 breaks (7/7/6 +10 fillers/block).
My sequence looks like this:
PennController.Sequence(…sepWithN(“break” , rshuffle(“critical_trials”, “fillers”) , 17 )…);How can I specify the number of the critical items and fillers/block? I tried adding the desired numbers after “critical_trials” and “fillers” in the sequence but that didn’t work, the proportion of criticls and fillers is still random.
Thanks in advance for your responce!
AlionaNovember 30, 2020 at 12:34 pm #6406JeremyKeymasterHi Aliona,
One option would be to use the pick function defined in this thread:
critical = randomize("critical_trials") fillers = randomize("fillers") Sequence( rshuffle(pick(critical,7),pick(fillers,10)),"break", rshuffle(pick(critical,7),pick(fillers,10)),"break", rshuffle(pick(critical,6),pick(fillers,10)) )
Let me know if you have questions
Jeremy
December 1, 2020 at 6:57 am #6415alionaParticipantHi Jeremy,
it works perfectly! Thanks a lot for your help and all the great work on PC!
Aliona
-
AuthorPosts
- You must be logged in to reply to this topic.