Hi, I am trying to create a visual search experiment which is basically searching for a target in a 4x4 array. Now, I want to repeat error trials upto a limited no of times, for example if there are 5 reps of each condition, then there should be upto a maximum of 7 reps per condition. I have 240 unique conditions and for each condition I need 5 reps minimum and my condition file already contains those 5 repititions for each unique condition, so the conditions file has 240x5=1200 rows(I did this to reduce coding since there were certain specifications about the target position in each trial, since I wanted to avoid too much coding). Now the logic I am trying to use for the repitition is that I am creating a variable that will contain all the conditions extracted from the excel file and then when the trials actually begin I can put for eg, $conditionData in the conditions field of the loop(conditionData is the variable or dictionary I am creating to store the trial conditions). Now depending on incorrect reponses I will add few line of code to update this variable by adding the trial conditions where participants gave a wrong response, to the end of the variable. To check whether this approach works at all i created the variable and gave a print command to check whether the variable is successfully getting created. The variable or dictionary is being created successfully. But psychopy is unable to recognise the conditions from $conditiondata. It is throwing this error: trialList=data.importConditions(trialConditions),
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\utils.py”, line 358, in importConditions
if not os.path.isfile(fileName):
File “C:\Program Files\PsychoPy\lib\genericpath.py”, line 30, in isfile
st = os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not list…
Please suggest what to do. I am very new to Python and coding in general.
Just to clear up confusion, the actual variable name in my code is ‘trialConditions’ and the error is coming up for the line : trialList=data.importConditions(trialConditions), and this line is automatically being written by psychopy. I am just putting $trialCondition in the conditions field of the loop
Hello @Tahiti
How do you set the value the of trialConditions
? Please show use the relevant line of code.
Best wishes Jens
Hello @Tahiti
I do not understand what you are doing. You specify a condition file in your loop definition, then you use it to set up a trialConditions list which you seem to fill with information from the condition file. This is then stored in the result file.
There is actually no need to define trialConditions in a code component if you read the condition file in a loop, as you do. PsychopPy reads the condition file. So all columns in exp1.xlsx are accessible to you by referring to the column name, e.g. target_ImgNo, and are stored in the result file.
Best wishes Jens
I understand what you are saying . I already have the conditions data in a .xlsx file which I can directly put in the conditions field of the loop. I do not need to create trialConditions. But I also need the error trials to repeat. In the next block where my trials will run I want to dynamically add the error trials at the end of the trialConditions so that the error trials also run after the already defined trials are done. That was the logic I was using. I am really stuck with this one. Other than the extra code I need to write for the repitition of error trials, the experiment that I have set up in the builder mode is running fine. If You have any other logic for repitition of error trials please let me know. Thank you!
Have a loop at my Repeat Subset online demo.