Howdy, Stranger!

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

Supported by

Timing between two canvas

Hello,

OK there is something I do not understand when there is a loop, and when a canvas is drawn at every iteration.
So I tried something simple:


So I prepare a canvas, draw it and write the time of presentation of the canvas, then I sleep for 1sec.

For some reasons when I check the time difference between two consecutive canvas presentation I have really strange numbers:

Shouldnt the time there be a multiple of my refresh rate close to 1 sec?

Also I join the script I used for testing (I tried that with both psychpy and expyriment and same results).

Thanks!

Sylvain

Comments

  • Hi sylvain,

    I'm no expert, but I've been dealing with between-loop timing problems of my own, so I might be able to help...

    From the looks of your script, I would expect "Difference time_pres" to always be > 1000, since the canvas takes time to be prepared during the prepare phase, and then you sleep for 1000ms. It does seem like most of your values are pretty close 1000 + a multiple of 16.7 (refresh period at 60Hz).

    I've always noticed that the times in the logger are not quite exact multiples of my refresh period, a millisecond here and there, which I'm guessing has something to do with the time between the stimulus being drawn and the time being recorded? But, in general, I think within-trial timing in OpenSesame is way more precise and consistent than between-trial timing, owing to the front-loading of stimulus prep.

    Maybe I'm not understanding your question correctly. Are you concerned that there is so much extra time (over 1000ms) or that the extra time is not an exact multiple of your refresh rate?

    Best,
    Jonathan

  • Hi Sylvain,

    Have you tried it with xpyriment backend? You can select the backend in the main settings by clicking on "new experiment".
    If you want to have Diff time_pres to be close to 1000ms, do not use clock.sleep (1000), but clock.sleep (995).
    Also see here for timing issues http://osdoc.cogsci.nl/3.2/manual/timing/

    Greetz
    Stephan

  • Hey,

    Yeah I have also tried with the xpyriment backend and it is the same.
    But I have also tried the idea of Jonathan and he is right: by staying within a loop then the accuracy is much better. I wonder if it takes too much time maybe to write on a logger or just switching from one iteration to the other.

    Sylvain

  • Ah, now i see.
    Just put your logger at the end of the experiment. At the moment it is set into the loop. That's not the correct position.

  • Hey,

    Well the issue is that if you put it at the end you lose the information on every trial (apart from creating a list I do not see any other way to log stuffs then, but maybe there is another option I do not know?).
    OK so I tested how long it take in order to log things with the logger look and it is I think enough at least to really considerate filling list instead:

Sign In or Register to comment.