Howdy, Stranger!

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

Supported by

[solved] inline script logging fails

edited May 2014 in OpenSesame

Hi,

because i collect this variables in another thread, I have this code in my script:


# log to experiment
def logToExperiment():
    for x in toneStartLog:
        print 'toneStartLog', x
        exp.set('ToneStartTime_RTT',x)
    for x in strokeResponseLog:
        print 'strokeResponseLog', x
        self.experiment.set('strokeResponse_RTT',x)
    for x in responseTimeLog:
        print 'responseTimeLog', x
        exp.set('responseTime_RTT',x)
    exp.set('keyStrokes_RTT',keyStrokes)
    print 'keyStrokes', keyStrokes

the following is printed:

toneStartLog
12.0241760706
strokeResponseLog
12.96 (...)
responseTimeLog
0.94934 (...)
keyStrokes
51

I log the variables with a logger, but the logged file only says "NA" under all these variables.

Anybody knows why this is failing ?
Thanks in advance :)

Comments

  • edited 1:09PM

    Hi,

    What you are doing with the exp.set function is making a variable on the OpenSesame GUI level. This does not actually log the variable, nor it's value! What you probably want to do, is use the inline_script's self.log function. See here for it's documentation.

    In your case, this would result in something like the following:

    # log to experiment
    def logToExperiment():
        for x in toneStartLog:
            print 'toneStartLog', x
            self.log('ToneStartTime_RTT,' + str(x))
        for x in strokeResponseLog:
            print 'strokeResponseLog', x
            self.log('strokeResponse_RTT,' + str(x))
        for x in responseTimeLog:
            print 'responseTimeLog', x
            self.log('responseTime_RTT,' + str(x))
        self.log('keyStrokes_RTT,' + str(keyStrokes))
        print 'keyStrokes', keyStrokes
    

    This wouldn't result in the prettiest log file ever, but you can of course think of other ways to do this! Another option is to create your own logfile:

    # open log
    exp.my_log = open('custom_log_%d' % self.get(subject_nr), 'w')
    # write header to log
    exp.my_log.write("var_a,var_b,var_c\n")
    # write some random values to log
    for i in range(3):
        exp.my_log.write("%d,%d,%d\n" % i, 2*i, i+3)
    # neatly close log
    exp.my_log.close()
    

    Good luck!

  • edited 1:09PM

    Hi Edwin, thanks very much for the answer and help.

    Yes i saw the possibility to log text, but this indeed would result in a non-handable logfile for later analysis.

    My initial question was aiming at if it is possible log with loops, in this case I would have thought every assignment of a variable would be a new line in the log file but this is unfortunately not the case.

    i ended up logging every single value to a variable (attaching a logger).

    exp.set('responseTime_RTT1',responseTimeLog[0])
    exp.set('responseTime_RTT2',responseTimeLog[1])
    exp.set('responseTime_RTT3',responseTimeLog[2])
    (...)
    

    As a complete logfile with the other variables from the experiment is prefered, this solution is not pretty but acceptable.

    I guess I just did not completely understand the logging concept of OS ;)

    Thank you very much!

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