diff options
-rw-r--r-- | src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py index 19f7fef..1364c99 100644 --- a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py +++ b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py @@ -117,7 +117,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): # Append this last out position to the valid gaze positions selection valid_gaze_positions[last_new_ts] = last_new_position - + yield self.__last_fixation self.__last_fixation = None @@ -248,9 +248,6 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): # Edit last movement gaze position movement_gaze_positions[stop_movement_ts] = stop_position - # End of inter fixations movement edition - #print(f'Inter: <{start_movement_ts} {stop_movement_ts}>, duration: {stop_movement_ts - start_movement_ts}, length: {len(movement_gaze_positions)}') - # Does new fixation overlap last fixation? if self.__last_fixation.overlap(new_fixation): @@ -293,11 +290,30 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): unmatched_gaze_positions = GazeFeatures.TimeStampedGazePositions() # First fixation is stored to allow further merging + # The movement before is outputed else: self.__last_fixation = new_fixation - # Forget former unmatched gaze positions + # Is there unmatched gaze positions? + if len(unmatched_gaze_positions) > 0: + + start_movement_ts, _ = unmatched_gaze_positions.first + stop_movement_ts, _ = unmatched_gaze_positions.last + + # Short time between fixations : this movement is a saccade + if stop_movement_ts - start_movement_ts <= self.duration_min_threshold: + + # Output saccade + yield Saccade(unmatched_gaze_positions) + + # Too much time between fixations: this movement is unknown + else: + + # Output unknown movement + yield GazeFeatures.GazeMovement(unmatched_gaze_positions) + + # In any case, forget former unmatched gaze positions unmatched_gaze_positions = GazeFeatures.TimeStampedGazePositions() # Dispersion too wide: |