aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-24 14:07:59 +0200
committerThéo de la Hogue2023-05-24 14:07:59 +0200
commit8c412d2d6d50f5e46d008eb75e33338b96f4fe82 (patch)
treee8ebb247b0403d7f5d1afd9833b94c0a2a1b8e36
parent11b3b45ce4c780bb04f0e9c604b8eef6a5d998cc (diff)
downloadargaze-8c412d2d6d50f5e46d008eb75e33338b96f4fe82.zip
argaze-8c412d2d6d50f5e46d008eb75e33338b96f4fe82.tar.gz
argaze-8c412d2d6d50f5e46d008eb75e33338b96f4fe82.tar.bz2
argaze-8c412d2d6d50f5e46d008eb75e33338b96f4fe82.tar.xz
Ignoring consecutives fixations keeping only the last one.
-rw-r--r--src/argaze/GazeFeatures.py25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index d17d5b5..33b9ef8 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -367,7 +367,7 @@ class ScanStepError(Exception):
@dataclass(frozen=True)
class ScanStep():
- """Define a scan step as a pair of successive fixation and saccade.
+ """Define a scan step as a fixation and a consecutive saccade.
.. warning::
Scan step have to start by a fixation and then end by a saccade."""
@@ -413,7 +413,7 @@ class ScanPath(list):
self.__last_fixation = None
- def append_saccade(self, ts, saccade):
+ def append_saccade(self, ts, saccade) -> ScanStepType:
"""Append new saccade to scan path and return last new scan step if one have been created."""
# Ignore saccade if no fixation came before
@@ -435,27 +435,12 @@ class ScanPath(list):
# Clear last fixation
self.__last_fixation = None
- def append_fixation(self, ts, fixation) -> bool:
+ def append_fixation(self, ts, fixation):
"""Append new fixation to scan path.
-
.. warning::
- It could raise ScanStepError"""
-
- # No fixation came before
- if self.__last_fixation == None:
-
- self.__last_fixation = fixation
-
- # Merge successive fixations
- else:
-
- try:
- self.__last_fixation.merge(fixation)
-
- # Merge method not implemented for this kind of fixation
- except NotImplementedError as e:
+ Consecutives fixations are ignored keeping the last fixation"""
- print(e)
+ self.__last_fixation = fixation
def draw(self, frame, fixation_color=(255, 255, 255), saccade_color=(255, 255, 255), deepness=0):
"""Draw scan path into frame."""