Howdy, Stranger!

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

Supported by

separate log files per trial sequence?

Hi, I was wondering if there is any code I can write, or if there is any shortcut for making separate log files for each trial sequence?

I know that for Psychopy I can do something like nameOf TrialSequence.saveAsWideText(filename+'_"+label+'.csv')

Thanks!

Mariana

Comments

  • edited May 2017

    Hi dsilva,

    You could log separate variables in a csv file in the following way:

    log_path ='C:\etc etc \\some folder'
    x = 1
    y = 3
    back_up_list = '%s,%s' %(x,y)
    f = open('%s\\question_file_subject%s.csv' %(log_path, exp.get('subject_nr')), 'w')
    f.write(back_up_list)
    f.close()
    

    I am however not sure how you would get the row by row structure in such files, so in this way
    you could only write one line; but its seems that is what you would like to do?

    Be careful also with the folder in which you save the file: make sure it exists, otherwise you get this following error:
    "IOError: [Errno 2] No such file or directory: 'C:\Users\ect ect ect\some_folder\question_file_subject990.csv'"

    If you are only logging after a block you might only get the error at the end of a block. Perhaps save a test file at the beginning of the experiment so if the folder does not exists you see it right at the beginning.

    Alternatively separate your data afterwards, using python (for example in spyder):

    import pandas as pd
    data=pd.read_csv('NAME_OF_LOG_FILE.csv', sep = ',')
    log_path ='C:\\ etc etc etc \\some folder')
    for i in range(0, len(data)):
        to_save = data.iloc[[i]] #this is one row of your data
        to_save.to_csv('%s\\name%s.csv'%(log_path,i))
    

    If you provide a bit more info about the type of data you are collecting and why you want separate files per trial and how you would like your data to look like. Perhaps we can come up with a solution that fits better.

    Maybe of use:
    http://osdoc.cogsci.nl/3.1/manual/logging/
    http://www.pythonforbeginners.com/files/reading-and-writing-files-in-python

  • Hi Roelof, thanks for your reply -- well, I am conducting an operation span task in which a person has to evaluate math equations and say if they are true or false( and I am tracking mouse movements in this part), and they have memorize a sequence of letters - so, in a trial ( which may vary in length), they evaluate a math equation, then see a letter, evaluate a math equation, see another letter, and so on. First of all, I need a logger item that records their responses to the each of the math problems as well as their mouse movements. And at the end of each trial, I have the participant write down what they remember from the sequence of letters they saw ( and here I have another logger item). The issue I have is that I have two different log items - one that records all of the math equations, and one that records the letters at the end of each trial - but I get everything in one file. I know that I can clean up my data afterwards, and separate both of these, but I was wondering if there was any way in which I would just record the math equations and mouse movements information in one file, and the letter sequences in another. Thank you :)

  • edited May 2017

    To my knowledge opensesame does not support multiple logger items. The only way I see that this might work would be to store the equations in a separate file perhaps all of them at once at the beginning of the experiment (using the file.write )

    However, I am still not sure why you need separate the files; if the responses and the equations are stored as separate variables in separate columns they can be easily handled in the data analysis as individual items.

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