tatool / tatool-web

open-source experiment software for researchers
http://www.tatool-web.com
GNU General Public License v3.0
46 stars 26 forks source link

images in ChoiceReaction #133

Closed andreadecesarei closed 4 years ago

andreadecesarei commented 4 years ago

Hi, I have programmed a simple picture rating task using the ChoiceReaction executable. Images are stored in the stimuli folder (I am hosting a version of tatool) and picture names in the csv file. While sometimes pictures are correctly shown, sometimes I get the following behaviors: 1) on chrome and edge, images are not shown (with 3 sec exposure time); 2) on firefox additionally, the preceding picture (ie, from the previous ChoiceReaction object) is shown before the currect ChoiceReaction object. if a blank image is shown instead of the current image, this leads to repetition of the previous picture

The console outputs no errors.

Do you have any idea of why this can occur, or of the steps that I can do to fix this?

Many thanks in advance, Andrea

alocher commented 4 years ago

Hi Andrea, I am not sure I have an answer for you on this. Did you create a new stimuli file and stimuli for the existing ChoiceReaction task? Does it work fine when running online? Are you running your instance locally or on the web?

andreadecesarei commented 4 years ago

Hi Andre,

I have been trying to solve it for the last few days, without much success. however, I have some more information:

Might picture size, and ram used in the init phase, play a role? I noticed that the initial file is always shown, and that the two smallest files do not have any problem. however, the experiment as a whole only comprises 53 pictures of <100 kb size, so that should not be a big deal.

To test this out however, it would be useful to re-init the trial at the beginning of each iteration. A small executable that preloads the present iteration would be perfect to test this possibility, however I am not sure how to do it. Do you think that it would that be possible, or that it would be a good idea?

thanks, best Andrea

alocher commented 4 years ago

The error you are describing makes me wonder if something is going wrong with the preloading/caching of stimuli images as the odd behavior you describe with images sometimes appearing and sometimes not can be caused by the browser not having the images readily available in the cache. Can you check if you kept the logic in the service init() method to load the stimuli file the same as in the original ChoiceReaction? Also do you use the exact same stimuli file format (column stimulusValueType and column stimulusValue with image files (e.g. jpg, jpeg,png,gif)? I assume if you use the same stimuli with the original tatoolChoiceReaction executable it works? You can also share your Executable code with me if none of the above seems to help.

andreadecesarei commented 4 years ago

Hi Andre, yes I think too is might be due to preloading/caching. Also, the structure of the experiment is perhaps more complex of what tatool was initially meant to handle - please find the json file attached. As timing is not critical in the present experiment, I created an ad-hoc solution with the executable pictureviewing which 1) does not use promises in the init function, rather 2) loads each image in the ctrl file and 3) displays a blank image after the offset of the picture in the ctrl file. This last step is necessary because on some browsers (edge and especially firefox) the image from the previous trial (cached??) is displayed before the image from the current trial. As a result, the experiment runs fine with edge and chrome, but does not work (at all?) with firefox, which is ok for us. Please find attached the executable I am referring to, and excuse the in-elegance of my programming skills.

With your software and these changes, we started collecting pilot data. Again, thanks for the software you have created and for your kind support

Best regards, Andrea

Andrea De Cesarei, PhD Associate Professor Alma Mater Studiorum-University of Bologna Department of Psychology Viale Berti Pichat 5 40127 Bologna ITALY e-mail: andrea.decesarei@unibo.itmailto:andrea.decesarei@unibo.it Website: http://goo.gl/KoY3O

Da: Andre notifications@github.com Inviato: mercoledì 15 aprile 2020 20:41 A: tatool/tatool-web tatool-web@noreply.github.com Cc: Andrea De Cesarei andrea.decesarei@unibo.it; Author author@noreply.github.com Oggetto: Re: [tatool/tatool-web] images in ChoiceReaction (#133)

The error you are describing makes me wonder if something is going wrong with the preloading/caching of stimuli images as the odd behavior you describe with images sometimes appearing and sometimes not can be caused by the browser not having the images readily available in the cache. Can you check if you kept the logic in the service init() method to load the stimuli file the same as in the original ChoiceReaction? Also do you use the exact same stimuli file format (column stimulusValueType and column stimulusValue with image files (e.g. jpg, jpeg,png,gif)? I assume if you use the same stimuli with the original tatoolChoiceReaction executable it works? You can also share your Executable code with me if none of the above seems to help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tatool/tatool-web/issues/133#issuecomment-614210705, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5KZDCQQ6FBZL3PV4G3GULRMX5TZANCNFSM4MFOC4OA.

andreadecesarei commented 4 years ago

Hi Andre, yes I think too is might be due to preloading/caching. Also, the structure of the experiment is perhaps more complex of what tatool was initially meant to handle - please find the json file attached. As timing is not critical in the present experiment, I created an ad-hoc solution with the executable pictureviewing which 1) does not use promises in the init function, rather 2) loads each image in the ctrl file and 3) displays a blank image after the offset of the picture in the ctrl file. This last step is necessary because on some browsers (edge and especially firefox) the image from the previous trial (cached??) is displayed before the image from the current trial. As a result, the experiment runs fine with edge and chrome, but does not work (at all?) with firefox, which is ok for us. Please find attached the executable I am referring to, and excuse the in-elegance of my programming skills. Here are the dropbox links to the files:

