Howdy, Stranger!

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

Supported by

[solved] Set the duration of a sketchpad according to the length of the current sequence

edited October 2013 in OpenSesame

Hello,
I am actually making an OpenSesame version of the ANT (original by Fan et al., 2002).
I have two main problems.

  1. 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.

  2. 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

  • edited 2:26PM

    Hi Franck,

    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.

    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:

    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.

    If you want, you can set any kind of timestamp at the beginning of the trial with an inline_script. For example:

    import time # See http://docs.python.org/2/library/time.html
    exp.set('trial_utc', time.gmtime()) # Second accuracy
    

    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

  • edited October 2013

    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 :

    t = datetime.datetime.now()
    print t
    print t.hour, t.minute, t.second, t.microsecond
    self.experiment.set("temps", t)"
    

    Thank you for your time,

    Franck.

  • edited 2:26PM

    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.

  • edited 2:26PM

    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?

    Well, that boils down to stripping off the last three digits, right? So you can simply convert the datetime object to a str (which was already silently done by exp.set()) , and slice off the last three characters, like so:

    import datetime
    now = datetime.datetime.now() # Get datetime object
    s = str(now) # Convert to str
    s = s[:-3] # Strip off last three decimals
    exp.set('temps', s)
    

    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!

  • edited 2:26PM

    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.

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games