From 511f641239ee40f9fc142c9d2873298924e4bc41 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 20 Feb 2024 14:56:29 +0100 Subject: Overwritting list clear method to correctly clear transition matrix and sequence when clearing aoi scan path. --- src/argaze/GazeFeatures.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index 81a87c8..cfd7419 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -979,6 +979,20 @@ class AOIScanPath(list): self.__duration = 0 + def clear(self): + """Clear aoi scan steps list, letter sequence and transition matrix.""" + + super().clear() + + self.__movements = TimeStampedGazeMovements() + self.__current_aoi = '' + self.__index = ord('A') + self.__aoi_letter = {} + self.__letter_aoi = {} + + size = len(self.__expected_aoi) + self.__transition_matrix = pandas.DataFrame(numpy.zeros((size, size)), index=self.__expected_aoi, columns=self.__expected_aoi) + @property def duration(self) -> float: """Sum of all scan steps duration""" @@ -1043,20 +1057,12 @@ class AOIScanPath(list): !!! warning This will clear the AOIScanPath """ - self.clear() - + self.__expected_aoi = [OutsideAOI] self.__expected_aoi += expected_aoi - self.__movements = TimeStampedGazeMovements() - self.__current_aoi = '' - self.__index = ord('A') - self.__aoi_letter = {} - self.__letter_aoi = {} - - size = len(self.__expected_aoi) - self.__transition_matrix = pandas.DataFrame(numpy.zeros((size, size)), index=self.__expected_aoi, columns=self.__expected_aoi) - + self.clear() + @property def current_aoi(self): """AOI name of aoi scan step under construction""" -- cgit v1.1