Write data on my excel file

Hello, I am in the last step of building my experiments. I am trying to save in an excel file data suitable for analysis and fMRI synchronization. I have three questions:

  1. Does Psychopy write data on excel spreadsheet just when the experiment is brought at its end? (i.e. all the trials are being performed), I noticed that when I push esc to end the experiment before the time no excel data are saved. It is not a problem but I would like a confirm on that and also I would like to know if there is any way to overcome this limit.

  2. More compelling, I am trying to use the addData function to 1) write down my randomised jittered fixation cross duration. I also would like to use the same function to 2) write on my excel file the time stamps of the stimuli appearing on the screen. I followed the advice on other threads using the following code component in the code that randomize the duration of my fixation cross, but I do not achieve my goal. I tried to put this component both in “start routine” or “end routine” but it does not working (while the jittering is working totally fine.

thisExp.addData(‘fix_duration’, jitter)

If I want to use addData to add the time stamp of each of my stimuli on the screen, how should I do? Where my code component should be located? Do I need a code for each stimuli I present (they are quite a lot during each trial) or a code for each routine may be enough?

  1. For one of my experiment the excel file is not created at all (also if I bring at conclusion the experiment). A Csv file is created having just the heading (i.e. the name of my variables, including “jittering”) but without data. This experiment has a lot of variables to write, it may depends on that? How can I solve this problem?

Thank you

You should avoid Excel output and use .csv instead (search this forum for reasons).

This is not the intended behaviour but there was a bug with this recently. You should try updating to a version where this bug has been fixed (check the PsychoPy change log).

We need more detail than this. How is it not working? Do you get an error, or an unexpected result?

Hi Mike, Thank you for your answer. I’ll try to use .csv files for my goals, in any case, looking at .csv files they have the same issues than I had excel files

  1. Using the command thisExp.addData(‘fix_duration’, jitter) sometimes I do not get the column ‘jitter’ at all, somewhere else I get it but it is empty. My question is where precisely I should write this command in order to make it working properly.

  2. Following the same principle let say that I want to write the time stamp of things happening in my experiment (i.e. when the stimulus appears on the screen). How I do that? I am working on an fMRI experiment so I need precise timing in order to better analyze my data later

Quick update:

I was able to write the fixation cross jittering for some of my experiments on a csv file. I still do not know how to have the precise time stamp of stimuli presenting on the screen.

I have an experiment using as condition file in the loop a very very large excel sheet (40 rows for 64 columns). I can not avoid this file size due to the complexity of the experimental stimulation (I have already excluded from the file conditional values and columns that do not have to be used by psychopy. Psychopy is still not writing data on my csv and I suspect that the reason is the fact that the excell file has too much column. Do you have any insights on that?

Thank you