I’m trying to create a self-paced reading experiment through PsychoPy and Im using builder. Im new to Psychopy. If anyone could help me I would be very grateful.
My OS is Win11
Psychopy version 2024 2.4
The task will not run online.
I have routines called exp_sss, exp_ss1, exp_ss2, exp_ss3, exp_ss4, exp_ss5, exp_ss6, exp_ss7, exp_ss8, exp_ss9, exp_ss10, exp_qt, inside of a loop called Block 1. I will have the total of 16 blocks in this experiment.
The loop is connected to an excel file with word in each column labelled sss, ss1, ss2, ss3, ss4, ss5, ss6, ss7, ss8, ss9, ss10, ssqt.
In routine exp_sss there is a text component called expsss and its text field contains $sss. The column sss in excel is the fixation cross + and its duration is 2.0. From the routine exp_ss1 to the routine exp_ss10 the components are called expss(number) and its text field contains $name of the column. The routine exp_qt are the questions that are in the ssqt column.
The psychopy shows me the words in the center of the screen and I would like to change them for the moving window self-paced reading. I will have a column for each word and then for each word’s RT.
I found the codes below in the post https://groups.google.com/forum/#!topic/psychopy-users/sjX7_Oa_WXc
Does anyone knows how I could adapt the codes for my experiment?
begin routine
sentenceList = sentence.split()
this breaks your sentence’s single string of characters into a list of individual
words, e.g. ‘The quick brown fox.’ becomes [‘The’, ‘quick’, ‘brown’, ‘fox.’]
keep track of which word we are up to:
wordNumber = -1 # -1 as we haven’t started yet
now define a function which we can use here and later on to replace letters with ‘x’:
def replaceWithX(textList, currentWordNumber):
xSentence = ‘’
for index, word in enumerate(textList): # cycle through the words and their index numbers
if index != currentWordNumber:
xSentence = xSentence + ‘x’ * len(word) + ’ ’ # add a string of x characters
else:
xSentence = xSentence + word # except for the current word
return xSentence # yields the manipulated sentence
Every frame
keypresses = event.getKeys() # returns a list of keypresses
if len(keypresses) > 0: # at least one key was pushed
if ‘space’ in keypresses:
thisResponseTime = t # the current time in the trial
wordNumber = wordNumber + 1
if wordNumber < len(sentenceList):
f wordNumber == 0: # need to initialise a variable:
timeOfLastResponse = 0
save the inter response interval for this keypress,
in variables called IRI_0, IRI_1, etc:
thisExp.addData(‘IRI_’ + str(wordNumber), thisResponseTime - timeOfLastResponse)
timeOfLastResponse = thisResponseTime
update the text by masking all but the current word
yourTextComponentName.text = replaceWithX(sentenceList, wordNumber)
else:
continueRoutine = False # time to go on to the next trial
elif ‘esc’ in keypresses:
core.quit()
