psychopy.org | Reference | Downloads | Github

Selecting one row of condition file: translating code "np.random.choice(2, size=1, replace=False)" in javascript

URL of experiment: https://gitlab.pavlovia.org/Serena/execc

Description of the problem:

hi all,

I have build an experiment that works fine offline in PsychoPy (v3.1.5) but online It gets stuck on selecting a row from the condition-file. I receive the error: when importing condition of Confile.xlsx. Type error: Cannot read property ‘0’ of undefined.

In the builder interface I added “np.random.choice(2, size=1, replace=False)” in the field next to selected rows to let the program only select one row of the two rows in the condition-file. The rows contain two different .xlsx files with different pairs of stimuli (pair_1.xlsx and pair_2.xlsx).

I think the error is due to an incorrect translation in javascript:
trialList: TrialHandler.importConditions(psychoJS.serverManager, ‘Confile.xlsx’, ‘np.random.choice(2, size=1, replace=False)’)

Does anyone know how to translate this correctly?

Thanks in advance,
Serena