aboutsummaryrefslogtreecommitdiff
path: root/src/argaze
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-31 11:33:50 +0200
committerThéo de la Hogue2023-05-31 11:33:50 +0200
commit162617bc836e301f8ed1cd657bae11a1d5304bff (patch)
tree829a800f93b24d51e0c9c010ad422afab4e45acb /src/argaze
parent39e31eeca71d8023ec565ea7b375b02a8438d636 (diff)
downloadargaze-162617bc836e301f8ed1cd657bae11a1d5304bff.zip
argaze-162617bc836e301f8ed1cd657bae11a1d5304bff.tar.gz
argaze-162617bc836e301f8ed1cd657bae11a1d5304bff.tar.bz2
argaze-162617bc836e301f8ed1cd657bae11a1d5304bff.tar.xz
testing and fixing VelocityThresholdIdentification.
Diffstat (limited to 'src/argaze')
-rw-r--r--src/argaze/GazeAnalysis/VelocityThresholdIdentification.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
index 3c3d58f..1cf7859 100644
--- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
@@ -141,13 +141,16 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
self.__last_ts = ts
self.__last_position = gaze_position
+ # Get last movement
+ last_movement = self.current_saccade if len(self.__fixation_positions) == 0 else self.current_fixation
+
self.__fixation_positions = GazeFeatures.TimeStampedGazePositions()
self.__saccade_positions = GazeFeatures.TimeStampedGazePositions()
- return
+ return last_movement
# Velocity
- velocity = gaze_position.distance(self.__last_position) / (ts - self.__last_ts)
+ velocity = abs(gaze_position.distance(self.__last_position) / (ts - self.__last_ts))
# Remember last position
self.__last_ts = ts
@@ -168,7 +171,12 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
self.__fixation_positions = GazeFeatures.TimeStampedGazePositions()
# Output last fixation
- return last_fixation if not terminate else self.current_saccade
+ return last_fixation
+
+ # Identification must stop: ends with current saccade
+ if terminate:
+
+ return self.current_saccade
# Velocity is less or equals to threshold
else:
@@ -185,7 +193,12 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
self.__saccade_positions = GazeFeatures.TimeStampedGazePositions()
# Output last saccade
- return last_saccade if not terminate else self.current_fixation
+ return last_saccade
+
+ # Identification must stop: ends with current fixation
+ if terminate:
+
+ return self.current_fixation
@property
def current_fixation(self) -> FixationType:
@@ -198,5 +211,5 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
def current_saccade(self) -> SaccadeType:
if len(self.__saccade_positions) > 0:
-
+
return Saccade(self.__saccade_positions)