aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-07-06 15:54:27 +0200
committerThéo de la Hogue2023-07-06 15:54:27 +0200
commita483e0544221504cf6aba91124ac8d870208a279 (patch)
treefaaa56457c1cac8eb92828df2ae34c26b7c1a2e7
parent717452611747ab98a5e94c1f90afcc2854923c68 (diff)
downloadargaze-a483e0544221504cf6aba91124ac8d870208a279.zip
argaze-a483e0544221504cf6aba91124ac8d870208a279.tar.gz
argaze-a483e0544221504cf6aba91124ac8d870208a279.tar.bz2
argaze-a483e0544221504cf6aba91124ac8d870208a279.tar.xz
Finishing gaze movement outputted at terminate time.
-rw-r--r--src/argaze/GazeAnalysis/DispersionThresholdIdentification.py4
-rw-r--r--src/argaze/GazeAnalysis/VelocityThresholdIdentification.py4
-rw-r--r--src/argaze/GazeFeatures.py4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
index 3015d51..230e402 100644
--- a/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/DispersionThresholdIdentification.py
@@ -178,7 +178,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
self.__fixation_positions = self.__valid_positions.copy()
# Output last saccade
- return last_saccade if not terminate else self.current_fixation
+ return last_saccade if not terminate else self.current_fixation.finish()
# Valid gaze positions deviation too wide while identifying fixation
elif len(self.__fixation_positions) > 0:
@@ -199,7 +199,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
self.__valid_positions = GazeFeatures.TimeStampedGazePositions()
# Output last fixation
- return last_fixation if not terminate else self.current_saccade
+ return last_fixation if not terminate else self.current_saccade.finish()
# Valid gaze positions deviation too wide while identifying saccade (or not)
else:
diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
index 9a645c7..a514ea7 100644
--- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
@@ -194,7 +194,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
# Identification must stop: ends with current saccade
if terminate:
- return self.current_saccade
+ return self.current_saccade.finish()
# Velocity is less or equals to threshold
else:
@@ -220,7 +220,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
# Identification must stop: ends with current fixation
if terminate:
- return self.current_fixation
+ return self.current_fixation.finish()
# Always return unvalid gaze movement at least
return GazeFeatures.UnvalidGazeMovement()
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 855b90b..ab0fb5d 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -270,12 +270,14 @@ class GazeMovement():
return len(self.positions) > 0
- def finish(self):
+ def finish(self) -> GazeMovementType:
"""Set gaze movement as finished"""
# Update frozen finished attribute
object.__setattr__(self, 'finished', True)
+ return self
+
def draw_positions(self, image: numpy.array, color=(0, 55, 55)):
"""Draw gaze movement positions"""