[solved] Set the duration of a sketchpad according to the length of the current sequence
Hello,
I am actually making an OpenSesame version of the ANT (original by Fan et al., 2002).
I have two main problems.
Each trial must last 4150ms. To get this length, i have: a 1st sketchpad (random duration between 400 and 1600ms) ; 1 sampler + 2 sketchpads (total = 650 ms) ; a keyboard response ; and a last sketchpad.
So, i have to find a way to set the last sketchpad in order to make it last :
4150ms - 650ms - 1st sketchpad duration - response time.
I have tried Sebastiaan's solution from http://forum.cogsci.nl/discussion/505#Item_8 but it looks like i still don't have a "calibrated" time for each trials. When i try to read the logs, the length of each trial is around 5000ms but never the same time.I want to get the exact time (UTC) at the beginning of each trial in the logger. But i don't know how to do it.
Did someone have the same issue?
I hope i have been clear, ask me if you need more informations.
Thank you in advance.
Franck.
Comments
Hi Franck,
The jitter that you're seeing is presumably due to variation during the prepare phase that precedes each trial. That is, the timing within the trial should be very constant (when implemented properly, of course), but the timing between trials can vary a bit. This is described here:
If you want to ensure that the start of each trial is separated by a fixed interval (i.e. non-slip timing), you can do this with an
inline_script. See for example here:If you want, you can set any kind of timestamp at the beginning of the trial with an
inline_script. For example:For most cases it will suffice to look at the timestamp of the trial_sequence item, though. This variable is called
time_trial_sequence:Cheers,
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thank you for your fast answer.
I tried to use the time_trial_sequence but in my excel file, all y get is "NA" for that column (named time_essai_entrainement in my experiment). so, in order to calculate the exact length of my trial, i use to substract the time of the last item (of the current trial) from the time of the last item (from previous trial).
In order to set the length of the trials and avoid inter-trials slips, i tried your script from http://forum.cogsci.nl/index.php?p=/discussion/298/open-timing-issue/p1.
I set the trial_duration = 4150.
Now i have better trial durations, but it still move between 3800 and 4500ms (mean=4153ms). I was wondering wether those different trial times can be due to my computer's calculation time for my random factors?
To get the exact UTC time, your
exp.set('trial_utc', time.gmtime())works perfectly but what i wanted was the time with a millisecond accuracy. So, i found this script and i think it works the way i need it :Thank you for your time,
Franck.
Re,
I managed to get the exact length combining both of your examples :
http://forum.cogsci.nl/index.php?p=/discussion/298/open-timing-issue/p1
and
http://forum.cogsci.nl/discussion/505#Item_8
Now i think that part is good. I get 4150ms for each trial (sometimes 4151ms but it's not a problem)
All i need now is to get the GMT time (in milliseconds) at the beginning of each trial. The problem with my script is that in my excel file, the "time" is given in minutes, seconds, microsecond. Or i would like to have it only in ms.
Do you have an idea?
Thanks,
Franck.
Well, that boils down to stripping off the last three digits, right? So you can simply convert the
datetimeobject to astr(which was already silently done byexp.set()) , and slice off the last three characters, like so:For advanced formatting, you can also take a look at
date.strftime(), but I'm not sure whether it can deal with sub-second values.Cheers!
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi Sebastiaan,
Thank you for your answers and ideas to solve my problem.
My duration problem is now solved. I tried to run my experiment on a better computer and it worked perfectly to 4150ms per trial with no variations.
:-\"
For the GMT time, your solution worked, so i took both functions. Now i have a column only with ms, and a column with full datetime.datetime.now(), and it's perfect like this !
Thank you a lot for your fast answers !
Best,
Franck.