OS (e.g. Win10): Windows 10
PsychoPy version: 1.90.1
What are you trying to achieve?: I’m trying to create a memory experiment in which participants in the first phase have to study word pairs, then in the second phase they are given the first word pair (cue) and asked to type the other pair (target), later in the third phase, they are given again the cue word and asked to type the target word. So what I am trying to achieve is to compare the typed response for the target in the second phase, and the typed response for the target in the third phase, so I can see in the output data if there are perseverative errors (errors in the first test that are repeated in the final test).
What did you try to make it work?:
I’ve tried adding a code component in the third phase routine like this:
inputText_test2 = "" correct_test2 = "" err_pers = ""
theseKeys="" shift_flag = False phase3_input.alignHoriz ='left'
#code for response text input n= len(theseKeys) i = 0 while i < n: if theseKeys[i] == 'space': # pressing SPACE means time to stop continueRoutine = False break elif theseKeys[i] == 'backspace': inputText_test2 = inputText_test2[:-1] # lose the final character i = i + 1 elif theseKeys[i] in ['lshift', 'rshift']: shift_flag = True i = i + 1 else: if len(theseKeys[i]) == 1: # we only have 1 char so should be a normal key, # otherwise it might be 'ctrl' or similar so ignore it if shift_flag: inputText_test2 += chr( ord(theseKeys[i]) - ord(' ')) shift_flag = False else: inputText_test2 += theseKeys[i] i = i + 1 #check if the response in final test is correct if inputText_test2 == Target: correct_test2 = "1" else : correct_test2 = "0" #check if the error made in the final test is the same as the first test while correct_test2 = "0": if inputText_test1 == inputText_test2: err_pers = "1" else: err_pers = "0"
# store the response input for final test thisExp.addData('inputText_test2', inputText_test2) inputText_test2="" #store the counting of correct responses thisExp.addData('correct_test2', correct_test2) correct_test2="" # store perseverative errors thisExp.addData('err_pers', err_pers) err_pers=""
What specifically went wrong when you tried that?:
It doesn’t make the comparison correctly, in the output data for the perseverative errors row (err_pers) it always appears “0” no matter what.
I’m new to Psychopy and I’m still learning Python, so I’m sure there is plenty of mistakes im making.
I would really really appreciate your help, I’ve searched everywhere but I haven’t found any solutions. I’m adding an example of the data output so you can see how it appears now, and also a screenshot of the flow, please let me know if there is something I can do. I’m desperate and have no one I can ask to.
Thanks a lot!
Yeray.111_EXP3_2019_Mar_25_1756.csv (4.4 KB)