Howdy, Stranger!

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

Supported by

Custom log file name

Hello there I tried but with no luck to find how to name your log file. My initial idea is to supress original log file (subject-1.csv, subject-2.csv etc.) and create a new one (idealy xlsx table with pandas) but I guess this is not a OpenSesame way, right?

Is it possible to "rename" log file like abreviationofexperiment_condition_measurement_incrementalvalueofsubjectid.csv (idelay delimited with ";")?

Thank you a lot.

PS: I have already written an Python 2.7 app which converts csv logfile to xlsx with GUI if you would like to implement this in OpenSesame I gladly share source files (i have done this because I was tired of opening Excel and import log file just to take a look if every variables are logged).

Best regards,
Michael

Comments

  • Hi Michael,

    If I were you, I would stick with csv files for recording data in OpenSesame (but also I prefer csv files in general). However, when you want to change the log file name, you can put this piece of code in an inline_script in the beginning of your experiment:

    log.close()
    log.open(u'/path/to/file/abreviationofexp_%s_measurement_%s.csv') %(condition,subject_nr)
    

    And if you really want a .xlsx file, you could convert the csv logfile to xlsx in the end of your experiment.
    This code put in an inline_script in the end of your experiment should do the trick. However, I haven't tested it a lot, before you use it, make sure that no funny things are happening.

    log.close()
    import pandas
    df = pandas.read_csv('/path/to/file/test.csv')
    df.to_excel(''/path/to/file/test.xlsx')
    

    Hope this helps

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.