Self-paced reading task// A bug in the flow

Dear wakecarter
Thanks a million :heart_eyes: yeah, it’s finally working!!
There’s only one point: I need the sentence to be displayed in a noncumulative fashion. In the way you designed the experiment, the sentences are presented cumulatively. Is there a way to change that too?

text.text=words[wordNum]

You don’t need to use the variable phrase

Finally working!! Aww I can’t thank you enough. you are lifesaver. thank you thank you :shamrock:

The easiest option would be to add a column in your sentence spreadsheet containing the name of the CSV file containing the items and answer options for a form component.

The form component isn’t great online but choice item types do work.

Thank you. I’ll see where it goes.

I’ve just updated my demos with a self-based reading task using your sentences, so I’d recommend that you start again by forking it.

Self-Paced Reading code | try it | discussion thread

Based on code from my code snippets Google page and using sentences from @Zeinab_Alipour, this demo includes reading times for each word and an editable text box comprehension question.

Dear @wakecarter,
it looks great!! thank you :herb:

But I don’t want to fork it, because there are things I’d like to change. Like its randomness, i want it to read sentences in a sequential manner. Or i wish the fixation cross stay there for 0.5 second, and finally I want it to end; so I need to set time for that too.

And I checked your github profile and downloaded the builder view of this experiment and all that jazz, but I can’t push it to Pavlovia, as while doing so, I receive an error-like message. (Also, I want to build the exact same experiment with a different excel file, for counterbalancing purposes.)

I think I should rewrite everything and then push that experiment to Pavlovia. what’s your take on this?

Bests,
Zeinab

You should fork it, check it works and then change it.

I added a key press to the fixation because it felt wrong with .5 seconds to me.

If you want to counterbalance sentences you should do it within a single experiment, not create a duplicate.

Very well. Thank you @wakecarter, I forked the experiment and mind you, I have a couple of questions to ask:

  1. So should i clone it to be able to edit it? And should I do that in github?

Why?
3)

How? In that website of yours?
I pseudorandomized the items for each set and they are different. So can I do this there? And I went them to be sequentially presented because no two target items should follow each other you know.

  1. I haven’t tied cloning. I expect you can fork, clone or simply download.
  2. I kept feeling surprised by the sentences. Maybe 1 second of blank before the .5s fixation would work.
  3. You can make the loop sequential. If the only difference between versions is the Excel file that can be done in code at the start of the experiment based on the value of paricipant or group send m=by one of my apps.

Morning :herb:
3. Ok, I’m sorry I didn’t get it. Mind you, i just upload the files so that you can see whether a code can be a panacea for this or not.
Demo3,a.xlsx (12.6 KB)
Demo3,b.xlsx (11.3 KB)
2. hmm… interesting. Well you won’t if the order were sequential. The first three items served as warm-ups so they knew exactly what to expect after each question. But thank you for bringing that up.

  1. Just the last question, I’ll figure this forking thing out, but how do I make changes when I’ve already uploaded the file or forked the project to my Pavlovia account? Where can i edit it? in gitlab?

Regards,
Zeinab

I’ve made the changes you wanted to my demo

It now selects the excel based on the group (though this could be deleted from expInfo if you want to use participant – I’ve coded it for both). The two Excel files are now Demo3_1.xlsx and Demo3_2.xlsx

I’ve made a short (.5s) blank in between sentences and made the sentences appear sequentially.

Here are notes on how to find the experiment via the Builder Searching for experiments on Pavlovia — PsychoPy v2021.1

1 Like

Awww. thank you @wakecarter, genuinely thank you.

Just two last questions (hopefully),

  1. To find the experiment via the Builder, I followed the instructions in Searching for experiments on Pavlovia — PsychoPy v2021.1. But I couldn’t sync it for

    this reason. Everything looks perfect, I just want to set a time, like 2 sec, for the Fin slide to be actually finished.
  2. While i was surfing the literature, i found that some scholars used the moving window display to display their sentences word-by-word. It would be sth like this and it was feasible via E-prime:
    the first segment appeared at the left edge in the vertical middle of the screen. At the next push of the key, the first segment disappeared and the second segment appeared to the right of the now-gone segment. All sentences fit on one line.

Is it possible to do that in psychopy as well? Because when the sentences are presented from left to right, perhaps it becomes more like what happens in the real world while reading.

Best,
Zeinab

  1. The last line of the error message (which I can’t see) tends to be the most informative.

  2. That’s doable though tricky to get perfect because of kerning (letters don’t all take up the same horizontal space).

If you buy a “Fix that Bug” from me via my buymeacoffee page then I’d be happy to give it a go.

Hi there,

I have recently forked this self-paced reading demo and starting adapting it for my experiment. This has been insanely helpful given that I do not have a lot of programming experience.
Crucially I am only interested in the ‘moving window’ version.

I was wondering if you could help me with increasing the space between the lines of text.

How it currently stands (see screenshot) it seems like a 1.0 spacing but I was wondering if I could increase it to 1.5 for example.

I am not exactly sure where in the code I could change this.

Any suggestions would be greatly appreciated.

I’ve just updated the code to add a variable called lineSpacing.

It then needs to be used to multiply the y coordinate once in Begin Routine and twice in Each Frame, e.g.

mask[Idx].pos=[-.5,lineSpacing*(fontSize*Math.floor(lines/2)-fontSize*Idx)]

I’ve also updated it to 2021.2.3 at the same time (which required downloadResources to be replaced with psychoJS._serverManager.prepareResources).

Thank you so much for your quick response.

However, because I am only using the ‘moving window’ condition, I do not actually do anything with separate lines. I just present the text as a single unit.

So in the begin routine tab I have:

words=Sentence.split(' ')
nWords=len(words)

wordNum=-1
oldWordNum=-2
event.clearEvents()
myClock.reset()
dashPhrase=[]
dashWord=''
character=''

And in the each frame tab I have:

if wordNum>oldWordNum:
    if expInfo['type']=='moving window':
        reading_text.text=''
        for Idx in range(nWords):
            if Idx == wordNum:
                reading_text.text += words[wordNum] + ' '
            else:
                reading_text.text += dashPhrase[Idx] + ' '
    oldWordNum=wordNum
    myClock.reset()

I’m I right to assume that the only way I could change the spacing between the lines is to actually separate the text out into separate lines?

You could try using the textbox component instead, which has linespacing as a formatting option. If you don’t tick “editable” I think it should behave in the same way.

Great suggestion. I will try that first. Thanks!

Hi,

I hope it is okay that I comment on this topic.

@wakecarter I have forked your experiment to adapt for my own SPR experiment. Before making any changes to the code, I tried running the experiment to check whether it works just like your online version. Unfortunately, I cannot get beyond the fixation cross because the experiments suddenly ends. In the runner it says:

Traceback (most recent call last):
File “C:\Users\KK\Documents\SPR\self-paced-reading_lastrun.py”, line 388, in
lines=math.ceil(len(Sentence)fontSize.33)
NameError: name ‘math’ is not defined

I tried to figure it out myself, but am I am quite new to programming. I am using version 2022.1.2 but I changed the settings to run the experiment on version 2021.2.3.

Also, when adapting the code for my procedure, can I simply delete the code of the SPR variants I do not need? I am afraid I might destroy everything…