WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-18-2014, 12:56 PM
armo armo is offline
Member
 
Join Date: Mar 2014
Posts: 21
DeprecationWarning when running a yield statement

Hello

I am working on this script where I run a task, wait for the user to give a mouse response and store the reaction time. Below is the task:

Code:
def example_trial():
    response = viz.Data()
    startTime = viz.tick()
    yield viztask.waitMouseDown( None, response )
    print 'response at: ', viz.tick() 
    reactionTime = response.time - startTime
    print reactionTime

but when it comes to the yield line it gives me this warning, and I can't figure out what it means and how to fix it

Code:
DeprecationWarning: "data" option will be removed in future versions, use "[data] = yield [condition]" instead
  yield viztask.waitMouseDown( None, response )
P.S. I have run the same code with a previous Vizard version and then I didn't get the warning
Reply With Quote
  #2  
Old 08-18-2014, 02:58 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The viztask.waitMouseDown command has been updated and no longer expects the viz.Data object to be passed as an argument. Use the following instead:

Code:
def example_trial():
	startTime = viz.tick()
	response = yield viztask.waitMouseDown( None )
	print 'response at: ', viz.tick() 
	reactionTime = response.time - startTime
	print reactionTime
Reply With Quote
  #3  
Old 08-19-2014, 11:23 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
To be clear, this is just a warning. Your existing code should still function properly. Deprecated functions are not removed until the next major version, so you have until Vizard 6 to update your code.

If you would like to simply disable the warnings, then add the following code to the beginning of your script. However, I would strongly recommend that you just update your code.
Code:
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
Reply With Quote
  #4  
Old 08-20-2014, 05:41 AM
armo armo is offline
Member
 
Join Date: Mar 2014
Posts: 21
Dear all

Thanks for the reply. There is no problem for me about updating my code but I would ask you if I can still use the "response.time" variable as it was written in the snippet above in order to calculate user's reaction time and the "response.button" in the snippet below to obtain the mouse button:

Code:
if response.button == viz.MOUSEBUTTON_LEFT:
    outResponse = "left response"
elif response.button == viz.MOUSEBUTTON_RIGHT:
    outResponse = "right response"

regards, armo
Reply With Quote
  #5  
Old 08-20-2014, 10:35 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Yes, the data object returned by viztask.waitMouseDown still contains that information.
Reply With Quote
Reply

Tags
condition, data, deprecation, warning, yield

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
Unexpected Avatar lookAt() behavior when using yield statements chris2307 Vizard 2 12-17-2013 02:58 AM
connecting to SMI iViewX running a RED tracker pkhoosh Vizard 11 10-20-2011 04:17 PM
running experimental trials fivel_lab Vizard 3 03-18-2011 02:58 PM
exiting a yield statement starbug Vizard 2 01-12-2010 03:16 PM
Problems running R3 and R2.5 on the same computer cade_mccall Vizard 5 09-05-2006 11:26 AM


All times are GMT -7. The time now is 01:46 AM.


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