psychopy.org | Reference | Downloads | Github

"ReferenceError: Can't find variable: asarray" despite any custom code

Hi!

URL of experiment:

Description of the problem:

I created a simple experiment using psychopy builder without any custom code. It presents two visual stimuli S1 and S2 one after each other above and under a central fixation cross. The onset of stimulus 2 is variable (SOA variable), and this variable onset is specified in the conditions file by a variable SOA.
See here, how the onset is defined in psychopy.

While this experiment runs perfectly under psychopy, piloting on pavlovia returns the following error message:
“ReferenceError: Can’t find variable: asarray”

Unfortunately, I don’t understand javascript at all. But I did some research and if I understand this issue correctly after reading previous similar problems, I would have thought that such an issue only occurs when using custom code in psychopy, which I don’t have. In these cases, it appears to me that one should define the unrecognized variable globally.

So my problem is here how to do so if I do not use any custom code? Also, “asarray” does not seem to be a variable but a command in python (numpy?) to create an array.

Can anybody help me, please, or steer me towards the proper solution, if it has been documented already. I apologize in case I was not able to find it.

Thank you very much!
Aleks

Try $SOA in the component.

Tried it, but then it does not run locally on psychopy anymore:

error :
if S2.status == NOT_STARTED and tThisFlip >= asarray($SOA)-frameTolerance:
^
SyntaxError: invalid syntax

On pavlovia, it is still the same error, the js code only contains now $SOA instead of SOA.

// S2 updates
if (t >= asarray($SOA) && S2.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
S2.tStart = t; // (not accounting for frame time here)
S2.frameNStart = frameN; // exact frame index
S2.setAutoDraw(true);

Are you using a 2021 version prior to 2021.1.3?

Oh, yes indeed, I was using the version from February, which apparently has been updated twice since then. I was not expecting updates so frequently, my apologies for not checking this earlier.
I upgraded, and the error is no longer there. Great, thanks!

It is running somewhat unstable, though. The stimuli do not disappear as they should and the experiment gets stuck after a few trials and the screen freezes displaying something that actually cannot appear in the experiment (no fixation cross and stimulus 2 present). But this is another issue then…

Anyway, it is running now. Thank you! I will keep on monitoring updates from now on.

Normally using old versions is fine, but there is a reason why my crib sheets cover 2020.1.3-2020.2.10 and 2021.1.3-2021.1.4, skipping the very early 2020 and 2021 versions.