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
Hi dsilva,
You could log separate variables in a csv file in the following way:
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):
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
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.