View Single Post
  #4  
Old 09-29-2020, 12:54 AM
kennethkarthik kennethkarthik is offline
Moderator
 
Join Date: Jul 2018
Posts: 7
Hi Roy,

There was just a bug in your code. You were setting "avatarAnim" to visible off and on states in your experiment function instead of using "trial" which would iterate between your shuffled states.

Code:
import viz
import random
import viztask

avatar_files = ['vcc_male.cfg', 'vcc_female.cfg']#2avatars
animation = range(0,16)  #default 15 animations

viz.go()

piazza = viz.addChild('piazza.osgb')


#make 30 stimuli list (2 avatars x 15 animations), and shuffle the order
stimulus = []
for i in avatar_files:
	for j in animation:
		avatarAnim = viz.addAvatar(i, pos=(0,0,0), euler=(180,0,0))
		avatarAnim.state(j)
		avatarAnim.visible(viz.OFF)
		stimulus.append(avatarAnim)
print(stimulus)
random.shuffle(stimulus)
print(stimulus)

def experiment():
	yield viztask.waitKeyDown(viz.KEY_RETURN)
	for trial in stimulus:
		yield viztask.waitTime(1)
		trial.visible(viz.ON)
		yield viztask.waitKeyDown(viz.KEY_RETURN)
		trial.visible(viz.OFF)

viztask.schedule(experiment())
Check this and let us know if this was your intended experiment. Thanks
Reply With Quote