0

I hope that someone can give me an answer to a basic question concerning a beginners problem with psychopy. I want to save the output of an reaction time experiment in an excel file. I managed to do that, but I do have the problem, that I can't get the values in the right order (meaning they are not written in the columns in the excel file which I want them to be written in). My code looks similar to this:

> save data for this loop Uebungsblock_1.saveAsExcel(filename + '.xlsx', sheetName='Uebungsblock_1',
>     stimOut=['Block','Trial','Task','Stimulus','Correct_Response'],
>     dataOut=['RT_raw', 'RT_mean', 'Error_raw'])

[1] I want that in the excel file the "dataOut" is given out in the same order as I coded it. But it always stores the data in an alphabetical order (first 'Error_raw' [Column F in Excel] then 'RT_raw' [Column G in Excel] and lastly 'RT_mean' [Column H in Excel]).

It would be really great if someone could help me with that.

[2] I also would like to mix the order of outputs of parameters and datas. For example I would like to order excel to start with a parameter (eg. 'Block' in column "A") after that a dataOut (eg. 'RT_raw' in column "B") and after that another parameter (eg. 'Task' in column "C"). I am not quite sure if this is possible, but if it was I would really appreciate it if someone could tell me how to do it.

[3] My last question is about appending data to one existing excel sheet. If I already have created one excel-sheet eg. "Uebungsblock_1" is it possible to tell Psychopy to append new data to this sheet or does it just overwrite it or create a "Uebungsblock_11" sheet?

Thanks for helping me out!

Donald Duck
  • 8,409
  • 22
  • 75
  • 99
Fal
  • 1
  • 2
  • PsychoPy Builder or Coder? – Michael MacAskill Feb 28 '16 at 19:28
  • I am using the coder. If there is a possibility to do it with the builder I am open to that one too. – Fal Feb 29 '16 at 09:33
  • Putting this in a comment as you might not find it an answer. (1) If the `.saveAsExcel` function doesn't allow you to specify the order, your only alternative is to implement your own substitute functions. (2) If doing this, it is much easier to write to .csv than .xlsx, although multiple sheets aren't possible. (3) The PsychoPy team is trying to discourage people using Excel output for a variety of reasons (stability, performance, premature data summarisation). It is generally preferable to `.saveAsWideText` to save all (unsummarised) data and script your analysis to work with that format. – Michael MacAskill Mar 01 '16 at 04:11
  • Thank you very much for answering. I tried to use `.saveAsText` and I found the `matrixOnly` boolean to be very helpful. I decided to use this option and not the `.saveAsWideText` as I still wanted to be able to decide which params and data is given out. Is there a possibility, that I could only give out either the header or the extraInfo of a loop? If I do `matrixOnly = false` both is given out and if I do `matrixOnly=true` both is not given out. As it seems to be just a boolean I doubt that there is a possibility to decide which one should be hidden, but maybe I am overlooking something. – Fal Mar 02 '16 at 18:55
  • 1
    I think you will need to write your own exporting code. But you could start with the existing functions and just tweak those to achieve what you want (such as ordering the variables). *BUT* I would strongly encourage you to avoid the temptation and just save all of the data, unsummarised. You'll kick yourself later if a reviewer asks a question that can't be addressed because you threw away raw data, just because it didn't seem relevant at the time. – Michael MacAskill Mar 02 '16 at 20:15

0 Answers0