aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-10 10:24:04 +0200
committerThéo de la Hogue2023-05-10 10:24:04 +0200
commitd0d05aed72759b0fcbb15ed3895636ef3c0c2611 (patch)
tree6a3aa5672ad0f79dc2967fa8e4cdcf1b947c795e
parente878adc45ce77cf5d088036a3988bfea909baf1c (diff)
downloadargaze-d0d05aed72759b0fcbb15ed3895636ef3c0c2611.zip
argaze-d0d05aed72759b0fcbb15ed3895636ef3c0c2611.tar.gz
argaze-d0d05aed72759b0fcbb15ed3895636ef3c0c2611.tar.bz2
argaze-d0d05aed72759b0fcbb15ed3895636ef3c0c2611.tar.xz
Adding an aoi attribute to VisualScanStepError class.
-rw-r--r--src/argaze/GazeFeatures.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 7f292ee..3daea8f 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -292,10 +292,12 @@ VisualScanStepType = TypeVar('VisualScanStep', bound="VisualScanStep")
class VisualScanStepError(Exception):
"""Exception raised at VisualScanStepError creation if a visual scan step doesn't start by a fixation or doesn't end by a saccade."""
- def __init__(self, message):
+ def __init__(self, message, aoi=''):
super().__init__(message)
+ self.aoi = aoi
+
@dataclass(frozen=True)
class VisualScanStep():
"""Define a visual scan step as a set of successive gaze movements onto a same AOI.
@@ -316,12 +318,12 @@ class VisualScanStep():
# First movement have to be a fixation
if type(self.first_fixation).__bases__[0] != Fixation:
- raise VisualScanStepError('First step movement is not a fixation')
+ raise VisualScanStepError('First step movement is not a fixation', self.aoi)
# Last movement have to be a saccade
if type(self.last_saccade).__bases__[0] != Saccade:
- raise VisualScanStepError('Last step movement is not a saccade')
+ raise VisualScanStepError('Last step movement is not a saccade', self.aoi)
@property
def first_fixation(self):