Converting "np" to Java

Hi!

I’ve created an experiment on Builder but with quite a few code components and this seems to be working perfectly on PsychoPy. However, I now need to upload it to Pavlovia to run it online and I’m having some problems doing this because I’m not sure how to convert to Java (I’m a very beginner coder)… I was wondering if anyone might be able to help with one of the errors I’m currently receiving:

Error: ReferenceError: Can’t find variable: np

I have “np” in two different place in my code, both of which I assume need changing for Java so would appreciate help on how to do this.

  1. selecting a random condition file for each participant at the beginning of the experiment

condFile = np.random.choice((‘conditions/cond1.xlsx’, ‘conditions/cond2.xlsx’, ‘conditions/cond3.xlsx’, ‘conditions/cond4.xlsx’, ‘conditions/cond5.xlsx’, ‘conditions/cond6.xlsx’, ‘conditions/cond7.xlsx’, ‘conditions/cond8.xlsx’, ‘conditions/cond9.xlsx’, ‘conditions/cond10.xlsx’, ‘conditions/cond11.xlsx’, ‘conditions/cond12.xlsx’), size = 1)[0]

  1. In the second part of the experiment, they are shown 6 fish, two of which are circled representing the fact they are “upvalued”. Each of these fish correspond to a particular lake (they have learnt these pairings in the first part of the experiment), so this piece of code determines which fish are circled and therefore which lakes are “unvalued”. This is needed so I can move on to code the different responses that are required to each lake (if it upvalued or not). This may not make any sense as I’m trying to keep it brief, so let me know if it needs further explanation!

upval_lake = upval_stim_pairings[ Stimulus ]
circle1_matches = np.all(circle1.pos == upval_lake.pos)
circle2_matches = np.all(circle2.pos == upval_lake.pos)

Thanks so much for any help!
Sofie