How to store answers and use them to randomize participants into different groups?

OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): v2022.2.2
Standard Standalone? (y/n) : Standalone
What are you trying to achieve?:
Hello everyone, thank you for reading :slight_smile:

I have an experiment where I first ask some demographic questions followed by two personality questionnaires in separate routines.
I want to randomize my participants based off the scores in the two questionnaires (the first is a “brain type calculator”, the EQSQ, the second is a variant of the Big 5, the IPIP-50).
The first problem I ran into is the format in which the answers are stored.

At the moment, the answers are stored like this (in the txt file, the csv is complete jibberish to me) :

	Mouse: Left button down, pos=(849,519)
36.2211 	DATA 	Mouse:  Left button up, pos=(849,519)
36.5568 	DATA 	Mouse: Left button down, pos=(816,527)
36.6374 	DATA 	Mouse:  Left button up, pos=(816,527)
36.9689 	DATA 	Mouse: Left button down, pos=(816,527)
37.2816 	DATA 	Mouse:  Left button up, pos=(702,523)
38.2747 	DATA 	Mouse: Left button down, pos=(474,851)
38.6183 	DATA 	Mouse:  Left button up, pos=(392,845)
38.9516 	DATA 	Mouse: Left button down, pos=(424,850)

But I need the numeric values of the slider answer, which are ticks from 1 to 5, so the number on which the participant clicked, so to speak.
My forms look like this:

I just need to add the scores of the given answers to randomize into different groups.
Is it possible to write them in an excel mask? I created one on a separate sheet in the form I’m using to store the questions etc, is it possible to store given answers there instead of in a new file?
Since it is no reaction time experiment, many of the stored arguments in the automatically saved file are not useful to me.
If so, how would I do that (I guess I’ll need some custom code for that) ?
I guess it has t go somewhere here, but I have no clue how to do that, unfortunately.

for thisComponent in eqsqComponents:
    if hasattr(thisComponent, "setAutoDraw"):
        thisComponent.setAutoDraw(False)
form_eqsq.addDataToExp(thisExp, 'rows')
form_eqsq.autodraw = False
thisExp.addData('button_eqsq.started', button_eqsq.tStartRefresh)
thisExp.addData('button_eqsq.stopped', button_eqsq.tStopRefresh)
thisExp.addData('button_eqsq.numClicks', button_eqsq.numClicks)
if button_eqsq.numClicks:
   thisExp.addData('button_eqsq.timesOn', button_eqsq.timesOn)
   thisExp.addData('button_eqsq.timesOff', button_eqsq.timesOff)
else:
   thisExp.addData('button_eqsq.timesOn', "")
   thisExp.addData('button_eqsq.timesOff', "")
# the Routine "eqsq" was not non-slip safe, so reset the non-slip timer
routineTimer.reset()'''



Have you any tips on how to go about this?
I’m fairly new to PsychoPy and currently work on my diplom-thesis. Any tips are very appreciated. Thank you so much in advance.

Kind regards from Germany :slight_smile:

Are you looking at the log file instead of the trial by trial CSV?

Will you want to run this online?

I need to run it on Pavlovia later on, but I thought I’d build it completely first, so I don’t need to bug fix offline and online all at once…

I found the issue with logging now, my ecxel does not show the table correctly, but in gitHub, it’s working fine. :pensive::sweat: My bad.

How can I tell Psychopy to sum up the values from the slider answers?
It is saved in the form_eqsq.response column, but how do I put that into code?
(maybe that is a dumb question. Its the first big project I work on and I’m not really proficient in programming).

Would it help if I show you the current code?

Thank you for your answer :blush:

The reason I asked about online is because Forms still aren’t great online (unless they’ve improved dramatically in 2022), so I use embedded html (see my demographics online demo), a prequest in my VESPR Study Portal or Qualtrics for questionnaires.

While I usually do try to get an experiment working offline first, before debugging online, I do this with forethought about what techniques are likely to work best later.

https://psychopy.org/online/status.html

1 Like