Flagging the Data
So I'm collecting position data through a flock of birds and writing the data to text files on the computer. I have:
Code:
flock1 = viz.add('flockofbirds.dls') Code:
def onkeydown(key): So when I run my script I get this error: raceback (most recent call last): File "C:\Program Files\Vizard25\vizact.py", line 1981, in __onkeydown item.call() File "C:\Program Files\Vizard25\vizact.py", line 1897, in call _paramargs_(self.func,0)(*(_paramargs_(self.args,0 ))) File "Prism_VE_Updated_Maze_7_BASELINE.py", line 152, in WriteFlag tracking_data.write('*** Reached point ' + letter + 'in', clock(), 'seconds' + '\n') TypeError: function takes exactly 1 argument (3 given) Traceback (most recent call last): File "C:\Program Files\Vizard25\vizact.py", line 1981, in __onkeydown item.call() File "C:\Program Files\Vizard25\vizact.py", line 1897, in call _paramargs_(self.func,0)(*(_paramargs_(self.args,0 ))) File "Prism_VE_Updated_Maze_7_BASELINE.py", line 162, in WriteFlag2 tracking_data.write('*** Time of Trial =', clock(), "seconds" + '\n') TypeError: function takes exactly 1 argument (3 given) And I have no idea why it thinks I'm trying to give it 3 arguments. If I change the WriteFlag function to: Code:
flags = ['A', 'H', 'I', 'M', 'O', 'T', 'U', 'V', 'W', 'X', 'Y'] I would love to be able to press "f" and get which letter was reached and at what time it was reached and I would like to know how to make it so that when I press "q" to quit the program that the time at that point could be written to the file as well. |
You are passing the write function 3 arguments and it only accepts 1. Change the code in your WriteFlag2 function to concatenate the flock value to the string:
Code:
tracking_data.write('*** Time of Trial =' + str(clock()) + "seconds" + '\n') |
Is there a way to get it to say what I want (even though it's 3 arguments?) Can I make it so that the write function can handle 3 arguments?
And is there a way to include WriteFlag2 to ONLY write the time of the trial when I quit the program by pressing "q"? |
Or would it be better to write a 3rd flag with the same button press that reports the time. So i'd have one write which letter and another the time both would work while pressing "f"?
|
Here is a function that wraps calls around the write function and allows multiple arguments:
Code:
def writeData(f,*args): Code:
writeData(tracking_data,'*** Reached point ' + letter + 'in', clock(), 'seconds' + '\n') |
Thank you for the help. I really appreciate it.
|
All times are GMT -7. The time now is 04:14 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC