Forum Replies Created
-
AuthorPosts
-
dodParticipant
Hi Jeremy,
I tried to use the static.py script to run a simple experiment completely locally. It works very well for what I need.
However, the results file doesn’t have the usual format and it’s not read by the read.pcibex function. I can see all the headers and all the logged info, but cannot get the delimiters/logic to convert it into a csv or even the normal file to pass in the read.pcibex.I’m attaching the result file (.bak) of a simple demographic questionnaire to give you an idea. If it matters, I’m on an M1 mac.
Is there any extra script I missed?
Thank you in advance!
[false,0,[Controller name,Item number,Element number,Type,Group,PennElementType,PennElementName,Parameter,Value,EventTime,Comments,nameID,email,agerange,gender,raised,edu,cur_edu,glasses,lenses,vision],[[[0,PennController],[1,0],[2,0],[3,welcomeGO],[4,NULL],[5,PennController],[6,0],[7,_Trial_],[8,Start],[9,1716472079297],[10,NULL]],[[0,PennController],[1,0],[2,0],[3,welcomeGO],[4,NULL],[5,PennController],[6,0],[7,_Trial_],[8,End],[9,1716472080903],[10,NULL]],[[0,PennController],[1,2],[2,0],[3,ethicswarning],[4,NULL],[5,PennController],[6,2],[7,_Trial_],[8,Start],[9,1716472080904],[10,NULL]],[[0,PennController],[1,2],[2,0],[3,ethicswarning],[4,NULL],[5,PennController],[6,2],[7,_Trial_],[8,End],[9,1716472082127],[10,NULL]],[[0,PennController],[1,3],[2,0],[3,demo1-Ls],[4,NULL],[5,PennController],[6,3],[7,_Trial_],[8,Start],[9,1716472082129],[10,NULL]],[[0,PennController],[1,3],[2,0],[3,demo1-Ls],[4,NULL],[5,PennController],[6,3],[7,_Trial_],[8,End],[9,1716472094899],[10,NULL]],[[0,PennController],[1,8],[2,0],[3,demo-vision],[4,NULL],[5,PennController],[6,8],[7,_Trial_],[8,Start],[9,1716472094900],[10,NULL]],[[0,PennController],[1,8],[2,0],[3,demo-vision],[4,NULL],[5,PennController],[6,8],[7,_Trial_],[8,End],[9,1716472103425],[10,NULL]],[[0,PennController],[1,4],[2,0],[3,demo2-agegender],[4,NULL],[5,PennController],[6,4],[7,_Trial_],[8,Start],[9,1716472103427],[10,NULL]],[[0,PennController],[1,4],[2,0],[3,demo2-agegender],[4,NULL],[5,PennController],[6,4],[7,_Trial_],[8,End],[9,1716472108196],[10,NULL]],[[0,PennController],[1,6],[2,0],[3,demo4-edu],[4,NULL],[5,PennController],[6,6],[7,_Trial_],[8,Start],[9,1716472108197],[10,NULL]],[[0,PennController],[1,6],[2,0],[3,demo4-edu],[4,NULL],[5,PennController],[6,6],[7,_Trial_],[8,End],[9,1716472122493],[10,NULL]],[[0,PennController],[1,7],[2,0],[3,demo5-health],[4,NULL],[5,PennController],[6,7],[7,_Trial_],[8,Start],[9,1716472122494],[10,NULL]],[[0,PennController],[1,7],[2,0],[3,demo5-health],[4,NULL],[5,PennController],[6,7],[7,_Trial_],[8,End],[9,1716472131490],[10,NULL]],[[0,PennController],[1,9],[2,0],[3,valid],[4,NULL],[5,PennController],[6,9],[7,_Trial_],[8,Start],[9,1716472131492],[11,test],[12,test],[13,23 - 26],[14,test],[15,test],[16,Licence],[17,test],[18,Non],[19,Oui],[20,Non],[10,NULL]],[[0,PennController],[1,9],[2,0],[3,valid],[4,NULL],[5,PennController],[6,9],[7,_Trial_],[8,End],[9,1716472169232],[11,test],[12,test],[13,23 - 26],[14,test],[15,test],[16,Licence],[17,test],[18,Non],[19,Oui],[20,Non],[10,NULL]]],ktwl0BZ/sa+NNlDBjNaNng,true]
- This reply was modified 4 months, 3 weeks ago by dod.
dodParticipantThank you, it works!
At that point, I’ll have to manually log the accuracy and the response time, though, right? I mean, I can log the scale selection, and set a variable to get the timing (something like newVar(“RT”).global().set(()=>Date.now()) …. getVar(“RT”).set(v=>Date.now()-v). Just thinking if there is a cleaner way to do it.
Thank you
dodParticipantHi,
I’m trying to implement something similar but on a Question controller.
I would like to print some feedback when the answer is not correct. But being a Question, the scale.test.selected does not work. Is there a command I’m missing? I could still print the correct answer for every question. But I’d prefer not to.
Also, I’d like to timeout the answer time and print an error message if needed. I know how to do it with a normal Timer element. And I know I can add a timeout message to the item array in the old Ibex. But I’m not sure how to implement the timeout message in PCIbex, when the timeout option is set in the Question controller.
Thank you in advance for any help!
dodParticipantThank you! I realized a bit after posting that I had got your first message completely wrong. So eventually I declared it at the beginning of the script but I just messed things up ( I used
var speakID = function randomString() {...
, and I decided to get rid of the trial (and the log). And as a result, I was getting a “No Var element named “speakID” found” error that was driving me crazy.)
Now I can see the logic, and it works perfectly!
Thank you again!dodParticipantHi Jeremy,
I was trying to store a unique participantID in the audio filename as well.
I created a javascript variable and referred to it in the newMediaRecorder name, but I always get errors – either “[12:25:57] Uncaught SyntaxError: Unexpected token ‘variable’ (newTrial: 0), or an “ERROR: Wrong number of arguments (or bad argument) to SepWith” (even if I’m not touching the sepWith trials).
I’m quite sure there is something wrong in the way I refer to the variable in the newMediaRecorder name. But I cannot figure out how to fix it. Could you help me out?Here’s the trial with the function to define the variable
// Set unique participant ID to better recognize audios newTrial("speakID", newVar("speakID") .settings.global() .set(v =>[...Array(4)].reduce(a=>a+alphanum.charAt(Math.floor(Math.random()*alphanum.length)),'')) , newText("speakID", "") .settings.text(getVar("speakID")) .print(), newButton().print().wait() // to be deleted, just to double check that the code matches the audiofile ) .log("speakID", getVar("speakID"))
And here’s the way I named my newMediaRecorder element in following trials
newMediaRecorder(row.itemID+"_"+row.modality+"_"+variable.speakID, "audio")
If I don’t refer to the variable in the audiofile name, everything goes smoothly.
Thank you in advance!
Dod
dodParticipantBut it definitely serves its purpose, so far!
So, I guess the same logic applies when printing the MediaRecorder and then uploading it – the zip name I got in the results line refers only to the most recent attempt, doesn’t it?
Dod
dodParticipantHi Jeremy, thanks for the quick reply, as always!
I didn’t think at all about the print option, to be fair. I kept the recorder hidden in the experimental trials, and now I was over-complicating things. At the moment, I don’t see any particular reason for hiding it in the audio check as well. So I’ll go for printing it, and that’s it. If I change my mind later on, I know I can start from your custom interface code (I tried it, and I see your point).
At least now I’ve learned not to use the callback on the play button 🙂
Just another naive question that might come in handy in the future. So, in a code like that with the newMediaRecorder in the loopedcallback
command, PCIbex will play and save different recordings even if the mediarecorder has the same name? I mean, at the end of the day, would I have X zip files with the same “audiotest1” from a same participant, or will they somehow be labelled sequentially?As for the
test.clicked
, my bad, there was indeed an error in the syntax. I checked previous codes, and it’s true that I had always put the test in the wait brackets of buttons/dropdowns (something like newButton(“X”).wait(getButton(“X”).test.clicked…). And at the point of course it worked. Sorry again for the silly questions – I’m still pretty new with all the coding-related stuff!Thank you
dodParticipantHi,
It works perfectly, thank you!
dodParticipantHi,
Sorry for jumping in an old post, but I got a similar problem.
Basically, I need to alternate every single experimental trial with 3 filler sentences to be presented either visually (read&repeat) or aurally (listen&repeat). The modality of the fillers is pre-assigned, but I need to randomize the order throughout the experiment and across participants.I used sepWith to alternate the experimental/filler trials, and I defined the Pick function as specified above. It was super useful and I solved the problem of randomizing the modality of the fillers as well as presenting only 3 fillers at every time.
However, I always get the same 3 filler sentences. I know I should store the set of used fillers in a new variable (the one you referred to as ‘liste’ in the example above). But I am not completely sure about how to add this detail in my sequence without having to apply a pick function+’liste’ variable to each and every of my experimental trials as well.
To make things even more complicated, it is a production experiment, so ideally I would want to have a sepWith asyncUpload to start uploading the recordings as they go.So far, the sequence is specified as follow:
Sequence("welcome", "preload", "init", sepWith("asyncUpload",(randomize(anyOf("practice-listen","practice-read")))), sepWith( pick(randomize(anyOf("filler-listen","filler-read")),3), "exp-trial"), "upload", "send", "bye" )
where:
– “filler-listen” is a trial with the specific code for audio (listen&repeat) stimuli;
– “filler-read” is a trial with the specific code for visual (read&repeat) stimuli;
– “exp-trial” is the actual experimental trial of listen&repeat(and record)-read&repeat(and record), with listen sentences and read sentences pre-paired together and stored in the same row in the csv table.Thank you in advance for any help!
-
AuthorPosts