diff options
Diffstat (limited to 'src/argaze/GazeAnalysis/Entropy.py')
-rw-r--r-- | src/argaze/GazeAnalysis/Entropy.py | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/argaze/GazeAnalysis/Entropy.py b/src/argaze/GazeAnalysis/Entropy.py index b9fa301..58617f7 100644 --- a/src/argaze/GazeAnalysis/Entropy.py +++ b/src/argaze/GazeAnalysis/Entropy.py @@ -17,16 +17,12 @@ __credits__ = [] __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)" __license__ = "GPLv3" -from typing import Tuple -from dataclasses import dataclass, field - from argaze import GazeFeatures, DataFeatures from argaze.GazeAnalysis import TransitionMatrix import pandas import numpy -@dataclass class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): """Implementation of entropy algorithm as described in: @@ -36,20 +32,30 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): [https://doi.org/10.1145/2578153.2578176](https://doi.org/10.1145/2578153.2578176) """ - transition_matrix_analyzer: TransitionMatrix.AOIScanPathAnalyzer = field(default_factory=TransitionMatrix.AOIScanPathAnalyzer) - """To get its transition_matrix_probabilities result. - - !!! warning "Mandatory" - TransitionMatrix analyzer have to be loaded before. - """ + @DataFeatures.PipelineStepInit + def __init__(self, **kwargs): - def __post_init__(self): - - super().__init__() + super().__init__(**kwargs) + self.__transition_matrix_analyzer = None self.__stationary_entropy = -1 self.__transition_entropy = -1 + @property + def transition_matrix_analyzer(self) -> TransitionMatrix.AOIScanPathAnalyzer: + """Bind to TransitionMatrix analyzer to get its transition_matrix_probabilities. + + !!! warning "Mandatory" + TransitionMatrix analyzer have to be loaded before. + """ + + return self.__transition_matrix_analyzer + + @transition_matrix_analyzer.setter + def transition_matrix_analyzer(self, transition_matrix_analyzer: TransitionMatrix.AOIScanPathAnalyzer): + + self.__transition_matrix_analyzer = transition_matrix_analyzer + @DataFeatures.PipelineStepMethod def analyze(self, aoi_scan_path: GazeFeatures.AOIScanPathType): |