PennController for IBEX › Forums › Support › Randomize DashedSentence
Tagged: DashedSentence, randomization
- This topic has 12 replies, 3 voices, and was last updated 2 years, 10 months ago by
Jeremy.
-
AuthorPosts
-
September 22, 2019 at 5:47 pm #4186
adamliter
ParticipantIs it possible to randomize the presentation of sentences using PCIbex’s randomize function with DashedSentence? I have not been able to find a straightforward way to do this. The following does not work:
PennController.ResetPrefix(null); PennController.Template( randomize(PennController.GetTable("mystimuli.csv")) , row => [ "DashedSentence", {s: row.Sentence}, ] );
I’ve also tried this, which didn’t work, either:
PennController.ResetPrefix(null); PennController.Sequence(randomize("DashedSentence"), "send"); PennController.Template( PennController.GetTable("mystimuli.csv") , row => [ "DashedSentence", {s: row.Sentence}, ] ); PennController.SendResults("send");
September 22, 2019 at 6:25 pm #4188Jeremy
KeymasterHi Adam,
The latter method is the correct one, you just need to properly label your items so you can refer to them in Sequence:
PennController.ResetPrefix(null); PennController.Sequence( randomize("dashed") , "send" ); PennController.Template( PennController.GetTable("mystimuli.csv") , row => [ "dashed", "DashedSentence", {s: row.Sentence}, ] ); PennController.SendResults("send");
This will only work starting with PennController 1.4 though (newly created experiments on expt.pcibex.net currently come with version 1.5).
NB: you don’t need to use GetTable if you’re not filtering your table, you can directly pass the string "mystimuli.csv" as the first argument of Template.
Jeremy
September 22, 2019 at 7:20 pm #4189adamliter
ParticipantAh, thanks, Jeremy! I really appreciate the quick response.
February 17, 2021 at 6:21 pm #6628adamliter
ParticipantHi Jeremy,
I have a followup question to this for a different experiment. Is it possible to use the syntax of “
Template( row => ["label", "controllername", options, "controllername", options, ...] )
” with both controllers from Ibex but also the newTrial/PennController command?I’m trying to do an experiment where, in one trial, I (i) play an audio file, (ii) present a sentence using rapid serial visual presentation (RSVP), then (iii) have the participant type something in a text box, and finally (iv) collect a recording from them at the end of the trial. It seems like there are straightforward ways to do everything but the RSVP with PennController. I was thinking I could use the DashedSentence controller with the display set to “in place” from Ibex to do the RSVP, but I’m not sure if it’s possible to mix these things. Given the expected syntax, it doesn’t seem like
Template(row => ["trials", newTrial("trial-begin", newAudio("trial-begin", "trial-begin.mp3")), {}, DashedSentence, {s: row.sentence}, ... ]);
unfortunately. Am I correct in thinking this won’t work? If not, do you have any suggestions for a good way to do this? Maybe it’s easier to do RSVP of a full sentence with just PCIbex than I think. Thanks again in advance for your time!February 17, 2021 at 6:24 pm #6629Jeremy
KeymasterHi,
Yes, it is possible, but the proper syntax is:
Template(row => [ "trials", "PennController", newTrial("trial-begin", newAudio("trial-begin", "trial-begin.mp3").play().wait() ), "DashedSentence", {s: row.sentence}, // ... ])
Also, in case you missed it, you can inject native-Ibex controllers into PennController trials since version 1.7
Jeremy
February 17, 2021 at 6:37 pm #6630adamliter
ParticipantThanks! I did not know about the ability to inject controllers into PennController trials. Thanks for the reference, Jeremy
February 25, 2021 at 10:03 pm #6665adamliter
ParticipantSorry, I have another followup question. 🙂
I’m currently trying to use newController with the AcceptabilityJudgment and Question controllers from Ibex, but nothing shows up on the screen. I also don’t see any errors with the debugger. Do you have any idea what might be going on? Here’s what I have:
PennController.Template("final_pilot_03_cnp_subj_items_all_lists.csv", row => PennController("trials", defaultText .settings.center() .print() , newController("AcceptabilityJudgment", {s: row.Sentence, as: ["1", "2", "3", "4", "5", "6", "7"], presentAsScale: true, leftComment: "very bad", rightComment: "very good"}) .print() .log() .wait() .remove() , (row.Question != "NA" ? newController("Question", {s: row.Question, as: ["Yes", "No"], hasCorrect: row.Answer}) .print() .log() .wait() .remove() : {}) ) .log("ParticipantID", ParticipantID) .log("Group", row.Group) .log("UniqID", row.UniqID) .log("Sentence", '"' + row.Sentence + '"') .log("Question", '"' + row.Question + '"') .log("Answer", row.Answer) );
February 26, 2021 at 10:40 am #6666Jeremy
KeymasterHi,
Your code works well for me. (Note that I replaced s: with q: in the Question controller, but that wouldn’t make the experiment crash anyway)
If you are using a Sequence command, did you make sure to include the trials labeled "trials" in it?
Jeremy
February 26, 2021 at 11:14 am #6667adamliter
ParticipantHmm, that’s interesting. I do have
"trials"
in theSequence
command. I’ve pasted the full code below. I do still have this onexpt.pcibex.net
, notfarm.pcibex.net
, and I noticed the version of PennController I have is1.8-dev
, whereas it looks like the PennController version onfarm.pcibex.net
is1.9
. Could that be the issue?const ParticipantID = b64_md5((Date.now() + Math.random()).toString()); //PennController.DebugOff(); PennController.Sequence("setcounter", "consent", "demographics", "description", "trials", "send", "exit"); PennController.ResetPrefix(null); PennController("consent", newHtml("consent form", "consent.html") .print() , newText("my_consent_clear", "<br/><br/>") .print() , newButton("consent button", "By clicking this button, I consent to participate in this study.") .settings.center() .print() .wait() ) .log("ParticipantID", ParticipantID); PennController("demographics", defaultText .print() , newText("age_text", "What is your age?") , newTextInput("age_response") .settings.log() .settings.length(3) .print() , newText("my_age_clear", "<br/><br/>") , newText("live_in_text", "Did you live in the United States from birth until (at least) age 13?") , newScale("live_in_response", "Yes", "No") .settings.log() .settings.labelsPosition("left") .settings.size("auto") .print() , newText("my_live_in_clear", "<br/><br/>") , newText("native_lang_text", "Did your parents/guardians speak English to you at home?") , newScale("native_lang_response", "Yes", "No") .settings.log() .settings.labelsPosition("left") .settings.size("auto") .print() , newText("my_native_lang_clear", "<br/><br/>") , newText("town_text", "Which state did you grow up in (two letter abbreviation)?") , newTextInput("town_response") .settings.log() .settings.length(100) .print() , newText("my_town_clear", "<br/><br/>") , newButton("submit", "Submit") .print() .wait(getTextInput("age_response").testNot.text("") && getScale("live_in_response").test.selected() && getScale("native_lang_response").test.selected() && getTextInput("town_response").testNot.text("")) ) .log("ParticipantID", ParticipantID); PennController("description", newHtml("description", "description.html") .print() , newButton("start", "Begin experiment") .settings.center() .print() .wait() ) .log("ParticipantID", ParticipantID); PennController.Template("final_pilot_03_cnp_subj_items_all_lists.csv", row => PennController("trials", defaultText .settings.center() .print() , newController("AcceptabilityJudgment", {s: row.Sentence, as: ["1", "2", "3", "4", "5", "6", "7"], presentAsScale: true, leftComment: "very bad", rightComment: "very good"}) .print() .log() .wait() .remove() , (row.Question != "NA" ? newController("Question", {q: row.Question, as: ["Yes", "No"], hasCorrect: row.Answer}) .print() .log() .wait() .remove() : {}) ) .log("ParticipantID", ParticipantID) .log("Group", row.Group) .log("UniqID", row.UniqID) .log("Sentence", '"' + row.Sentence + '"') .log("Question", '"' + row.Question + '"') .log("Answer", row.Answer) ); PennController.SendResults("send"); PennController.SetCounter("setcounter"); PennController("exit", defaultText .print() , newText("thankyou", "<h1>Thank you!</h1><p>Thank you for participating in our study.</p>") , newText("code", "<p>To receive payment through Amazon Mechanical Turk, enter your unique identifying code in the other tab/window.</p><p>Your unique identifying code is: ".concat(ParticipantID, "</p>")) , newText("close", "<p>After copying your unique identifying code above, you can close this tab/window. Your results have been saved.</p>") , // A faux timer that is never started // in order to stay on page forever newTimer("faux", 10) .wait() ) .log("ParticipantID", ParticipantID) .setOption("countsForProgressBar", false);
February 26, 2021 at 12:16 pm #6668adamliter
ParticipantI just created an account with the new
farm.pcibex.net
and moved things to there, and it does seem to be working.February 26, 2021 at 3:00 pm #6669Jeremy
KeymasterGlad it ended up working! I don’t know what might have caused an issue with PennController 1.8, but it’s good to know that PennController 1.9 seems to have fixed it (whatever “it” is)
Jeremy
April 5, 2022 at 3:59 am #8012Carlos
ParticipantJeremy said:
Note that I replaced s: with q: in the Question controller, but that wouldn’t make the experiment crash anyway
However, this replacement (i.e. using
q: row.Sentence
) will show nothing with PennController 2.0, at least from my browser, Chrome Ver 100.0.4896.60(Official Build, 64bit, in normal mode [not in incognito mode]). Does anybody replicate the behaviour from the following link?: https://farm.pcibex.net/r/VfHNoP/PennController.ResetPrefix(null) // Keep here ParticipantID = GetURLParameter("id") PennController.Template("final_pilot_03_cnp_subj_items_all_lists.csv", row => PennController("trials", defaultText .settings.center() .print() , //q: row.Sentence will show nothing //s: row.Sentence will show the question and judgement options newController("AcceptabilityJudgment", {q: row.Sentence, as: ["1", "2", "3", "4", "5", "6", "7"], presentAsScale: true, leftComment: "very bad", rightComment: "very good"}) .print() .log() .wait() .remove() , (row.Question != "NA" ? newController("Question", {q: row.Question, as: ["Yes", "No"], hasCorrect: row.Answer}) .print() .log() .wait() .remove() : {}) ) .log("ParticipantID", ParticipantID) .log("Group", row.Group) .log("UniqID", row.UniqID) .log("Sentence", '"' + row.Sentence + '"') .log("Question", '"' + row.Question + '"') .log("Answer", row.Answer) );
April 11, 2022 at 10:41 am #8029Jeremy
Keymaster -
AuthorPosts
- You must be logged in to reply to this topic.