WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-16-2010, 01:01 PM
clowenth clowenth is offline
Member
 
Join Date: Apr 2010
Posts: 5
Time - seconds are longer than real seconds

I'm using the code from the reaction time tutorial, and the time listed is supposed to be in seconds. However, compared to real time, the time listed is less than half the number of seconds that elapse in the interim between the display of the stimulus and the response. Is there a conversion factor that I can use, or is there a better way to handle this? Thanks!
Reply With Quote
  #2  
Old 04-16-2010, 01:27 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
Have you modified the example or moved the code into your own script? If so, does this happen when you run the example without changes?
Reply With Quote
  #3  
Old 04-16-2010, 01:31 PM
clowenth clowenth is offline
Member
 
Join Date: Apr 2010
Posts: 5
I thought that might be the problem when I had it added into my own program, so I tried it with an exact copy of the tutorial code in a new file, and it had the same problem. Does it work for you in the tutorial version?
Reply With Quote
  #4  
Old 04-16-2010, 02:05 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,448
So if you start a stopwatch when the color turns green and let it run for say 10 seconds and then press the spacebar, are you saying the time shown on screen is approximately 5 seconds? What OS are you using?
Reply With Quote
  #5  
Old 04-29-2010, 08:27 AM
clowenth clowenth is offline
Member
 
Join Date: Apr 2010
Posts: 5
It seems like it might actually be a bit worse than that. I'm using Windows XP. When I try it in the tutorial file alone, it shows a little under 4 seconds when I let a stopwatch go for 10 seconds. In my file that I'm trying to use it in, it seems like it's closer to 5 or 6 Vizard seconds for 10 stopwatch seconds. Even factoring my double reaction time (starting the stopwatch and then stopping the stimulus and the stopwatch simultaneously), I think something's off. Any ideas?

P.S. Sorry for taking so long to respond!
Reply With Quote
  #6  
Old 04-29-2010, 11:42 AM
masaki masaki is offline
Member
 
Join Date: Jan 2008
Posts: 63
hi can you try this modified script and see what you get? The modifications are:

- stimulus changing color is not triggered by a random time - you trigger it by hitting the space bar. So essentially, it measures the time interval between two key presses instead of measuring your reaction time.

- there is a timer function that prints the elapsed time between stimulus change and keypress.

- i've added a second viz.Data object called dd and used that one for storing the time data from the second waitkeydown function.

I tested the code with an external stopwatch and seems accurate.

Code:
import viz
viz.go()

import vizinfo
info = vizinfo.add( 'This script uses precisely timed input recording to measure your reaction time.\nPress any key when the color changes to green.\nCan you get under .2 seconds?' )

#Add quad to screen
quad = viz.addTexQuad( viz.SCREEN , pos=(0.5,0.5,0) , scale=(4,4,4) )

#Display time on screen
timeDisplay = viz.addText( 'Time:', viz.SCREEN , pos=(0.1,0.2,0) )

import viztask

import time
starttime = time.time()

stopWatch = False


def TestReactionTime():
    global starttime, stopWatch
    #Data for getting values from wait conditions
    d = viz.Data()
#    dd = viz.Data()
    while True:
        
        #Set quad to red color
        quad.color(viz.RED)
    
        #Wait random amount of time
        yield viztask.waitKeyDown(' ')
        starttime = time.time()
        stopWatch = True
        #Set quad color to green
        quad.color(viz.GREEN)
        
        #Wait for next frame to be drawn to screen
        yield viztask.waitDraw(d)
    
        #Save display time
        displayTime = d.time
        
        #Wait for keyboard reaction
        yield viztask.waitKeyDown(None,d)
        
        #Calculate reaction time
        reactionTime = d.time - displayTime
        
        #Print and display time
        print 'Reaction time:',reactionTime
        timeDisplay.message( 'Time: %.5f' % (reactionTime) )
        stopWatch = False

viztask.schedule( TestReactionTime() ) 

def showTime():
	if stopWatch:
		print time.time() - starttime
vizact.onupdate(-100, showTime)
Best,
Masaki
Reply With Quote
  #7  
Old 05-19-2010, 09:14 AM
clowenth clowenth is offline
Member
 
Join Date: Apr 2010
Posts: 5
Ok, the time works out now when I use that code. So we know it's not a computer problem. However, the random timing is an important part of the code, since I want to use it as a side task that the user has to attend to at unexpected intervals. Any suggestion as to how to make that work? Thanks!
Reply With Quote
Reply

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
real time collision on animation path whj Vizard 10 10-06-2008 04:38 PM
Real Time Audio Data lomendil Vizard 2 06-02-2008 08:18 PM
Can I get real time Intersense tracking data from another computer on the network? GoldenSun Vizard 4 04-30-2008 07:42 PM
Flagging the Data Elittdogg Vizard 5 04-11-2008 11:40 AM
timer question Elittdogg Vizard 5 10-10-2007 02:49 PM


All times are GMT -7. The time now is 04:29 AM.


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