Howdy, Stranger!

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

Supported by

[solved] Skip subject number and log path dialogs

edited June 2015 in OpenSesame

Hi,

We are going to do field testing with Nexus 7 (Android 5.1.1) at festivals this summer and to improve the efficiency i am wondering if it is possible to omit the dialog screens at the beginning of the experiment. Ideally the experiment will automatically 'up' the subject number by one from the previous run and then use the new number as as subject number and log paths for the new run.

Secondly, we will use multiple tablets with the same experiment. To avoid having multiple subject-x.csv files is there a way to ID the individual tablet and write this to the log file?

Any suggestions are appreciated!

Comments

  • edited June 2015

    Hi,

    You can bypass the startup menu of the OpenSesame runtime for Android by creating an opensesame-autorun.yml file as described here (new in 2.9.5):

    This will always start the experiment with the same logfile, but you can reopen a new logfile at the start of the experiment as described here:

    Does that help at all?

    Cheers,
    Sebastiaan

    Buy Me A Coffee

  • edited June 2015

    Hi Sebastiaan,

    Thank you for the answer, bypassing the menu works like a charm with the .yml file. If anyone else wants to use it: it only works if the experiment is saved as a .opensesame file and not as .opensesame.tar

    The second part, incrementing the file name by one and use this as a new log file, has not worked for me yet. This is what i want to use in the beginning of the experiment:

    import codecs
    import os
    
    exp._log.close()
    
    i = 1
    while os.sdcard\Data.exists("subject-%s.csv" % i):
        i += 1
    
    exp._log = codecs.open('subject-%s.csv', 'w', encoding='utf-8')
    

    So it opens the latest log file that has been created. Unfortunately, this does not work. I wish i could copy the debug-file but for some reason the windows explorer crashes whenever i try to open/copy/delete a .txt file from the Nexus 7 (is this a known problem?).

    EDIT: This is the same debug file but generated from my laptop:

    Starting experiment as ExperimentProcess-6
    openexp.sampler._legacy.init_sound(): sampling freq = 48000, buffer size = 1024
    openexp.sampler._legacy.init_sound(): mixer already initialized, closing
    experiment.init_log(): using 'C:/Users/Laurent/Documents/Psychology/MajorThesis/Experiment/subject-0.csv' as logfile (utf-8)
    experiment.run(): experiment started at Tue Jun 02 17:16:48 2015
    
    Failed to compile inline script
    
    code: while os.C:\Users\Laurent\Documents\Psychology\MajorThesis\Experiment.exists("subject-%s.csv" % i):
    
    exception type: SyntaxError
    exception message: 
    item: rename_log
    phase: run
    line: 7
    
    Traceback:
      File "dist\libopensesame\inline_script.py", line 144, in prepare
      File "dist\libopensesame\python_workspace.py", line 97, in _compile
      File "<string>", line 8
        while os.C:\Users\Laurent\Documents\Psychology\MajorThesis\Experiment.exists("subject-%s.csv" % i):
                                                                                                          ^
    SyntaxError: unexpected character after line continuation character
    
  • edited 3:01PM

    The error message is gone now but log file does not work properly since it does not update the new file. When i run OpenSesame on the tablet it automatically starts the experiment. This is what is have at the start of the experiment to close and re-open the current logfile with a newly assigned subject number.

    import codecs
    import os
    
    # Close current log file
    exp._log.close()
    
    # Define the first log
    i = 1
    while os.path.exists("subject-%s.csv" % i):
        i += 1
    
    # Open the new log file with up to date participant number
    exp._log = codecs.open('subject-%s.csv' % i, 'w', encoding='utf-8')
    

    During the experiment is use the default logger with two variables. But there is no new .csv file written nor any error. Can anyone see what i'm doing wrong here? Could it be that the logger item does not acknowledge the new log file?

  • edited 3:01PM

    Hi,

    You don't specify a folder, so the logfile is created in the working directory. To be honest, I don't know what that is for an Android app, but it's probably some internal, hidden folder.

    Does it work if you explicitly specify the logfile folder? Here I used /sdcard/:

    import codecs
    import os
    
    # Close current log file
    exp._log.close()
    
    # Define the first log
    i = 1
    while os.path.exists("/sdcard/subject-%s.csv" % i):
        i += 1
    
    # Open the new log file with up to date participant number
    exp._log = codecs.open('/sdcard/subject-%s.csv' % i, 'w', encoding='utf-8')
    

    Cheers,
    Sebastiaan

    Buy Me A Coffee

  • edited 3:01PM

    Hi Sesbastiaan,

    Thank you for the reply. I managed to get it to work now by specifying the folder and changing the input from string to decimal. I also created a manual logger instead of the standard item because the files were starting to get messy.

    I guess the earlier log files are written to /data/data/nl.cogsci.opensesame which is indeed a hidden folder.

    Anyway, the workaround allows for much more efficient data gathering, so thank you for the help!

    Cheers,

    Laurent

  • Hi Sebastiaan and Laurent,

    I would love to find a way to bypass the "Enter subject number" dialogue box (so participants don't have to input a subject number manually), change the text the dialogue box contains (so I can replace with my own more specific instructions), or apply default subject numbers that are not 0 for each run. I use the regular OpenSesame (not runtime) on a PC. Do you know of any ways to do any of these things?

    Thank you so much,

    Jessica

  • Hi Jessica,

    With the regular desktop application this is not possible, but opensesamerun allows you to specify the subject number and log file on the command line, like so:

    opensesamerun my_experiment.osexp -s 0 -l logfile.tsv
    

    Cheers!

    Sebastiaan

    Buy Me A Coffee

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