URL of experiment: Pavlovia
Sign in · GitLab
Description of the problem:
Hi all,
I have a memory experiment where subjects learn sequences of short videos during study, and their memory for the order of videos within a sequence will be tested later. I will skip the study phase because it works perfectly without a problem online (I have set the nREP for the loop of the study to be 0 so it will be skipped).
In the test phase, thumbnails of videos for a studied sequence will be shown on the screen simultaneously (in several predetermined positions). Also on the same screen there will be several boxes. Participants need to drag and drop the images (thumbnails) to the boxes to sort them in order, and click on a continue button to move to a next screen when finished.
I have a flow that looks like this as there will be four types of sequence length (i.e., 4, 5, 6, vs. 7).
There is no problem when running locally but on pavlovia it says the pages are unresponsive with no error in the console (on both IE and Chrome) after the instruction screen is presented. I’d appreciate if anyone has any idea on how to debug.
I have checked the crib sheet and made all the possible modifications I can see but the problem remains. My current guess is there is some problem with my self-defined functions to select loops and rows, and to drag and drop.
My code to select loops and rows:
# Begin experiment
# my own test block counter
# but instead of 18, this loop will repeat 72 times
testBlocks_counter = 0
# create a random list of sequence order for each participant and each sequence length
test_sequence_indices_sl4 = list(range(18))
test_sequence_indices_sl5 = list(range(18))
test_sequence_indices_sl6 = list(range(18))
test_sequence_indices_sl7 = list(range(18))
# random.seed() - cannot use this online
shuffle(test_sequence_indices_sl4)
shuffle(test_sequence_indices_sl5)
shuffle(test_sequence_indices_sl6)
shuffle(test_sequence_indices_sl7)
# initial value for test sequence selection
test_sequence_number = 0
# create empty lists for boxes positions
boxesPosSL4 = []
boxesPosSL5 = []
boxesPosSL6 = []
boxesPosSL7 = []
# create empty lists for image positions
imagesPosSL4 = []
imagesPosSL5 = []
imagesPosSL6 = []
imagesPosSL7 = []
# Begin Routine
# index in the test_row_indices list to select a random sequence
testBlocks_counter = testBlocks_counter
if testBlockSequenceLength == 4:
test_sequence_number = test_sequence_indices_sl4[int(testBlocks_counter/4)]
nRepsSL4 = 1
nRepsSL5 = 0
nRepsSL6 = 0
nRepsSL7 = 0
elif testBlockSequenceLength == 5:
test_sequence_number = test_sequence_indices_sl5[int(testBlocks_counter/4)]
nRepsSL4 = 0
nRepsSL5 = 1
nRepsSL6 = 0
nRepsSL7 = 0
elif testBlockSequenceLength == 6:
test_sequence_number = test_sequence_indices_sl6[int(testBlocks_counter/4)]
nRepsSL4 = 0
nRepsSL5 = 0
nRepsSL6 = 1
nRepsSL7 = 0
elif testBlockSequenceLength == 7:
test_sequence_number = test_sequence_indices_sl7[int(testBlocks_counter/4)]
nRepsSL4 = 0
nRepsSL5 = 0
nRepsSL6 = 0
nRepsSL7 = 1
test_row_selected = str(test_sequence_number)
My function to shuffle image positions:
# Begin Experiment
# create a function to shuffle test order so that it differs from study order for each sequence
def myFun_shuffle_sequence_order(study_order_list, sl):
test_order_list = study_order_list[:]
while True:
shuffle(test_order_list)
for i in range(sl):
for j in range(sl):
if i == j and test_order_list[i] == study_order_list[j]:
break
else:
return test_order_list
shuffle_sequence_order = myFun_shuffle_sequence_order
# Begin Routine
# define boxes and images positions
boxesPosSL4 = [(-0.6, 0.3), (-0.2, 0.3), (0.2, 0.3), (0.6, 0.3)]
imagesPosSL4 = [(-0.6, -0.275), (-0.2, -0.075), (0.2, -0.275), (0.6, -0.075)]
# generate test sequence order
study_order_list_sl4 = [1, 2, 3, 4]
sl4 = 4
test_order_list_sl4 = shuffle_sequence_order(study_order_list_sl4, sl4)
# cannot these to index image positions in GUI directly
image41Pos_index = test_order_list_sl4[0] - 1
image42Pos_index = test_order_list_sl4[1] - 1
image43Pos_index = test_order_list_sl4[2] - 1
image44Pos_index = test_order_list_sl4[3] - 1
My function to drag and drop:
# Begin experiment
def myFun_movePicked_sl4(picked, mouseSL4, grabbed):
# Move piece if we already moving that piece
if grabbed is not None and mouseSL4.isPressedIn(grabbed):
grabbed.pos = mouseSL4.getPos()
return grabbed
else:
# Move newly clicked piece
for piece in picked:
if mouseSL4.isPressedIn(piece) and grabbed is None:
return piece
movePicked_sl4 = myFun_movePicked_sl4
# Begin Routine
pieces = [image41, image42, image43, image44]
picked = []
movingPiece = None
finalBoxChosen = 0
finalBoxChosen_data = []
# Each Frame
for piece in pieces:
if mouseSL4.isPressedIn(piece) and movingPiece is None:
picked.append(piece)
movingPiece = movePicked_sl4(picked, mouseSL4, movingPiece)
Thanks a million!