Converting python to JS - NumPy and and random.normal function

Hi Jon, thanks for your reply - I’ve looked into it a bit more and fixed one of the errors by changing an unsupported shape to an image instead. However, I’m also getting this other error:

Which refers to the 5th line of this bit of code:

python-

import numpy as np
if trialCount>19:
    trials_prac_1.finished = True 

    allRT = trials_prac_1.data['target_prac_1_resp.rt']
    selectRT = allRT > 0.1
    RT  = allRT[selectRT]

# calculate mean RT 
    meanRT = np.mean(RT)

# calculate new median RT
    medianRT = np.median(RT)

# define upper RTs 
    upperRT = RT < medianRT 
    uRT = RT[upperRT]

#calculate mean and std on upper RT
    uppermeanRT = np.mean(uRT)
    upperstdRT = np.std(uRT)

#calculate min and max duration
    minmax = upperstdRT*2

    trials_prac_1.addData('RT', RT)
    trials_prac_1.addData('meanRT', meanRT)
    trials_prac_1.addData('medianRT', medianRT)
    trials_prac_1.addData('upperRT', upperRT)
    trials_prac_1.addData('minmax', minmax)

javascript-

import * as np from 'numpy';
var RT, allRT, meanRT, medianRT, minmax, selectRT, uRT, upperRT, uppermeanRT, upperstdRT;
if ((trialCount > 19)) {
    trials_prac_1.finished = true;
    allRT = trials_prac_1.data["target_prac_1_resp.rt"];
    selectRT = (allRT > 0.1);
    RT = allRT[selectRT];
    meanRT = np.mean(RT);
    medianRT = np.median(RT);
    upperRT = (RT < medianRT);
    uRT = RT[upperRT];
    uppermeanRT = np.mean(uRT);
    upperstdRT = np.std(uRT);
    minmax = (upperstdRT * 2);
    trials_prac_1.addData("RT", RT);
    trials_prac_1.addData("meanRT", meanRT);
    trials_prac_1.addData("medianRT", medianRT);
    trials_prac_1.addData("upperRT", upperRT);
    trials_prac_1.addData("minmax", minmax);
}

Does this mean it’s not correctly reading the reaction times from the practice block, and if so could you possibly recommend any way I can alter the code to overcome this?