URL of experiment:
2024.1.5 Version Pavlovia
2021.1.4 Version Pavlovia
Description of the problem:
I remade an old experiment, that was probably made in 2021.1.4, in Version 2024.1.5. We wanna modify it to test a new hypothesis and thought it would be easier to do that with a newer version.
The Remake worked fine in PsychoPy. But then came the time to translate certain code elements into JavaScript. I seemingly got all bugs out of the way that make the experiment crash.
But I still have this weird issue, that some routines take a long time to be displayed. For example, after the resources are downloaded and you click “Ok” to start the experiment, the textbox stays on screen for a sec before showing the first instruction. The same thing happens after the instructions for phase 1. It takes so long that the first trial is always missed for being too slow. This happens every time it changes to or from pictures that belong to the instruction pictures. But the picture files themself are a direct copy from the old experiment.
I have no clue what causes this and what I can do to change it.
I avoided 2024.1.5 but I can’t remember why. Please leave your original untouched and try updating the new one to 2024.2.4 (or changing the version in Experiment Settings to 2024.1.4).
Hi, changing version in the Experiment Settings to 2024.1.4 didn’t do anything. Those changes aren’t synced to Pavlovia, it still says the Platform Version is 2024.1.5. That seems to be dependent on the Version of PsychoPy uploading the experiment.
Then I downloaded and installed PsychoPy v 2024.2.4. That also changed the platform version. But it has the same issue with graphics loading too slow.
Also I now have a strange bug when trying to execute the experiment in pilot mode in my browser. In 2024.2.4 and 2024.1.5.
Problem is, there is no .xlsx named “orange_ke”. I often have the variable “orange_key” in my custom code elements, but no .xlsx even remotely close to that name. When looking at the JavaScript for the experiment “orange_ke” or “orange_key.xlsx” isn’t in there. And this ONLY happens when I try to run it in my browser locally. When I sync the experiment to Pavlovia and run it there, this error doesn’t happen.
I can’t edit my previous post. I just wanted to say that weird bug with “orange_ke.xslx” doesn’t appear anymore. Maybe that only happened because I installed 2024.2.4 and tested it without restarting my PC.
But the delay between images still persists.
EDIT: I wanted to see if the Web-Dev Tools, specifically the Run-Time-Analysis could tell me what’s causing the hangup. I don’t understand the finer details but it showed me that the issue appears when a loop starts. The exact error message is:
WARN 16:08:39.527 node_modules/log4javascript/log4javascript.js/</PatternLayout.prototype.format psychojs-2024.2.4.js:7 | setting the value of attribute: seed in PsychObject: loop_trials_learning as: undefined
I don’t understand why this would be a problem now. We have never used Seeds before and it worked fine without them. Maybe it’s not about the seeds, but comparing the appearance of the delays with the Flow of the experiment, it correlates exactly with when a loop begins.
I think I’ve solved your issue.
I changed code_trial to Auto and in doing so noticed that in Python you were setting degree to be a single number degree = random.choice([0, 90, 180, 270])
and in JS you were setting it to a list degree=[0,90,180,270]; util.shuffle(degree);
My fix was to set the orientation of Target_Stimulus to degree[0]
This is my code: I’d want to confirm that randint(1,6) gives values 1 to 5 in Python and JS but that’s a minor issue.
# randomly chooses one of all possible right angles to change the orientation of the stimulus to add extra variation
# target_stimulus -> Layout -> Orientation
degree=[0,90,180,270]
shuffle(degree)
#degree = random.choice([0, 90, 180, 270])
# takes the orange to blue ratio (0,4775) and multiplies it by 10k to get a full number (4775.0)
# then it turns that from a float to an integer (int()), this makes it 4775
# then it turns that integer into a string (str()), because integers cannot be added to strings
# it is then added to the name of the target_stimulus to select the right image
perc_orange = str(int((orange * 10000)))
# there are 5 different pictures for every orange to blue ratio, this chooses a number from 1 to 5 at random
# it is then added to the name of the target_stimulus to select the right image
pix_number = randint(1,6)
#pix_number = random.choice(('1', '2', '3', '4', '5'))
print('pix_number',pix_number)
# selects which choice is the correct choice
# depending on the orange to blue ratio of the image
# od and ok_correct are in the xlsx
if orange_key == 'd':
resp_correct = od_correct
elif orange_key == 'k':
resp_correct = ok_correct