Howdy, Stranger!

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

Supported by

[solved] Variable defined using "exp.set" in a for-loop in inline script is not detected by logger

edited June 2015 in OpenSesame

Hi,

In a python inline script, I define experimental variables both inside and outside a for-loop:

exp.set('standard_dur', 4000)
for i in range(1,8):
---exp.set('comp_dur_' + str(i), 2000+i*500)

The variable "standard_dur" is detected by the logger, but not the "comp_dur_X" variables. I read in the forum that the logger detects all variables that are present the first time the logger is run. I can imagine that the "comp_dur_X" variables are not detected because they are only created once the loop is executed. When I initialize the variables with an arbitrary value before running the for-loop, they are properly detected by the logger and the data file contains the values that I assigned to the variables in the for-loop. However, this does obviously not work if I do not know beforehand how many additional variables I need to create. So my question is how I can add variables to the logger "on the fly", i.e., at the time the variables are created.

Sabine

Comments

  • edited 8:39AM

    Hi Sabine,

    Have you tried adding a custom variable in the logger item? It's on the right side of the screen, i believe you can log all the variables create during the experiment by hand there.

    • Laurent
  • edited 8:39AM

    Hi Laurent,

    The problem is that I do not know beforehand how much variables I want to log, so I cannot add them to the logger manually. Therefore I am searching for a way to add the variables to the logger as they are created. My current way out is that I create a large number of variables with a default value. The logger detects these variables. During the experiment, I then assign the values I want to log to a subset of these variables. The remaining, unused variables keep their default value.
    Still, I was wondering whether there is a more elegant way of logging variables that are created during the experiment (i.e., after the logger is run for the first time).

    Sabine

  • edited 8:39AM

    Hi Sabine,

    Normally the logger should detect all variables set with exp.set; even variables you create in a loop. But it might depend on where in the structure your logger is placed exactly.

    If anything, you can also manually log variables (yes, it's possible to log variables "manually" on the fly), as follows:

       for i in range(1,8):
             exp.set('comp_dur_' + str(i), 2000+i*500)
             self.log('comp_dur_' + str(i) + ' =' + str(2000+i*500))
    

    Cheers,

    Josh

  • edited 8:39AM

    Great, thanks!

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