psychopy.org | Reference | Downloads | Github

Feedback Routine in 2back experiment

feedback

#1

Hi,
I’m using Psychopy 3.03 standalone on windows10.
I would like to write a feedback routine which tells the participant, whether they responded correctly in a 2back-experiment (different positions are shown sequentially and one should hit space if the position is the same as two pictures before).
Something like if space was hit and corr=1: "Correct!; if space was hit and corr=0: “incorrect”; if space wasn’t hit and corr=1: “should have hit space”; if space wasn’t hit and corr=0: nothing

Here my builder view and excel file:


excel

Help much appreciated!


#2

I already realized that I have to change my “corr” column in the excel file to empty instead of 0 und to ‘space’ instead of 1. Still I have problems programming the feedback routine.
Thanks for any help.


#3

Search this forum for “ n back task” and you’ll find a number of threads that should help.

eg


#4

Thank you @Michael,

I read the threads you mentioned. My main problem is the programming in python. I don’t have any experience with that. I tried something like this:
grafik

Thank you for any programming help!


#5

I’m left wondering why you didn’t try the code as suggested in the posted link (and related threads), instead of the code above (which simply won’t scale for anything other than a single trial).

If you look through that thread, you’ll see that someone even posted some example files to download and play with.


#6

Hello Michael,
as I understand the thread you mention is about coding what the correct response ist (y/n if a 2-back occured or not) and about feedback in a 1-back experiment.
I don’t need code for the correct responce as I have it in my trials file (sequential presentation). I just don’t know how to call on this information (variable corr is either ‘space’ or ’ ') and how to implement in the code component. I think the idea of what I want to do is clear and it’s simply a matter of transforming it into correct python code…


#7

OK, yes, that code is for the general case where stimuli are randomised and so the n-back values need to be calculated. If you have sequential conditions and your own “correct” variable, then your problem is indeed simpler.

Part of the reason why your code above is failing is that you are referring to the keyboard component itself (key_resp_4) and not one of its specific attributes (like key_resp_4.corr or key_resp_4.keys), etc. At the moment you’re kind of asking “is my keyboard the space bar?”

If you don’t have any luck, please provide a screenshot of your keyboard component settings, and the text of your code (i.e. it’s easier to suggest changes to code if you paste in the code itself, rather than a screenshot, which can’t be copied from), and please:


#8

Hello Michael,

I tried this code now and I get a syntax error.

if key_resp_4.keys == '' and corr == 'space'
    msg = 'Das wäre ein Treffer gewesen!'
if key_resp_4.keys == 'space' and corr == 'space'
    msg = 'Richtig! Die vorletzte Position war gleich.'
if key_resp_4.keys == 'space' and corr == ''
    msg = 'Leider falsch. Die Position ist nicht gleich wie die vorletzte.'
else msg = ''

trials_probe.xlsx (8.8 KB)


#9

Please always include the full text of the error message, but in this case I think the issue is likely that you have simply forgotten the : at the end of each if and else condition.


#10

Hi,
I’m getting a feedback now (although not specific enough), but it’s always delayed by one trial i.e. if I make a mistake it gets reported one trial later, at the wrong time. That doesn’t make sense to me as I collect the information at the beginning of the feedback routine…AG-Test.psyexp (73.1 KB)
trials_34.xlsx (10.5 KB)
trials_probe.xlsx (8.8 KB)
Can you work with this or do you need the images?
Thanks again for your help!