Self paced reading task

Online? not yet. I entered the code right after the time that you mentioned:
if ‘space’ in keys:
wordNum+=1
thisExp.addData(‘Word’+str(wordNum),t)
Exp.nextEntry()
if wordNum==nWords:
continueRoutine=False

and this is the error I receive:
NameError: name ‘Exp’ is not defined

Wow! thank you for sharing

But man, this is so detailed. should i use the free-recall section codes?

thisExp.nextEntry()

Not Exp.nextEntry()

Search for Free Recall on Pavlovia for the most recent version (with more comments) but it probably has too much code for you since it allows up to 20 words in two columns in a single page

Oops, working now. But still it shows the RT in a cumulative manner; the only difference is that now it’s staircase-wise.


Thank you but except your experiment, I couldn’t find another free recall task except for a weird smiley face experiment. I will watch some tutorials on YT and hopefully, I can build one editable textbox. Let’s see where it goes

The reason for the staircase is because the column names are all different. You want them to all me the same, not Word 1,2,3,etc.

For the difference you need to either reset the clock or calculate the difference between the current time and the previous one.

dear @wakecarter,
I searched for it
https://www.psychopy.org/api/core.html
but I’m wondering which code to insert…

To create a clock you need

myClock=core.Clock() for Python and myClock=new util.Clock() for JS. Use a Both code component.

To reset your clock use myClock.reset()

To read your clock use myClock.getTime()

Both of these are fine in auto code components

Thanks for bearing with me
I did insert the codes in each routine, but still no difference in the data file. Staircase-wise and cumulative. Same old same old. Thank you anyway :shamrock:

Have you changed the above to thisExp.addData(‘Word’,myClock.getTime()) followed by myClock.reset() ?

If you have then what are you doing to refresh the cache? Sorry, ignore that bit since you’re running it locally. Changes you make should definitely be used so if they aren’t then I have to wonder how you are running the experiment.

if ‘space’ in keys:
wordNum+=1
‘Word’,myClock.getTime()
thisExp.nextEntry()
if wordNum==nWords:
continueRoutine=False

Like this?

Cuz when I insert the whole line it gives a syntax error

I’m in a trial and error phase right now. I’m building the whole thing in PsychoPy, checking, re-checking the data to see how it works
Then, I’m going to push it to Pavlovia by pressing a button. I assume this is how works

Unless, you are an expert in coding and you can figure out what’s wrong by checking the Console and stuff like that. right?

You need the whole line with the reset on the following line if you don’t want cumulative time.

Delete the smart quotes and replace them with dumb quotes.

Hi again
The syntax error is solved. Now it’s asking me to define the clock. I have written every code related to clock under

Currently, Each Frame of mine is like this:
if ‘space’ in keys:
wordNum+=1
thisExp.addData(“Word”,myClock.getTime())
myClock=core.Clock()
myClock.reset()
thisExp.nextEntry()
if wordNum==nWords:
continueRoutine=False

This goes in Begin Experiment.

Read your code from top to bottom. You are currently defining the clock AFTER you first save its value

Yeaaah, you are right. It didn’t make sense


It’s working perfectly now! Just wanted to thank you. You re a saint to answer all these questions :tulip:

1 Like

Finally, add another reset in Begin Routine to correct the RT for your first word.

Wow, thx for looking at it with such critical eye!


It’s perfect now. Thank you, I’m learning a lot :shamrock:

1 Like

Dear @wakecarter,
i know it’s been long, but the question I have is with regard to this discussion, hence, I posed it here. Remember how I wanted the output of the excel to look like this?(previous chat) Well, it appears the very first format works better for data analysis. So i went through the previous codes and I could pull it off and come up with this


But again the RT for each word is recorded in a cumulative way. And look at my code, i did insert the reset code; Idk why this happened:
Begin Experiment:

myClock=core.Clock()

Begin Routine:

words=Sentence.split(' ')
nWords=len(words)
wordNum=0
oldWordNum=-1
phrase=' '
event.clearEvents()
myClock.reset()
win.color = "white"
win.flip()

Each frame:

if wordNum>oldWordNum:
    phrase+=words[wordNum]+' '
    text.text=words[wordNum]
    oldWordNum=wordNum

keys=event.getKeys()
if 'space' in keys:  
    wordNum+=1
    thisExp.addData("Word",myClock.getTime())
    myClock.reset()
    thisExp.nextEntry()
    if wordNum==nWords:
        continueRoutine=False

What i want is a noncumulative RT for each word. I’d appreciate any helpful comment of yours.

Regards

The code you’ve given can’t produce the output you’ve posted. You need the following:

Begin Experiment:

myClock=core.Clock()
# myClock=new util.Clock() on JS side of Both component if you want it to work online

Begin Routine:

words=Sentence.split(' ')
nWords=len(words)
wordNum=0
oldWordNum=-1
phrase=' '
event.clearEvents()
myClock.reset()
win.color = "white" # Does this work online?
# Don't use win.flip() in Builder

Each frame:

if wordNum>oldWordNum:
    phrase+=words[wordNum]+' '
    text.text=words[wordNum]
    oldWordNum=wordNum

keys=event.getKeys()
if 'space' in keys:  
    wordNum+=1
# Add wordNum to the following line as shown to give each column a unique name.
    thisExp.addData("Word"+str(wordNum),myClock.getTime())
    myClock.reset()
# Don't use thisExp.nextEntry() if you want data on the same line
    if wordNum==nWords:
        continueRoutine=False
1 Like

Thank you @wakecarter,
works perfectly now. But just a quick Q:

thank you kindly for the online tips and tricks. But when I run it with this code of clock it collapses, and the error says: you need to define your clock.
I rummaged PsychoJS but couldn’t find anything. I thought we need to define clocks in begin experiment so I’m totally clueless in this. Any ideas?

Please show your Both code component.