GazeParser.TrajectoryCurvature
- tools for getting trajectory curvature¶
注釈
This module is under construction. Functions have not been tested.
-
GazeParser.TrajectoryCurvature.
getAreaCurvature
(traj, absolute=False, ignoreNaN=False)¶ Get area curvature of a trajectory. The area curvature is defined as the area surrounded by the X axis and the tracjectory. The origin and direction of the trajectory must be normalized in advance.
- パラメータ
traj (numpy.ndarray) -- Nomalized trajectory (binocular data is not currently supported).
absolute (bool) -- If False, the area below the X axis has a negative value. Default value is False.
ignoreNone (bool) -- If True, NaNs in the trajectory are removed before calculating area curvature. Default value is False.
-
GazeParser.TrajectoryCurvature.
getInitialDirection
(traj, index, unit='rad')¶ Get the initila direction of the trajectory. The origin and direction of the trajectory must be normalized in advance.
- パラメータ
traj (numpy.ndarray) -- Nomalized trajectory (binocular data is not currently supported).
index (int) -- Specify which sample is used to calculate direction. For example, the third sample is used if this parameter is 2. Note that the index of the origin is zero.
unit -- Specify unit of the returned value ('deg' or 'rad').
-
GazeParser.TrajectoryCurvature.
getMaximumDeviation
(traj)¶ Get maximum deviation of trajectory from the X axis. The origin and direction of the trajectory must be normalized in advance.
- パラメータ
traj (numpy.ndarray) -- Nomalized trajectory (binocular data is not currently supported).
-
GazeParser.TrajectoryCurvature.
getRotatedTrajectory
(sac, refPoint=None, refPointRelative=None, rot=None, unit='rad', normalize=0, origin=(0, 0))¶ Rotate, shift and normalize trajectory. Rotation can be specified in three ways.
If 'refPoint' is given, saccade trajectory is rotated so that the end point of the trajectory points to the direction of 'refPoint'. For example, suppose that saccade trajectory starts from (100, 120) and (100, 0) is given as 'refPoint'. In this case, the rotated trajectory points to the direction parallel to the Y axis (note that X component of the origin of the trajectory and 'refPoint' are the same value).
'refPointRelative' is similar to 'refPoint' except that the value is interpreted as indicating the point relative to the origin of the saccade trajectory. For example, suppose that saccade trajectory starts from (100, 120) and (100, 0) is given as 'refPointRelative'. In this case, the rotated trajectory points to the direction parallel to the X axis.
If you want to specify the angle of rotation directly, set the value to the parameter 'rot'. Unit of the 'rot' is radian in default. If you prefer to use degree as the unit, set 'deg' to the parameter 'unit'.
'refPoint', refPointRelative' and 'rot' can not be specified simultaneously.
The trajectory is shifted so that the origin of the trajectory matches to (0, 0). If it is preferable that the origin of the rotated trajectory is the same to that of the original trajectory, set 'original' to the parameter 'origin'.
- パラメータ
sac -- An instance of
SaccadeData
or an an array of saccade trajectory.refPoint -- The reference point for rotation. See above for detail.
refPointRelative -- The reference point for rotation. See above for detail.
rot (float) -- The angle of rotation.
unit -- Specify unit of the rotation angle ('deg' or 'rad').
normalize (float) -- If this value is not zero, the distance between the start and the end point of the trajectory is normalized to the given value. If zero, the distance is the same to that of the original trajectory. Default value is zero.
origin -- Specify the origin of the rotated trajectory. If the value is 'original', the origin of the rotated trajectory is the same as that of the original trajectory. If a tuple of two values are given, the rotated trajectory is shifeted by these values. Note that this parameter does NOT specify the center of rotation.