GazeParser.Utility
- some useful functions¶
-
GazeParser.Utility.
checkAttributes
(gazeData)¶ Check attributes of GazeParser.Core.GazeData object and returns a list of lacking attributes. This function is used to check whether data built by old versions of GazeParser have all attributes defined in the current
- パラメータ
gazeData (GazeParser.Core.GazeData) -- GazeParser.Core.GazeData object to be checked.
- 戻り値
List of lacking attributes.
-
GazeParser.Utility.
compareVersion
(testVersion, baseVersion)¶ Compare Version numbers. If testVersion is newer than baseVersion, positive number is returned. If testVersion is older than baseVersion, negative number is returned. Otherwise, 0 is returned.
- パラメータ
testVersion (str) -- A string which represents version number.
baseVersion (str) -- A string which represents version number.
- 戻り値
See above.
-
GazeParser.Utility.
createConfigDir
(overwrite=False)¶ Create ConfigDir, where GazeParser user configuration files are located. If process is running as root (uid=0), this method do nothing.
- パラメータ
overwrite (bool) -- If ture, existing configuration files are overwritten. Default value is False.
-
GazeParser.Utility.
join
(newFileName, fileList)¶ Combine GazeParser data files into a single file. If some files have addional data and the others don't have, missing additional data is filled with empty lists.
- パラメータ
newFileName (str) -- Name of combined data file.
fileList (sequence) -- A list of file names to be combined.
-
GazeParser.Utility.
load
(filename, checkVersion=True)¶ Load GazeParser data from a file. A return value is a tuple of two elements. The first element is a list of GazeParser.GazeData objects. The second element is an additional data saved within the file. If no additional data is included in the file, additional data is None.
- パラメータ
filename (str) -- Filename.
checkVersion (bool) -- If True, version of data file is checked. If the file is generated in an old version of GazeParser, warning message is shown. To suppress warning, set False to this option. Default value is True.
-
GazeParser.Utility.
rebuildData
(gazeData)¶ Try to rebuild data from the data built by older versions of GazeParser. Missing attributes are filled by default values. If you want to speficy parameters, please rebuild data by using GazeParser.Converter module.
- パラメータ
gazeData (GazeParser.Core.GazeData) -- GazeParser.Core.GazeData object to be rebuilt.
- 戻り値
Rebuilt data.
-
GazeParser.Utility.
save
(filename, data, additionalData=None)¶ Save GazeParser objects to a file.
- パラメータ
filename (str) -- Filename.
data -- List of GazeParser.GazeData objects.
additionalData -- Additional data (if necessary).
-
GazeParser.Utility.
sortrows
(d, cols, order=None)¶ Matlab-like sort function.
- パラメータ
d -- an array to be sorted.
cols -- a list of columns used for sorting.
order -- a list of boolian values. Set True for ascending order and False for decending order.
- 戻り値
Indices.
-
GazeParser.Utility.
splitFilenames
(filenames)¶ Split return value of tkFileDialog.askopenfilenames. On Windows, tkFileDialog.askopenfilenames does not return list of file names but an unicode string. This function splits the unicode string into a list.
- パラメータ
filenames (unicode) -- return value of tkFileDialog.askopenfilenames.
- 戻り値
List of filenames.