Using dashes (self-paced reading)

Hi everyone
I hope you are having a great day.

In the video provided below, you’ll notice that each regions disappears when participants advance to the next region. However, I’m wondering if I can use a series of dashes corresponding to where the characters of the sentence appears.

What are you trying to achieve?:
To read the content of each region, participants will have to press the space bar. Upon pressing the space bar again, the region they’ve read will be replaced with dashes, and a new region will appear.

I would be really grateful if you could help me to run my experiment like the following video:

Many thanks for your help,

Mohammad Hesam

Have a look at my self paced reading online demo. The version you are showing is uninformative mask.

1 Like

thank you thank you

can I use the demo to run my experiment in this way?

if I download the demo, I may have access to the codes used by Ms. Alipour. Am I right?

You will need to fork it and edit it but yes then you can use it.

https://psychopy.org/online/sharingExperiments.html

1 Like

thank you for your response

Dear @wakecarter
Hi. I hope you are fine.

Please accept my sincere apologies for asking too many questions.

I recently downloaded the demo self-paced reading file that you have shared on your profile. My intention was to use the codes in that experiment to create an uninformative mask.

I am aware that the fork option is available, but if possible, I would greatly appreciate your help in creating dashes for my own experiment.

I have very useful codes in my own experiment, and I’m concerned about losing them if I were to fork Ms. Alipour’s experiment.

Thanks,
Mohammad Hesam
Experiment.psyexp (56.5 KB)

Hi,

I would recommend that you fork the demo experiment and then look at the code to work out which bits make the uninformative mask. Then add that code to your experiment.

If you need someone to do this for you then you could ask the Open Science Tools science team via consultancy. Consultancy services — PsychoPy v2023.2.3

Best wishes,

Wakefield

1 Like

thank you for your help.

I downloaded the demo self-paced reading task.

I noticed there are 2 codes in the reading routine for the uninformative mask.
The image below is one code:

The other code is as follows:

When I used the same code in the reading routine of my own experiment, this error appeared (NameError: name ‘maxLines’ is not defined).

How can I define ‘maxLines’?
You can see the flow of my own experiment as follows:

Thanks,
Mohammad Hesam

code_group contains the code maxLines = 5 in Begin Experiment

1 Like

Thank you

I found the code_group in the start routine of the demo experiment.

in which routine do you think I should enter the code-group?

By the way, does the order of codes matter when I want to enter the code group?

I don’t think you need the rest of code_group since it’s about the selection of the excel file.

1 Like

aha!
thank you very much

I added the group code (maxLines = 5) in the Reading routine:

When I run the experiment, the following error appears:

Generating PsychoPy script…

############ Running: C:\Users\hesam\Desktop\Experiment_lastrun.py #############
275.3182 EXP Imported List D.csv as conditions, 65 conditions, 4 params
275.3195 INFO Loaded monitor calibration from [‘2023_08_14 18:25’]
275.3522 EXP Imported List D.csv as conditions, 65 conditions, 4 params
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. Contribute - pygame wiki
4.9875 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
Traceback (most recent call last):
0.9075 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\hesam\Desktop\Experiment_lastrun.py”, line 141, in
lineColor=grey,
NameError: name ‘grey’ is not defined
################ Experiment ended with exit code 1 [pid:10588] #################
287.9132 EXP Imported List D.csv as conditions, 65 conditions, 4 params
287.9149 INFO Loaded monitor calibration from [‘2023_08_14 18:25’]
Generating PsychoPy script…

############ Running: C:\Users\hesam\Desktop\Experiment_lastrun.py #############
491.9695 EXP Imported List D.csv as conditions, 65 conditions, 4 params
491.9739 INFO Loaded monitor calibration from [‘2023_08_14 18:25’]
491.9951 EXP Imported List D.csv as conditions, 65 conditions, 4 params
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Traceback (most recent call last):
Hello from the pygame community. Contribute - pygame wiki
5.3157 WARNING User requested fullscreen with size [1024 768], but screen is actually [1920, 1080]. Using actual size
0.9044 WARNING Monitor specification not found. Creating a temporary one…
File “C:\Users\hesam\Desktop\Experiment_lastrun.py”, line 141, in
lineColor=grey,
NameError: name ‘grey’ is not defined
################ Experiment ended with exit code 1 [pid:11796] #################
503.5508 EXP Imported List D.csv as conditions, 65 conditions, 4 params
503.5541 INFO Loaded monitor calibration from [‘2023_08_14 18:25’]

I’d appreciate it if you could tell me about the next step.

Copy code_Clock into Welcome and then simplify it. The code in Begin Routine is for left justification.

1 Like

I added and simplified the code_Clock in the Welcome routine:

I can run the experiment flawlessly. But the problem is that the version of presentation is centered and not uninformative mask.
Experiment.psyexp (63.2 KB)

The key code for uninformation mask is in reading_code

Begin Routine

for Idx in range(lines):
        mask[Idx].vertices=[[0,-fontSize/10],[lineLength[Idx]*fontSize*.33,-fontSize/10]]
        mask[Idx].pos=[-.5,lineSpacing*(fontSize*Math.floor(lines/2)-fontSize*Idx)]
        mask[Idx].setAutoDraw(True)

Each Frame

        wordLength=(len(words[wordNum])+2)
        reading_bg.size=[wordLength*fontSize*5,fontSize*8]
        reading_bg.pos=[-.5+(len(phrase)+wordLength/2)*fontSize*.33,lineSpacing*(fontSize*Math.floor(lines/2)-fontSize*thisLine)]
        reading_text.text=words[wordNum]
        reading_text.pos=[-.5+len(phrase)*fontSize*.33,lineSpacing*(fontSize*Math.floor(lines/2)-fontSize*thisLine)]
        phrase+=words[wordNum]+' '
        if wordNum > nWords-2:
            pass
        elif len(phrase) + len(words[wordNum+1]) > lineLength[thisLine]:
            phrase = ''
            thisLine += 1

Thank you thank you.

I added the code for Each Frame, but this error appeared

That’s because you have:

  1. Deleted generic code as well as the code specific to the methods you aren’t using

  2. Not respected tabs in your Python code. Indented code is used to show conditional clauses or loops.

Aha
I think I have done something wrong accidently.

I recorded a video showing all the code components. Sorry, I am just taking your time … . If possible, would you please watch the video and tell me what I should do?

regarding the second point, I think I did not change the indentation.

Dear @wakecarter
Hi,
I uploaded the above video showing if I have

I would really really appreciate it if you could watch the video and guide me.

Thank you for everything