PennController for IBEX › Forums › Support › Multiple trial repetition
- This topic has 6 replies, 2 voices, and was last updated 4 years, 5 months ago by Farzaneh.
-
AuthorPosts
-
June 3, 2020 at 5:14 pm #5575FarzanehParticipant
Hi Jeremy,
I’m trying to create an examiner prompt page right after two practice trials where participants select between “Repeat Practice” and “Move to experimental trials”. I’m not sure how to incorporate the two trials within a loop after clicking on repeat practice. I appreciate any suggestions you may have. This is a short version of my current script://practice # 1 let launch1 = [ getAudio("p1_aud_hp_sr.mp3").play().wait() , getImage("one").size(270,270).css("border", "solid 1px black") , getImage("two").size(270,270).css("border", "solid 1px black") , getImage("three").size(270,270).css("border", "solid 1px black") , getImage("four").size(270,270).css("border", "solid 1px black") , getCanvas("images") .settings.add( 260 , 0, getImage("one") ) .settings.add( 730 , 0 , getImage("two") ) .settings.add( 260 , 320, getImage("three") ) .settings.add( 730 , 320 , getImage("four") ).print() , newTimer(250).start().wait() , getSelector("select").enable() ]; newTrial( newAudio("p1_aud_hp_sr.mp3"), newImage("one", "Bunny.png"), newImage("two", "Mouse.png"), newImage("three", "Cat.png"), newImage("four", "Dog.png") , newCanvas("images", 1270 , 610) , newSelector("select") .settings.add(getImage ("one"), getImage ("two"), getImage ("three"), getImage ("four")).settings.log().wait().settings.disableClicks()); //practice # 2 let launch2 = [ getAudio("p2_aud_hp_sr.mp3").play().wait() , getImage("one").size(270,270).css("border", "solid 1px black") , getImage("two").size(270,270).css("border", "solid 1px black") , getImage("three").size(270,270).css("border", "solid 1px black") , getImage("four").size(270,270).css("border", "solid 1px black") , getCanvas("images") .settings.add( 260 , 0, getImage("one") ) .settings.add( 730 , 0 , getImage("two") ) .settings.add( 260 , 320, getImage("three") ) .settings.add( 730 , 320 , getImage("four") ).print() , newTimer(250).start().wait() , getSelector("select").enable() ]; newTrial( newAudio("p2_aud_hp_sr.mp3"), newImage("one", "Goose.png"), newImage("two", "Horse.png"), newImage("three", "Bear.png"), newImage("four", "Cat.png") , newCanvas("images", 1270 , 610) , newSelector("select") .settings.add(getImage ("one"), getImage ("two"), getImage ("three"), getImage ("four")).settings.log().wait().settings.disableClicks()); //select "repeat practice" or "move to experiment" newImage("rep", "Repeat.png").center().print(), newImage("exp", "Experimental.png").center().print(), newSelector("choice") .add(getImage ("rep"), getImage ("exp") ) .keys ("F", "J") .log() .wait( getSelector("choice").test.selected( getImage("exp") ) .failure( getSelector("choice").disable() ) );
Thank you!
Farzaneh
June 3, 2020 at 6:45 pm #5576JeremyKeymasterHi Farzaneh,
Unfortunately IBEX only supports static sequences of trials: the sequence of trials is computed at the very beginning of the experiment and proceeds linearly.
The only solution for implementing any loop of this kind at the moment is to create a single trial which will take care of executing some code in a loop. So you will have to make your two practice trials fit a single PennController trial, and run their code as part of a callback. Here is a possible implementation:
const launch = (audio,image1,image2,image3,image4) => [ clear() , newAudio(audio).play().wait() , newSelector("select").log() , newCanvas("images", 1270 , 610) .add( 260, 0, newImage(image1).size(270,270).css("border","solid 1px black").selector("select") ) .add( 730, 0, newImage(image2).size(270,270).css("border","solid 1px black").selector("select") ) .add( 260, 320, newImage(image3).size(270,270).css("border","solid 1px black").selector("select") ) .add( 730, 320, newImage(image4).size(270,270).css("border","solid 1px black").selector("select") ) .print() , getSelector("select").wait().disable() , newTimer(250).start().wait() , getSelector("select").enable() , clear() ] newTrial( newButton("Start").print().wait().remove() , newButton("launch").callback( ...launch("p1_aud_hp_sr.mp3","Bunny.png","Mouse.png","Cat.png","Dog.png") , ...launch("p2_aud_hp_sr.mp3","Goose.png","Horse.png","Bear.png","Cat.png") , getButton("Restart").print(), getButton("Proceed").print() ) .click() , newButton("Restart").callback( getButton("launch").click() ), newButton("Proceed").wait() )
Jeremy
June 4, 2020 at 2:25 pm #5590FarzanehParticipantThanks for your response. The solution works great. I have a follow-up question. When the second trial starts, the canvas seems to get doubled in size and I have to scroll down to see the images although there’s both a .clear () and a .remove () command in the script that should’ve removed the canvas from the first trial. Do you have any idea why this happens?
Farzaneh
June 4, 2020 at 3:04 pm #5591JeremyKeymasterWhich version of PennController are you using? There was a bug until 1.7 where Canvas elements wouldn’t properly get removed from the page
Jeremy
June 4, 2020 at 4:24 pm #5592FarzanehParticipantI haven’t installed any PennController version; I just use the Ibex Farm directly.
Farzaneh
June 4, 2020 at 5:25 pm #5593JeremyKeymasterBy Ibex Farm, do you mean the PCIbex Farm at https://expt.pcibex.net or the original Ibex Farm at https://spellout.net/ibexfarm? PennController comes pre-installed on the former, but not on the latter
In any case, it won’t hurt to install/update to the latest version of PennController. On either farm, just follow the instructions on this page and your project will import PennController 1.8
Jeremy
June 4, 2020 at 5:49 pm #5594FarzanehParticipantYes, I meant the PCIbex Farm. Sure, will do.
Thank Jeremy,
Farzaneh
-
AuthorPosts
- You must be logged in to reply to this topic.