From 63e9efb0d38d6f13df7de85a2bbd143809b64ccc Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 20 Apr 2022 16:21:06 +0200 Subject: Adding frames member to visual scan step. --- src/argaze/GazeFeatures.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index e132849..a04e511 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -194,11 +194,11 @@ class DispersionBasedFixationIdentifier(FixationIdentifier): return -1, None class VisualScanStep(DataStructures.DictObject): - """Define a visual scan step as a duration and an area of interest.""" + """Define a visual scan step as a duration, the name of the area of interest and all its frames during the step.""" - def __init__(self, duration, aoi): + def __init__(self, duration, aoi, frames = []): - super().__init__(type(self).__name__, **{'duration': duration, 'aoi': aoi}) + super().__init__(type(self).__name__, **{'duration': duration, 'aoi': aoi, 'frames': frames}) class TimeStampedVisualScanSteps(DataStructures.TimeStampedBuffer): """Define timestamped buffer to store visual scan steps.""" @@ -262,26 +262,32 @@ class PointerBasedVisualScan(VisualScanGenerator): for name in aoi_scene_current.areas(): - aoi_looked = aoi_scene_current[name].pointer != None + aoi = aoi_scene_current[name] + aoi_looked = aoi.pointer != None if aoi_looked: if not name in self.__start_dict.keys(): # aoi starts to be looked - self.__start_dict[name] = ts_current + self.__start_dict[name] = { + 'start': ts_current, + 'frames': DataStructures.TimeStampedBuffer() + } + + # store current aoi + self.__start_dict[name]['frames'][ts_current] = aoi elif name in self.__start_dict.keys(): + ts_start = self.__start_dict[name]['start'] + # aoi stops to be looked - ts_start = self.__start_dict[name] - duration = ts_current - ts_start + yield ts_start, VisualScanStep(ts_current - ts_start, name, self.__start_dict[name]['frames']) # forget the aoi del self.__start_dict[name] - yield ts_start, VisualScanStep(duration, name) - class FixationBasedVisualScan(VisualScanGenerator): """Build visual scan on the basis of timestamped fixations.""" -- cgit v1.1