https://www.dropbox.com/s/4p8r8977mp7rfag/executables.zip?dl=0 https://www.dropbox.com/s/kvix65nb7tq0ayh/Vaccini_A.json?dl=0

With your software and these changes, we started collecting pilot data. Again, thanks for the software you have created and for your kind support

Best regards, Andrea

Andrea De Cesarei, PhD Associate Professor Alma Mater Studiorum-University of Bologna Department of Psychology Viale Berti Pichat 5 40127 Bologna ITALY e-mail: andrea.decesarei@unibo.itmailto:andrea.decesarei@unibo.it Website: http://goo.gl/KoY3O

Da: Andre notifications@github.com Inviato: mercoledì 15 aprile 2020 20:41 A: tatool/tatool-web tatool-web@noreply.github.com Cc: Andrea De Cesarei andrea.decesarei@unibo.it; Author author@noreply.github.com Oggetto: Re: [tatool/tatool-web] images in ChoiceReaction (#133)

The error you are describing makes me wonder if something is going wrong with the preloading/caching of stimuli images as the odd behavior you describe with images sometimes appearing and sometimes not can be caused by the browser not having the images readily available in the cache. Can you check if you kept the logic in the service init() method to load the stimuli file the same as in the original ChoiceReaction? Also do you use the exact same stimuli file format (column stimulusValueType and column stimulusValue with image files (e.g. jpg, jpeg,png,gif)? I assume if you use the same stimuli with the original tatoolChoiceReaction executable it works? You can also share your Executable code with me if none of the above seems to help.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tatool/tatool-web/issues/133#issuecomment-614210705, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5KZDCQQ6FBZL3PV4G3GULRMX5TZANCNFSM4MFOC4OA.

alocher commented 4 years ago

Hey Andrea, I appreciate I haven't gotten back to you on this for a while. Just wondering if this is still an issue for you? Looking at the attached Executable it's missing the logic in the init() to only return once the load of the stimuliFile (and therefore the potential images the stimuliFile refers to) has completed. I assume you removed that bit as you mentioned above?

In theory you should be able to see this working in case you follow a similar approach as the tatoolChoiceReaction which is returning the Promise object and resolves it once getCSVResource has completed (after the .then). You can also monitor this if you open your developer console (f12) and look at the Network Tab while you're starting your module. You should see your images being requested at this point before it moves on to start showing your first Executable.

andreadecesarei commented 4 years ago

Dear Andre,

Thanks for your response. The good news is that the code worked on two browsers (chrome and edge, as far as i remember), so we managed to collect some data. The bad news is that right now I do not have a clear memory of the debugging steps I did - I think I did what you suggest, though. The problem seemed to concern the different use of the cache between different browsers. I'll let you know if I will look again at the cache issue in the future.

Again, thanks for your support and help Best regards Andrea

Andrea De Cesarei, PhD Associate Professor Alma Mater Studiorum-University of Bologna Department of Psychology Viale Berti Pichat 5 40127 Bologna ITALY e-mail: andrea.decesarei@unibo.it Website: http://goo.gl/KoY3O


From: Andre notifications@github.com Sent: Saturday, September 5, 2020 2:51:17 PM To: tatool/tatool-web tatool-web@noreply.github.com Cc: Andrea De Cesarei andrea.decesarei@unibo.it; Author author@noreply.github.com Subject: Re: [tatool/tatool-web] images in ChoiceReaction (#133)

Hey Andrea, I appreciate I haven't gotten back to you on this for a while. Just wondering if this is still an issue for you? Looking at the attached Executable it's missing the logic in the init() to only return once the load of the stimuliFile (and therefore the potential images the stimuliFile refers to) has completed. I assume you removed that bit as you mentioned above?

In theory you should be able to see this working in case you follow a similar approach as the tatoolChoiceReaction which is returning the Promise object and resolves it once getCSVResource has completed (after the .then). You can also monitor this if you open your developer console (f12) and look at the Network Tab while you're starting your module. You should see your images being requested at this point before it moves on to start showing your first Executable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/tatool/tatool-web/issues/133#issuecomment-687606919, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AO5KZDDXU2UNTI22KNAA4MLSEIX4LANCNFSM4MFOC4OA.

alocher commented 4 years ago

Sounds good, I'll close this and you can just reopen if you get back to it.