WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 08-22-2014, 08:55 AM
bobbin_93 bobbin_93 is offline
Member
 
Join Date: Jul 2014
Posts: 4
Hi,

That's absolutely brilliant, thank you so much for your help it's really helped me to put the experiment together!

I have one more question however.

Within my 15 insects there are 5 'models' and 10 mimics'. Models sting, whereas mimics don't and therefore I need to display different answers for each - which I am having trouble with.

Here's the code that I've put. In the images the models are labelled 1 to 5 and the mimics are labelled 6 to fifteen. I've also tried seperating them into 2 seperate lists 'stinging' and 'non-stinging' however, the problem with this is I then can't get them to shuffle randomly between the two. Any ideas?




viz.go()

#Store images in list
images = [one,two,three,four,five,six,seven,eight,nine,ten,e leven,twelve,thirteen,fourteen,fifteen]


def testPhase():

#Repeat trial 3 times
for i in range (3):
#Make background visible
background.visible(viz.ON)
#Add focus point
focus.visible(viz.ON)
#Use random.shuffle to put images in a random order
random.shuffle(images)

#Cycle through images
for image in images:
#Wait 3 seconds for participant to look at focus point
yield viztask.waitTime(3)
#Remove focus point
focus.visible(viz.OFF)
#display image
image.visible(viz.ON)
#Mark the time the programme started
start_time = viz.tick()
question_data = open('experiment_data.txt','a')

#Wait for 'y' or 'n' key to be pressed
d = yield viztask.waitKeyDown(['y','n'])
elapsed_time = viz.tick() - start_time

#remove image and let user know if response is correct
#write data to file
if image == one or two or three or four or five:
if d.key == 'y':
image.visible(viz.OFF)
data = 'Participant' + ' Thinks the insect would sting.\t'
correct.visible(viz.ON)
correctPoints.visible(viz.ON)
info.visible(viz.ON)
if d.key == 'n':
image.visible(viz.OFF)
data = 'Participant' + ' Does not think the insect would sting.\t'
wrong.visible(viz.ON)
wrongPoints.visible(viz.ON)
info.visible(viz.ON)

if image == six or seven or eight or nine or ten or eleven or twelve or thirteen or fourteen or fifteen:
if data == 'n':
image.visible(viz.OFF)
data = 'Participant' + ' Does not think the insect would sting.\t'
correct.visible(viz.ON)
correctPoints.visible(viz.ON)
info.visible(viz.ON)
if data == 'y':
image.visible(viz.OFF)
data = 'Participant' + ' Thinks the insect would sting.\t'
wrong.visible(viz.ON)
wrongPoints.visible(viz.ON)
info.visible(viz.ON)
#add elapsed time to data
data = str(image) + data + ' Elapsed time was: ' + str(round(elapsed_time,2)) + ' seconds\n'
#Write the data to our file.
question_data.write(data)

#Press space bar to start the game
yield viztask.waitKeyDown(' ')
#Remove score
correct.visible(viz.OFF)
correctPoints.visible(viz.OFF)
wrong.visible(viz.OFF)
wrongPoints.visible(viz.OFF)
info.visible(viz.OFF)
focus.visible(viz.ON)

viz.quit()
Reply With Quote
 

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiled exe won't save trials to AVI krimble Vizard 1 01-29-2014 11:32 AM
running experimental trials fivel_lab Vizard 3 03-18-2011 02:58 PM


All times are GMT -7. The time now is 02:34 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC