Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

coroutines in osweb

Hi

I am currently working on an antisaccade experiment.

I have a problem regarding implementing it on osweb

in every trial there is a cue then a mask and I want to collect responses from the time the stim appeared


in open sesame I use a coroutine but currently, it is not supported.

is there a way to solve this?

thank you

Dror

Comments

  • Hi Dror,

    You can achieve something similar with an inline_script (if a python implementation helps you, I can make an example, but for an javascript implementation you're on your own). Alternatively, you can use a structure like this:

    • fix
    • start_timer (javascript_inlinescript)
    • stim (duration 0 ms)
    • resp_1 (duration 400 ms)
    • mask (duration 0 ms)
    • resp_2 (duration infinite or timeout - 400ms, where timeout represents the total response duration)
    • stop_timer (javascript_inlinescript)

    If you want, you could set the run_if fields of mask and resp2 to [response] != None (meaning that participants have not responded during the first phase, so that they are skipped.

    Then, the variables resp_1.response or resp_2.response will carry the response key (so you need to check whether any of the two is not None, and then use the other one). To get the response time, I would take a sample of the time at the javascript_inline (run phase), and another one after the second response phase (also run phase). Then you can use the difference between them as response time.

    See here for more info on javascript_inline: https://osdoc.cogsci.nl/3.3/manual/javascript/about/

    Hope this helps,

    Eduard

    Buy Me A Coffee

  • Hi @drorgarbi,

    You are correct: co-routines are not supported in OSWeb. In your case, if the mask's duration is so short that you don't reasonably expect participants to respond during the presentation of the mask, I'd suggest inserting the keyboard object right after the mask and, if the RT must be measured from the stimulus' onset, use Javascript code to modify the vars.response_time once the response has been registered (to add to it the duration of the stimulus and mask).

    If you want participants to be able to respond while the stimulus or the mask are on screen, you'll have to use two keyboard objects and a feedback object to display what ever needs to be on screen once a response has been registered (and set the duration of that feedback object to the mask's duration minus the response time of the response collected). It's a little cumbersome and you'll have to do some programming and tweaking. I gave a description of the overall method in an earlier post: https://forum.cogsci.nl/discussion/comment/23116#Comment_23116. You should be able to adapt it to your needs.

    This method is actually similar to that @eduard was suggesting.

    Good luck!

    Fabrice.

    PS: If you have the option of modifying your design to avoid having to present several keyboard objects and sketchpads/feedback items, better, as I recently observed that OSWeb 1.4 is subject to memory leaks (https://forum.cogsci.nl/discussion/7623/memory-leaks-in-osweb-1-4-sketchpad-feedback-sampler#latest). If you're using a large number of trials, this could possibly cause the task to be unstable or the timing of events to become unreliable.

    Buy Me A Coffee

Sign In or Register to comment.