From 4f32cdaad425acd1feb76ec1a04a2265e0319a03 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Mon, 3 Jul 2023 09:50:18 +0200 Subject: Adding a basic gaze analysis plugin to use as a placeholder to enable scan path in environment declaration. --- src/argaze/GazeAnalysis/Basic.py | 51 +++++++++++++++++++++++++++++++++++++ src/argaze/GazeAnalysis/__init__.py | 2 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/argaze/GazeAnalysis/Basic.py diff --git a/src/argaze/GazeAnalysis/Basic.py b/src/argaze/GazeAnalysis/Basic.py new file mode 100644 index 0000000..69e5793 --- /dev/null +++ b/src/argaze/GazeAnalysis/Basic.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python + +"""Implementation of basic analysis. +""" + +__author__ = "Théo de la Hogue" +__credits__ = [] +__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" +__license__ = "BSD" + +from dataclasses import dataclass + +from argaze import GazeFeatures + +import numpy + +@dataclass +class ScanPathAnalyzer(GazeFeatures.ScanPathAnalyzer): + """""" + + def __post_init__(self): + + self.__lenght = 0 + + def analyze(self, scan_path: GazeFeatures.ScanPathType): + """Analyze scan path.""" + + self.__lenght = len(scan_path) + + @property + def length(self) -> float: + + return self.__lenght + +@dataclass +class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): + """""" + + def __post_init__(self): + + self.__lenght = 0 + + def analyze(self, scan_path: GazeFeatures.ScanPathType): + """Analyze scan path.""" + + self.__lenght = len(scan_path) + + @property + def length(self) -> float: + + return self.__lenght \ No newline at end of file diff --git a/src/argaze/GazeAnalysis/__init__.py b/src/argaze/GazeAnalysis/__init__.py index 2bdb820..37c35ca 100644 --- a/src/argaze/GazeAnalysis/__init__.py +++ b/src/argaze/GazeAnalysis/__init__.py @@ -1,4 +1,4 @@ """ Various gaze movement identification and scan path analysis algorithms. """ -__all__ = ['DispersionThresholdIdentification', 'VelocityThresholdIdentification', 'TransitionMatrix', 'KCoefficient', 'LempelZivComplexity', 'NGram', 'Entropy', 'NearestNeighborIndex', 'ExploitExploreRatio'] \ No newline at end of file +__all__ = ['Basic', 'DispersionThresholdIdentification', 'VelocityThresholdIdentification', 'TransitionMatrix', 'KCoefficient', 'LempelZivComplexity', 'NGram', 'Entropy', 'NearestNeighborIndex', 'ExploitExploreRatio'] \ No newline at end of file -- cgit v1.1