From 47af08857f07801eae85bb9f9e50803161324bac Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Thu, 6 Jul 2023 18:15:26 +0200 Subject: Adding new current_gaze_movement attribute. --- .../GazeAnalysis/VelocityThresholdIdentification.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py index 7405ec6..2b29492 100644 --- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py +++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py @@ -217,6 +217,23 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): return GazeFeatures.UnvalidGazeMovement() @property + def current_gaze_movement(self) -> GazeMovementType: + + # It shouldn't have a current fixation and a current saccade at the same time + assert(not (len(self.__fixation_positions) > 0 and len(self.__saccade_positions) > 0)) + + if len(self.__fixation_positions) > 0: + + return Fixation(self.__fixation_positions) + + if len(self.__saccade_positions) > 0: + + return Saccade(self.__saccade_positions) + + # Always return unvalid gaze movement at least + return GazeFeatures.UnvalidGazeMovement() + + @property def current_fixation(self) -> FixationType: if len(self.__fixation_positions) > 0: -- cgit v1.1