From d0d05aed72759b0fcbb15ed3895636ef3c0c2611 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 10 May 2023 10:24:04 +0200 Subject: Adding an aoi attribute to VisualScanStepError class. --- src/argaze/GazeFeatures.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') 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): -- cgit v1.1