Experiment not working in Pavlovia but working locally

URL of experiment:
EPLab/final_jtc_oct_2024_v2

PsychoPy version:
2023.2.3

Description of the problem:
Hi All. I am struggling with opening my PsychoPy experiment when it comes to Pavlovia.

The experiment is working just fine while being opened on the local computer, but when it comes to the Pavlovia upload, it is not detecting the Software Platform (showing UNKNOWN and not PSYCHOJS) as well as when the experiment is being run, the screen shows the text “initialising” instead of running the experiment.

It seems problematic, because there was a situation earlier that the experiment was working on the computer and not online because of the Python libraries used in the code that Pavlovia was just not accepting, because they were probably too complicated. But now no other packages than pandas are used and I tried to achieve what I need in that experiment by doing it the simpliest way I can, without any more libraries and complicated code.

Experiment presents two slot machines, and each machine has its own sequential feedback that is shown after right or left key click. There are 5 trials and 4 of them require 20 clicks each, one of them requires 30 clicks.

Based on the previous attempts, I did this experiment in a completely new folder, with new file names, without any connections with other old versions. The new project in Pavlovia was created when syncing it with Pavlovia, but it still not working online.

It is hard for me to determine where is the problem and how can I fix it, since the experiments works while being run on the local laptop.

I would kindly appreciate any of your help. Thank you.

Hi there.

The problem is that your PsychoPy code does not compile correctly to PsychoJS. That is why you do not see a version number on Pavlovia.

The link you provided does not give anyone access to the program. You could either make your repository public or provide a toy example with stimuli via an upload here.

You must not use any Python libraries other than the ones that the Builder loads automatically. These libraries are the only ones for which there is a PsychoJS equivalent.

Before trying to run the experiment online, try running it in a local browser.

Best wishes Jens

Hello Jens!
Thank you for reaching out. Unfortunately I don’t know how to change the access, so I created a short version with only one trial:
Short_version_JTC.zip (5.9 MB)

That’s the problem with not using any libraries, because I do not know how else can I solve this case:

There are 5 trials. Each trial has two slot machine pictures (Machine 1 and Machine 2) which have specific feedback attached to them. Each machine has 20 responses that should go one after the other, in the order in which they are entered in the Excel list. A person has 20 clicks in total that can be used on both machines or only one - depending on a persons choice (but 20 clicks in summary is a maximum). These feedbacks are controlled by pressing the left (for Machine 1) or right (for Machine 2) arrow on the keyboard.
During the trial the person sees two slot machines like this:

. Every right or left click activates the feedback that is being shown on a separate screen, as the trial and the feedback are connected in a loop.

Unfortunately, plugging one Excel into the loop and referencing the columns doesn’t work properly because Excel goes down the rows one by one, but in both columns together. So if someone clicks the left button 3 times, the first 3 rows from the Machine 1 column show up, but if his fourth click is the right one - i.e. Machine 2, the feedback shows the answer from the fourth row of the Machine 2 column, even though the right button was clicked the first time. This solution could be opened in Pavlovia, but unfortunately it did not work properly at that time.

And I have been trying for a long time how not to use libraries, but to be able to create feedback that will show up for each machine separately based on arrow clicks. The current version shows what I want, but it just won’t open in Pavlovia, which is where we want to do this experiment. :frowning:

The sequential feedback looks like this in Excel:
Trial1_8020.xlsx (9.1 KB)

The code for the first trial looks like this (and allows to show the sequential feedback separately to both machines, but working only locally because of pandas):

BEGIN EXPERIMENT

import pandas as pd

#FOR THE 1ST CONDITION
#Load an Excel file (common to M1 and M2) into the DataFrame
df1 = pd.read_excel(‘Trial1_8020.xlsx’)

#Assign columns to the lists for M1:
feedback1_machine1_v = df1[‘video_machine_1’].tolist()
feedback1_machine1_t = df1[‘text_machine_1’].tolist()
#Assign columns to the lists for M2:
feedback1_machine2_v = df1[‘video_machine_2’].tolist()
feedback1_machine2_t = df1[‘text_machine_2’].tolist()

#Set the initial counters to zero
count1_M1 = 0
count1_M2 = 0

EACH FRAME

if key_resp_1.keys == “left”:
video = feedback1_machine1_v[count1_M1] #video_machine_1
msg = feedback1_machine1_t[count1_M1] #text_machine_1
count1_M1 += 1;
time = 2
elif key_resp_1.keys == “right”:
video = feedback1_machine2_v[count1_M2] #video_machine_1
msg = feedback1_machine2_t[count1_M2] #text_machine_1
count1_M2 += 1;
time = 2
else:
msg = ‘’

Thank you so much for the interest in this case.
Best wishes,
Gosia

Hello

You do not need pandas to read a condition file. Just specify the file as a condition file in your loop.

Best wishes Jens

Hello,

Unfortunately this way is not working correctly when it comes to this certain experiment. In PsychoPy, each keyboard response is interpreted as the next step in the loop, so the programme therefore moves one row in Excel each time, regardless of which machine (column) you want to select.

That is why I was trying to find the way how else can I do that without using the pandas or any other library, because only using pandas I could achieve that result.

Doing it by specifying it as a condition in the loop was working like I wrote earlier: „So if someone clicks the left button 3 times, the first 3 rows from the Machine 1 column show up, but if his fourth click is the right one - i.e. Machine 2, the feedback shows the answer from the fourth row of the Machine 2 column, even though the right button was clicked the first time”.

And in this experiment, each of the two machines is assigned a separate feedback, which should be displayed sequentially for each machine separately. That is, if someone clicks the left button 4 times, the first 4 rows of Machine 1’s feedback will be displayed to him, but if his fifth click is the right button, the first row of Machine 2’s column should be displayed to him, not the fifth, since he clicked on Machine 2 the first time. This, unfortunately, cannot be achieved by simply plugging Excel with conditions into a loop.

Anyway, thank you so much for your interest in this topic Jens, but perhaps it is impossible to achieve this scheme without using any libraries, because only with their use the experiment showed feedback in the desired way.

Best regards,
Gosia

Hello

A key-press does not have to end a routine.

Best wishes Jens

If you want a feedback screen after every key press but not to change rows in your conditions file then you could use concentric loops. The outer loop points to your conditions file and your inner loop has 20 reps and no conditions file. The code to break out of your inner loop early would be nameOfInnerLoop.finished = True