psychopy.org | Reference | Downloads | Github

Linking the randomization of two loops together

Hi,
I have an experiment I am writing in builder. I have one outer loop that wraps round the whole experiment, working through a spreadsheet, picking the conditions out in random order. The conditions in this excel sheet then re-direct to other spreadsheets (eg. animation1.csv) that contain all the details for a short screen animation to run ( this runs in a nested loop). It then moves out of the first nested loop into a new routine collecting participant responses (still inside the main outer loop). I want to ask participants different questions, depending on what animation clip they have seen.

Can anyone help with an idea for a way to get the participant response loop to pick up on the animation condition that has been randomly selected in the outer loop, so that it asks the appropriate question?

I tried putting a new column in the spreadsheet that lists all the conditions called ‘prompt’ and then writing questions in there, then putting $prompt in the text section of the participant response routine, but it did not work.

Thanks for your help,
Christina

I couldn’t really work out from your text what you’d achieved but it sounds like you need a flow like this:

Trials chooses the animation file and the corresponding conditions file for the questions, then the questionsLoop uses that (variable) conditions file to present questions

Thanks for your advice Jon. However, when I went to have a go at trying this, my experiment flow has disappeared from the builder. It is giving me this message so send to the user list:

Failed to load D:\Triangle Task\Pilot triangle animation\animationpilot.psyexp.
Please send the following to the PsychoPy user list
Traceback (most recent call last):
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.
7.egg\psychopy\app\builder\builder.py", line 4266, in fileOpen
    self.exp.loadFromXML(filename)
  File "C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy-1.83.04-py2.
7.egg\psychopy\app\builder\experiment.py", line 471, in loadFromXML
    exec('param.val=%s' %(param.val))#e.g. param.val=[{'ori':0},{'ori':3}]
  File "<string>", line 1, in <module>
NameError: name 'nan' is not defined

Most odd, I have been saving and re-opening for months with no problems until now. Any idea what has happened to my experiment?

Thanks for your help,
Christina

A similar, but slightly different, error message was tracked down and fixed during the summer, so it might be that upgrading to version 1.84.1 will fix the problem. Otherwise, could you upload your .psyexp file here for us to take a look? Thanks

Hi , I tried upgrading, but it did not fix the disappearance of my flow. Anyhow, I have re-installed the older version I was working in, re-drawn the flow, and I have been able to save and re-open successfully a few times this morning. I will just put it down to a random hiccup.

The good news is I have had success linking the randomization of my two loops together using your hints above… many thanks! Problem solved.