diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/argaze/GazeAnalysis/Basic.py | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/src/argaze/GazeAnalysis/Basic.py b/src/argaze/GazeAnalysis/Basic.py index d6a8ca1..03b2878 100644 --- a/src/argaze/GazeAnalysis/Basic.py +++ b/src/argaze/GazeAnalysis/Basic.py @@ -22,17 +22,31 @@ class ScanPathAnalyzer(GazeFeatures.ScanPathAnalyzer): super().__init__() - self.__length = 0 + self.__steps_number = 0 + self.__step_fixation_durations_average = 0 def analyze(self, scan_path: GazeFeatures.ScanPathType): """Analyze scan path.""" - self.__length = len(scan_path) + self.__steps_number = len(scan_path) + + sum_fixation_durations = 0 + + for scan_step in scan_path: + + sum_fixation_durations += scan_step.fixation_duration + + self.__step_fixation_durations_average = sum_fixation_durations / self.__steps_number @property - def length(self) -> float: + def steps_number(self) -> float: - return self.__length + return self.__steps_number + + @property + def step_fixation_durations_average(self) -> float: + + return self.__step_fixation_durations_average @dataclass class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): @@ -42,14 +56,28 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): super().__init__() - self.__length = 0 + self.__steps_number = 0 + self.__step_fixation_durations_average = 0 - def analyze(self, scan_path: GazeFeatures.ScanPathType): - """Analyze scan path.""" + def analyze(self, aoi_scan_path: GazeFeatures.ScanPathType): + """Analyze aoi scan path.""" + + self.__steps_number = len(aoi_scan_path) + + sum_fixation_durations = 0 + + for aoi_scan_step in aoi_scan_path: + + sum_fixation_durations += aoi_scan_step.fixation_duration + + self.__step_fixation_durations_average = sum_fixation_durations / self.__steps_number + + @property + def steps_number(self) -> float: - self.__length = len(scan_path) + return self.__steps_number @property - def length(self) -> float: + def step_fixation_durations_average(self) -> float: - return self.__length
\ No newline at end of file + return self.__step_fixation_durations_average
\ No newline at end of file |