I have managed to upload my experiment to Pavlovia, however I am stuck now that I need to change my Python code to JS so that Pavlovia can support it . Although I have read through many other threads and although there seem to be some answers in there, I think I do not fully understand how to change my code exactly.
These are my imports:
import random, xlrd from random import sample import itertools
I am using xldr to open excel files:
inbook = xlrd.open_workbook(infile) insheet = inbook.sheet_by_index(0)
This works perfectly, but ofcourse not for Pavlovia. How can I change this code to a type of code that Pavlovia can support? It seems so simple, and perhaps it is my lack of expertise in the field of coding, but I find it very difficult to grasp how I can open the Excel files from examples I have seen in the discourse.
This is how I then read in my file:
#read the stimuli from our sheet for rowx in range(1,num_items+1): #read in the values of all columns on this row row = insheet.row_values(rowx) #print out the value of column #print(row) #print(row) #saving the image to the picture array and instruction to instruction picture.append(row) instruction.append(row)
After this I use the shuffle function to shuffle my stimuli:
picture1 = random.sample(picture, len(picture)) picture2 = random.sample(picture, len(picture)) picture3 = random.sample(picture, 20)
I later use itertools for a semi-counterbalanced manipulation:
instruction_shuffled2 = list(itertools.chain(*instruction_shuffled2))
As I am understanding it, I change the Python code to meet the requirements of Pavlovia. I do this by going into the code element in the first routine that I have made in the Builder where I have stored this code and change it to a code that does not use imports. Does anybody have insight into how I can alter the code so I do not use the imports. I am very much struggling with opening the Excel file in particular.
I understand this may be a very basic question, though I really hope that somebody could help me with this as I am at my wits’ end.