Can PsychoPy3 with code scripts be converted seamlessly to Pavlovia?

URL of experiment:

Description of the problem:
When I converted PsychoPy experiment to Pavlovia, the system suggested a successful convertion.

I am able to generate a pilot link. When I was running the pilot through the generated link, I encountered the following errors:

a. the screen in Pavlovia does not match the one in PsychoPy

–The instruction seems oversized and inverted.

b. a previous “training” folder seems unable to be tracked to run the experiment.


Along with PsychoPy, the experiment is accompanied by 4 individual folders, which was converted successfully into Pavlovia.

So, Can PsychoPy3 with code scripts be converted seamlessly to Pavlovia?
If yes, then how to fix the problems mentioned above?

Thank you for your reading!

I am kind of new to Pavlovia as well, so mine is only a suggestion:

For images there is the way to change units. for example from pixel to something else, try to play around with that. Check this topic: Psychojs reference questions: Units, TextStim clarity, and element visibility

Concerning “trainFile”, probably you need to tell us how you are calling that variable. What is your code?

1 Like

Hi :slight_smile: Thanks a lot for your help.
Thanks for the website, which seems useful.

Regarding “TrainFile”, I am also not sure what the converted online experiment is asking about.
I used PsychoPy3, both builder view and code scripts, to set up my experiment.

It’s a word learning task:
a. Participants’ task is to get trained to learn 16 words and 8 images, and then tested.
b. in training, each trial plays 2 words and shows 2 images (48 trials in total);
c. in testing, each trial plays 1 word and shows 4 images (16 trials in total).

We wrote codes to ask psychoPy to draw materials from 5 separate folders.
Folder1–“images”–to store 8 images;
Folder2–“word”–to store the sounds of 16 words;
Folder3–“Training”–to store 45 excels–each excel differs in the sequence of word/image during training;
Folder4–“Testing”–to store 45 excels–each excel differs in the sequence of word/image during testing;
Folder5–“matrix”–to store 45 excels–each excel differs in the mapping between words and images (e.g. word “apple” goes with sound “[pid]”)

So, I am not sure what the warning message “TrainFile” refer to. It could be “Training” folder. However, I have checked my repository–all folders are converted online.

Without Java experience, I may find it hard to interpret. Please let me know if I didn’t make myself clear.

Sincerely appreciate your help! :slight_smile: Stay healthy and well.
Ye

Yesterday myself I had to adjust text for Pavlovia, and I would say that setting the units to “height” is quite a good solution both for images and text.

Concerning trainFile, chek the full code component (not in Builder view), you should be able to fìnd where it is required. One error I found so far is that in Java is not possible to use addData. So if you have trainFile.addData(), this could be the error and it would be easy to fix. However, it could be many things.

1 Like

Hi GioP. Thank you! :slight_smile:

Regarding trainFile, it was written as a code in PsychoPy, to retreive Folder3 “Training” into experiment.

I have a guess that while converting PsychoPy online into Pavlovia, the code might not work. If this is the case, it’s highly likely that I will run into another warning “TestFile cannot be found” when the experiment proceeds to testing phrase (at that time, Folder4 “Testing” needs to be retreived as well)

I did find an addData as suggested by you, but I may not know how to interpret (I have no Java, Python experience…). The screenshot was attached below for you.

Glad to get your feedback! Stay well.
Ye

Problems were solved.

In order to help those who also used pictures and sounds, and mouse-clicking, I wrote the bugs I met and the solutions to it.

  1. Problem 1–Pavlovia cannot run complex codes. If you have complex codes in psychopy, make it simple.
    I used to generatrate 45 excels to give each participant a different combination of stimuli presentation (to eliminate stumili effect). So the code for dragging the 45 excels does not work.

You will run into this warining guy:

Solution:
I select 1 excel to specifying the stimuli sequence for all participants.
(If you want better randomization, e.g. creating 3 different stilumi lists for participants, I guess you may need three links. I think if you pre-specify participant number with links, it’s still doable. I am still trying to figure it out how to make those 3 links into 1 intergrated link…)

  1. Problem 2–if you use pictures, change jpg into png.
    JPGs do not work in Pavlovia, and you will see this warning guy.

Solution:

  1. Change pictures from jpg into png

  2. Change the name of pictures in your condition excel, e.g. from images/1.jpg to images/1.png (images is the folder name which stores your picture stimuli)

  3. Problem 3–if you use sounds, do not set sound duration–make it infinite duration.
    If you set duration as e.g. 1s, you will run into this warning guy:

  4. Problem 4–if you write code in Psychopy to match mouse clicks with CorrAcc to get something like 1 for correct, 0 for incorrect, it does not work in Pavlovia.

I do not have a solution to Problem 4 yet. Welcome all suggestions.

Hope it helps. Stay well.