pythonpsychopy

ExperimentHandler CSV output value separator environment dependant


(I'm not a pyschologist nor pysychopy export but helping one) We're developing an expirement using the Coder (not Builder).

The output of an experiment is written out using the data.ExperimentHandler.addData(). When I run the application on my machine I get output like this:

,,1,1,z,f,o,o,1.254349554568762,0.8527608618387603,0.0,1.0,FSAS,,,,,,,,,,,,,,,52,male,52,

When the other person runs the application she gets:

;;0;1;z;z;j;j;105.498.479.999.369;0.501072800019756;1.0;1.0;FNES;;;;;;;;;;;;;;;23;male;0

(the difference I want to show is about format, not the values)

There are 2 differences:

I think it has to do something with regional settings.

Question: Is it possible to force the format so the application always generates the same output format independant from local settings ?


Solution

  • You don't specify whether you are using the graphical Builder interface to PsychoPy to generate your Python script, or writing a custom script directly in Python.

    If using the Builder interface, click the "Experiment settings" toolbar icon select the "Data" tab, and specify that the datafile delimiter should be "comma" rather than "auto".

    If running your own script, then in the saveAsWideText() method of the ExperimentHandler class, similarly specify ',' as the delim parameter. The API is here: https://psychopy.org/api/data.html

    In future, you will likely get better support at the dedicated PsychoPy forum at https://discourse.psychopy.org The actual PsychoPy developers and other experienced users are much more likely to see your queries there compared to here at StackOverflow.