simplifying the code just requesting number of successful stops, but this code appeared to only store the last stop success, i.e., displaying 1 if the last stop was successful and 0 for stop failure in the last trial.
I would appreciate if you could help me solving this issue.
Many thanks,
Hak
The first error suggests that data GoResp.rt is never created. Is it showing up in the data files? Maybe your code component is executing too early (ie. before a GoResp measure has been taken)?
I don’t know why the second issue is occuring. You could do print(nCorr) to see what’s in it?
If I request print (nCorr), I get [[1.0]]. I suppose it is saying that I have only 1 successful stop, which does not correspond to the data (csv) file.
Just in case, I have uploaded the relevant files for you to inspect.
Thank you again for your help.
OK, I’m betting that your experiment is set up so that GoRoutine and StopRoutine have nTrials of 0 or 1. The reason that your data has only one value is because you ask it to run only a single trial but then you do that multiple times. Asking for 10 trials is not the same as asking for 1 trial 10 times. Does that make sense?
I suggest in your code component you don’t bother trying to access the data as stored by PsychoPy, but keep a track of it yourself. Create a variable at the start of the experiment:
That way you understand better what values are stored and what format. Then you can use those in your other code
The other solution would be to get rid of your different routines for Go and NoGo trials and just have a single routine. Use the conditions file to change each trial to be Go or NoGo rather than a separate routine. Then you don’t need the nested loops and things should become easier to understand.