From 17d247f0652afcc68b9477bce718e91c850d5499 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Thu, 6 Jul 2023 18:17:07 +0200 Subject: Adding new current_gaze_movement attribute. --- .../GazeAnalysis/DispersionThresholdIdentification.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py index 350a940..f29858a 100644 --- a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py +++ b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py @@ -203,6 +203,22 @@ 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: @@ -216,7 +232,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): def current_saccade(self) -> SaccadeType: if len(self.__saccade_positions) > 0: - + return Saccade(self.__saccade_positions) # Always return unvalid gaze movement at least -- cgit v1.1