diff options
author | Théo de la Hogue | 2022-12-10 00:01:04 +0100 |
---|---|---|
committer | Théo de la Hogue | 2022-12-10 00:01:04 +0100 |
commit | d74c6c9ffc05a13ed7485ddcbdfa18ad5b6bf59b (patch) | |
tree | 57c537648961af64b357c0b29af166b67faf9815 | |
parent | ff74c08b26885c87fea932bc808ff877604aa0fd (diff) | |
download | argaze-d74c6c9ffc05a13ed7485ddcbdfa18ad5b6bf59b.zip argaze-d74c6c9ffc05a13ed7485ddcbdfa18ad5b6bf59b.tar.gz argaze-d74c6c9ffc05a13ed7485ddcbdfa18ad5b6bf59b.tar.bz2 argaze-d74c6c9ffc05a13ed7485ddcbdfa18ad5b6bf59b.tar.xz |
More work to identify saccade and unknown movement.
-rw-r--r-- | src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py index b60291c..62e8723 100644 --- a/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py +++ b/src/argaze/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py @@ -212,31 +212,39 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier): # Is there a new movement ? if len(moving_gaze_positions) > 0: - # Check first and last gaze position of the moving positions buffer + # Compare first and last gaze position of the moving positions buffer to last and new fixation start_position_ts, start_position = moving_gaze_positions.first end_position_ts, end_position = moving_gaze_positions.last - if not moving_gaze_positions.first[0] > self.__last_fixation.positions.last[0]: - print('first moving_gaze_positions not after last self.__last_fixation.positions') - print(moving_gaze_positions.first[0], self.__last_fixation.positions.last[0]) + last_ts, last_position = self.__last_fixation.positions.last + new_ts, new_position = new_fixation.positions.first - if not moving_gaze_positions.last[0] < new_fixation.positions.first[0]: - print('last moving_gaze_positions not before first new_fixation.positions') - print(moving_gaze_positions.last[0], new_fixation.positions.first[0]) - - # Saccade shouldn't be longer than fixation + # Saccade conditions: + # - should be between two fixations + # - shouldn't be longer than fixation # TODO : add a saccade duration threshold attribute ? - if end_position_ts - start_position_ts < self.duration_threshold: + if start_position_ts > last_ts and end_position_ts < new_ts and last_ts - new_ts <= self.duration_threshold: - yield Saccade(moving_gaze_positions) + saccade_gaze_positions = GazeFeatures.TimeStampedGazePositions() + saccade_gaze_positions[last_ts] = last_position + saccade_gaze_positions.append(moving_gaze_positions) + saccade_gaze_positions[new_ts] = new_position + + yield Saccade(saccade_gaze_positions) - # This movement is unknown + # Otherwise, this movement is unknown else: - # This unknown movement should be dispersed - assert(Fixation(moving_gaze_positions).dispersion > self.dispersion_threshold) + # Does this unknown movement an unmatched fixation ? + unmatched_fixation = Fixation(moving_gaze_positions) + + if unmatched_fixation.dispersion < self.dispersion_threshold: + + yield unmatched_fixation + + else: - yield UnknownGazeMovement(moving_gaze_positions) + yield UnknownGazeMovement(moving_gaze_positions) # Forget former moving gaze positions moving_gaze_positions = GazeFeatures.TimeStampedGazePositions() |