Moving window self-paced reading

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()

Hello @kafo

take a look here PsychoPy Online Demos

Best wishes Jens

Thank you @JensBoelte for the advice. I looked at them and they dont seem to be designed in excel the way I did. Also, I would like a moving window and the demo doesnt have. I wrote a word for each column in excel. I will print a screenshot if u can help me, that would be great.

Hello @kafo

You only have to die once. :grin: In Excel, you can combine the contents of two or more cells into one using the ampersand symbol (e.g. =A1&" "&A2, etc.) or the CONCAT function.

Look here vespr / Self Paced Reading · GitLab or here OSF | Self Paced Reading for various implementations of a self-paced reading task.

Best wishes Jens

1 Like