psychopy.org | Reference | Downloads | Github

Provide feedback (mean RT and number of stops) after a block in a SST task


#1

Hi all,
I am trying to provide feedback after a completion of a block in a stop signal task.
I followed John’s example, [https://13321448614192655815.googlegroups.com/attach/bb1b039223f1acfa/blockFeedback.psyexp?part=0.1&vt=ANaJVrFVMdAhjuanbJBvGLFn45FLlt3dGvl2IiDZ9H_Zm33fCXJ8YXchne6QcPpaqJS5s3PT5GODvXXAxRvXsINlrTV0-v1ZyDow6LCXxT0q2ItjLjbUD_g].
But it seems that the sample code only works if there is only one routine.
Here is my code in the begin routine properties.

nCorr = StopRoutine.data['StopResp.corr']
meanRt = GoRoutine.data['GoResp.rt']
msg = "number of successful stop = %\nRT = %.3f in this block"%(nCorr.sum(),meanRT.mean())

Note that I have

msg=' ' 

in the begin experiment properties and a text routine displaying $msg below the code component.

When I run, I get

meanRT = GoRoutine.Data['GoResp.rt']
KeyError: 'GoResp.rt'

FYI, I also tried with

nCorr = StopRoutine.data['StopResp.corr']
msg = "number of successful stop = %i" %(nCorr.sum())

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


#2

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?


#3

Hi Jon,
Thanks for your input.
Indeed GoResp.rt is created in the data files

.
Please note that this is a csv file.

is in the “end” routine which comes after all the routine (please see below)

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.

SimpleSSRT_FrameEEG.psyexp (38.1 KB)
RoutineCtrl.xlsx (8.5 KB)Go.xlsx (10.2 KB)
Stop.xlsx (8.4 KB)


#4

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:

GoRTs = []
GoCorrs = []

and then at the end of each trial do

GoRTs.append(GoResp.rt)
GoCorrs.append(GoResp.corr)

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.


Stop signal task creation
#5

Thanks a lot for your input.
It is working now.

For your information, below is the codes which requests the feedback using np as

nCorr = np.sum([StopCorrs])
meanRT = np.mean([GoRTs])
msg = "number of successful stop = %i\nRT = %.3f in this block" %(nCorr,meanRT)

Many thanks,
Hak


#6

Hi, is it possible for you to explain me how you did solve this problem, please?