psychopy.org | Reference | Downloads | Github

Deleting a column while running an experiment

Hello,

I’m very new to Psychopy. And to Python too to be honest.
I am building an experiment that uses the name of the participant as a prime. In order to do that, I added a category in the opening dialog box (which contains informations such as “Participants” and “session”) named “name” in which the participant writes his name.
I then proceed to call this information (expInfo[‘name’]) in a routine to prime target-words with it. I’m kind of proud (yay!..) to say that it worked fine.
Anyway my real problem is that, in doing so, I automatically save the participants name, which is a violation of privacy. So here is my question :
Is there a way to use the participants name in that way and then, to suppress the participants name automatically from the output? Maybe a code line allowing me to suppress the column “name” from the .csv output before closing the experiment?

I’m sorry if this question is a little bit boring… I’ve searched but couldn’t find something similar on this website.
Any help is appreciated,

Thanks a lot!

Jean

If you need any more info I can disclose, don’t hesitate to ask,
Thank you very much!

J

HI @Jean, yes you can do this with a couple of steps. To stop the expInfo['name'] from being written into your datafile at the end, add a code component with the following in the tab “Begin Experiment”:

nameText = expInfo['name']
expInfo['myName'] = None  # Now, only None is written

Now, instead of using $expInfo['name'] in your text component, use $nameText. An additional step you have to take is to change the logging level in your experiment settings to log ERROR only, Otherwise, the default “EXP” log level will log the name of your participant in the log file - take a look at your log file for info.

2 Likes

Hi !
Thanks a lot! That worked just fine!
I just had to insert the code component at the beginning of the “initialize components for the [last routine]”, because if I wrote it the the beginning of the experiment it primed “none” instead of the name.

Thanks a lot again!
Best,

Jean

@Jean, it should not prime None if you do not use expInfo['name'] as your text variable. Did you use a code component? If you are using Builder, then using a code component should get the desired output, however if you are using Coder, then your approach is fine :slight_smile:

Yup, I used Coder (I try to get used to Python as much as I can),
And also thanks for the “log file” part of your advice, I would have totally ignored this otherwise (as I would have never opened the log file): now this study is going to be totally anonymous thanks to your advices! :slight_smile:
Thanks again,

Best,
Jean