In psychopy I am using the addData function to score an item either a 1 or 2 depending on what condition the item was assigned into before the experiment. The first item is always scored wrong, however the next 39 items are all scored correctly. Strangely, the first item is always in the same condition as the final item, but the first is not scored correctly. I am wondering if anyone knows what is going wrong and if they know how to fix this. Thank you.
Hello @PaulD
You need to show us how and when you implemented this in your experiment flow.
Best wishes Jens
In psychopy I am using the addData function to score an item either a 1 or 2 depending on what condition the item was assigned into before the experiment. The first item is always scored wrong, however the next 39 items are all scored correctly. Strangely, the first item is always in the same condition as the final item, but the first is not scored correctly. I am wondering if anyone knows what is going wrong and if they know how to fix this. Thank you.
In the end routine tab this is the code I have to score the items:
if curr in PretestOverlap:
study_score = 1
thisExp.addData(‘StudyType’, study_score)
pairscore = 1
thisExp.addData(‘PairType’, pairscore)
elif curr in PretestUnique:
study_score = 1
thisExp.addData(‘StudyType’, study_score)
pairscore = 2
thisExp.addData(‘PairType’, pairscore)
elif curr in ReadOverlap:
study_score = 2
thisExp.addData(‘StudyType’, study_score)
pairscore = 1
thisExp.addData(‘PairType’, pairscore)
elif curr in ReadUnique:
study_score = 2
thisExp.addData(‘StudyType’, study_score)
pairscore = 2
thisExp.addData(‘PairType’, pairscore)
There’s definitely no need to repeat your two addData lines, since you could just have them at the end to save whatever values you have set for study_score and pairscore.
Try print statements to show curr 9and possibly PretestOverlap, etc) in the console to investigate.
Hello @PaulD
here is a shorter version of your if-else-construction
if curr in PretestOverlap or curr in PretestUnique:
study_score = 1
elif curr in ReadOverlap or curr in ReadUnique:
study_score = 2
if curr in PretestOverlap or curr in ReadOverlap:
pairscore = 1
elif curr in PretestUnique or curr in ReadUnique:
pairscore = 2
thisExp.addData('StudyType', study_score)
thisExp.addData('PairType', pairscore)
or even shorter
study_score = 1 if curr in (PretestOverlap | PretestUnique) else 2
pairscore = 1 if curr in (PretestOverlap | ReadOverlap) else 2
thisExp.addData('StudyType', study_score)
thisExp.addData('PairType', pairscore)
When do you set the value of curr? Do you initialise the PretestOverlap, PretestUnique, ReadOverlapperhaps with a value? As @wakecarter suggested, print-statements will help to solve this.
Best wishes Jens
Thank you for the reply. I believe that curr is initialized in the begin experiment tab. I will go forward with print statements to hopefully find where the problem is arising. I appreciate the help!