Forum Replies Created
-
AuthorPosts
-
Jeremy
KeymasterHi Kathy,
1. This is due to how complex conditionals (
and
/or
) are processed: the parent (first) one actually takes effect last. So make the “job” test the parent (first) one, and make the “age” test its first childand
test, this way the “job” error message will be displayed at the bottom and the “age” error message will be displayed at the top2. Simply add a
margin-right
CSS rule to your Text element. Given the content of your trial, you can even make it part of the defaultcss
commandI have updated the project at https://farm.pcibex.net/r/SsqEZD/ along those lines
Jeremy
Jeremy
KeymasterHi,
I think Susanne imported this js file into the Modules folder, judging from this thread. There’s an example on how to use it a few messages down
Jeremy
Jeremy
KeymasterHi Juliana,
Would you mind sharing your project’s demonstration link with me, so I can take a look at its script and csv file(s)?
If the problem goes away when you delete some lines in your CSV file, then chances are that the problem does not lie with the script
Jeremy
Jeremy
KeymasterHi Kathy,
Remember that the script is read and executed in a straightforward top-down fashion by PennController, and it will only pause on
wait
commands. So in your code above, all the elements are printed onto the page and then PennController stays on the Button element’swait
command until your participant clicks it. Once the button is clicked, all thetest
commands below are read and executed in a split second, and the nextwait
command that PennController reads is the TextInput’swait
command: if your participant did not pressEnter
while typing in the input box, they will have to pressEnter
while typing in that box so that PennController can continue reading the rest of the code. Then it will move on and read the nextwait
command, the one called on the “sex” DropDown element, and your participant will need to select an option from that list if they haven’t done so yet. Then the nextwait
command, and so on. (The lastprint
command on the Button element will have no effect practically speaking, because the script will move on to the next trial immediately after it)I don’t think this is what you want. What you want is for PennController to read everything, stay on the Button element’s
wait
command and only validate it if some conditions are met, but stay on it if those conditions are not met. You do that by insertingtest
commands inside thewait
command, just like I illustrated above.Regarding the restriction to numerical values, you simply replace the regular expression in your test with one that tests for numbers only, eg
/^\d+$/
.Regarding the disappearance of the error messages, this is something you’ll need to code yourself. DropDown elements have a
callback
command that you can use to execute commands whenever an option is selected. So if you give unique names to your error messages, you could usecallback
on each of your DropDown elements toremove
the corresponding error Text element. There is nocallback
command on the TextInput element that can detect keypresses, so you’d have to find a workaround. One option would be to usecallback
on a Key element to detect any keypress (including outside the input box) and remove the error message: it would overgenerate but it wouldn’t be too bad.Here is a link to a project where I rearranged your code along those lines: https://farm.pcibex.net/r/SsqEZD/
Let me know if you have any questions
Jeremy
March 20, 2021 at 7:16 pm in reply to: BUG: multiple projects being deleted at one on PCIbex farm #6745Jeremy
KeymasterHi Candido,
Thank you for this message. The problem should now be fixed: clicking ‘No’ when asked to confirm deletion for one experiment, and then clicking ‘Yes’ when asked for confirmation to delete another experiment no longer deletes the former along with it
Best,
JeremyJeremy
KeymasterDear Peiyao,
You are correct that the results files do not count toward the quota, which means that you don’t have to monitor their size. However, it is good practice to delete results once you have saved them in a secure, backed-up location on your device: it frees up space on our servers, and the results are then solely in your possession as they no longer rest on our servers.
Jeremy
Jeremy
KeymasterHi Muxuan,
1. You can pass a regular expression to
test.text
, so in your case you would do something likegetTextInput("myTextInput").test.text( /^[sS]\d+/ )
2. This could be due to your TextInput element printing almost immediately after the key press on F, resulting in that character printing in the text input box. Maybe try starting and waiting for a 250ms Timer after the Key element’s
wait
command and before thenewTextInput
command to see if things improveJeremy
Jeremy
KeymasterHi Anna,
I don’t know enough about this to answer confidently, but from my read of the github issue I shared above, I suspect this is caused by the same issue indeed. Some video codecs such as VP8 or VP9 support a variable video frame rate, and your webm videos were probably encoded using those.
Here is a reddit thread that gives pointers on how to normalize variable-framerate .webm files. You may need to look up some
ffmpeg
options if you are not familiar with them, as not all are explained in the thread. Also, feel free to use the specific keywordsvfr
(variable frame rate) andcfr
(constant frame rate) in your searches if you look for more information about this processJeremy
Jeremy
KeymasterHello,
Thank you for including the demonstration link to your project. You should use the
log
command on the elements whose events you are interested in recording. In your case, you want to know when participants press the spacebar key, and when the Text elements are printed, so you should use that command on your Key and Text elements. One simple way of doing it is to add them as default commands to the top of your trial:Template("trial.csv",row => newTrial("essai", defaultText.log(), defaultKey.log() ,
I tested it and it adds 20 lines per trial to your results file. Logging both elements types is a little redundant, so you could choose ton only log the Key elements, for example (in which case it could be a good idea to name those Key elements, to make it easier to read your results file). Then you simply subtract EventTimes to get reading times.
Let me know if you have questions
Jeremy
Jeremy
KeymasterHello,
The results will be accessible again once I have fixed the problem and implemented an alternative access solution. Granting access at this point would likely cause downtime again, making further access to the results and even data collection impossible. Unfortunately I cannot tell how long this will take, but I’m actively working on it and will send out an announcement when the situation has been resolved
Apologies for the inconvenience,
Jeremy
Jeremy
KeymasterHi Rick,
I see, it’s an actual screen that literally displays “pause” on the page. Would you mind making your project clonable, so I can open it and help you troubleshooting it? I added the option to turn that off because people like having that option, but honestly there really are very few occasions where making your projects non-clonable brings you anything (people who don’t have your demonstration link cannot access your project, and you’ll give the data-collection link to your participants anyway)
EDIT: I looked up the source code of your experiment in the meantime and noticed you have added a few custom functions/scripts to your project, one of those being:
function modifyRunningOrder(ro) { for (var i = 0; i < ro.length; ++i) { if (i % 10 == 0) { // Passing 'true' as the third argument casues the results from this controller // to be omitted from the results file. (Though in fact, the Message controller // does not add any results in any case.) ro[i].push(new DynamicElement( "Message", { html: "<p>Pause</p>", transfer: 1000 }, true )); } } return ro; }
I don’t know why it’s there, it’s definitely not something that’s included in default PennController experiments, but in any case, its effect is to add a (native-Ibex) Message controller every ten trials that says “Pause” and stays on the screen for 1s. Just delete that code and the problem will go away
End EDIT
Jeremy
-
This reply was modified 4 years, 4 months ago by
Jeremy. Reason: looked up source code and identified cause of problem
Jeremy
KeymasterHi Rick,
Can you provide more details about this “pause”? What form does it take? Is it a screen (blank, or with some message) between two trials, or does the experiment stay on one screen for longer than it should before moving on to the next one? Can you still interact with the page?
If the “pause” is a screen saying “Preloading, please wait” then this means that you have an Audio/Image/Video/Youtube element somewhere that points to a file that cannot be found. A somewhat common situation is when, inside a
Template
command, you mean to use such an element pointing to a file referenced in a column for a subset of trials only, but your code in fact creates the element for all trials, regardless of whether you end up using it and whether the column indeed points to a (valid) file. If you randomize all the trials, then the preloading message will appear randomly. See an example with this experiment (https://farm.pcibex.net/r/zcfiUJ/) containing this faultyTemplate
command because the “Image” column of the second row of the table does not point to a valid image:Template( row => newTrial( newText( row.Question ).print() , newVar("showImage") .set( row.ShowImage ) .test.is( "Yes" ) .success( newImage( row.Image ).print() ) , newScale("answer", "Yes", "No") .button() .print() .wait() ) )
What you should do instead is this case is:
newText( row.Question ).print() , ...( row.ShowImage == "Yes" ? [ newImage( row.Image ).print() ] : [] ) ,
Let me know if you have questions
Jeremy
Jeremy
KeymasterHi,
Thank you for bringing this to my attention. It seems that the MediaRecorder API produces video streams with inconsistent frame rates, so it’s going to be a challenge to fix this for the next release of PennController.
As for the video clips of different frame rates that you have collected, you can try to normalize them before merging them. For example,
ffmpeg
has an option for that:ffmpeg -i input.mp4 -r 30 -y output.mp4
(output.mp4 will have the same duration as input.mp4, but in 30fps)Jeremy
March 15, 2021 at 1:09 pm in reply to: self-paced reading with image element in the middle of the sentence #6717Jeremy
KeymasterHi Sarah,
In this case, you’re probably better off re-coding DashedSentence’s function yourself. Here’s a suggestion, add this to your script (tested with PennController 1.9):
addToDash = (commands,element,previousElement) => { id = element._element.id; type = element._element.type; if (previousElement && previousElement._runPromises && previousElement._runPromises instanceof Function){ previousId = previousElement._element.id; previousType = previousElement._element.type; previousElement = window['get'+previousType](previousId).hidden() } commands.push( getKey("nextDash").wait(), previousElement, window['get'+type](id).log().print( getText("container") ) ) } myDash = (...args) => { commands = [ newKey("nextDash", " ").log("all"), newText("container", "").css({display:"flex",'flex-flow':'row wrap'}).print() ]; previousElement = null; args.forEach(a => { if (typeof(a)=="string") a = a.split(' ').forEach( s=>{ newElement = newText(s); commands.push(newElement); addToDash(commands,newElement,previousElement); previousElement = newElement; }); else if (a._runPromises && a._runPromises instanceof Function) { newElement = window['get'+a._element.type](a._element.id); addToDash(commands,newElement,previousElement); previousElement = newElement; } }) return commands; }
Then you can use it like this:
newTrial( "experiment", newImage("ball","ball.png").size(50,50).print().remove() , ...myDash("This is a very long sentence to see if linebreaks will be automatically handled", getImage("ball"), "in a satisfactory way, despite there being an Image element in the middle of this very very very very long sentence!") , getKey("nextDash").wait() )
Note that I print and immediately remove the Image element before using the function, as otherwise PennController has trouble printing it right. The participant shouldn’t see anything, just make sure to print any Image element you insert in
myDash
beforehandLet me know if you have questions
Jeremy
Jeremy
KeymasterDear Aliona,
The line you report most likely corresponds to Edge (although you should probably see an extra ‘e’ at “Edg/xxxxxxx”): http://useragentstring.com/index.php?id=19970
Jeremy
-
This reply was modified 4 years, 4 months ago by
-
AuthorPosts