diff options
-rw-r--r-- | src/argaze/utils/demo/plotters.py | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/src/argaze/utils/demo/plotters.py b/src/argaze/utils/demo/plotters.py index 53c35aa..48380f1 100644 --- a/src/argaze/utils/demo/plotters.py +++ b/src/argaze/utils/demo/plotters.py @@ -22,31 +22,14 @@ import logging from argaze import DataFeatures, GazeFeatures from argaze.utils import UtilsFeatures -@DataFeatures.timestamp -@DataFeatures.metrics -class ScanPathMetrics: - - duration: float - """Path duration (ms)""" - - steps: int - """Number of steps""" - - k: float - """K Coefficient""" - - nni: float - """Nearest Neighbor Index""" - - xxr: float - """Explore / Exploit ratio""" +import pandas class ScanPathAnalysisPlotter(DataFeatures.PipelineStepObject): @DataFeatures.PipelineStepInit def __init__(self, **kwargs): - self.__ts_metrics = DataFeatures.TimestampedObjectsList(ScanPathMetrics) + self.__ts_metrics = pandas.Dataframe() def on_look(self, timestamp, frame, exception): """Plot frame scan path metrics.""" @@ -55,19 +38,19 @@ class ScanPathAnalysisPlotter(DataFeatures.PipelineStepObject): analysis = frame.analysis() - metrics = ScanPathMetrics( - analysis['argaze.GazeAnalysis.Basic.ScanPathAnalyzer'].path_duration, - analysis['argaze.GazeAnalysis.Basic.ScanPathAnalyzer'].steps_number, - analysis['argaze.GazeAnalysis.KCoefficient.ScanPathAnalyzer'].K, - analysis['argaze.GazeAnalysis.NearestNeighborIndex.ScanPathAnalyzer'].nearest_neighbor_index, - analysis['argaze.GazeAnalysis.ExploreExploitRatio.ScanPathAnalyzer'].explore_exploit_ratio, - timestamp=timestamp - ) + metrics = { + "Timestamp (ms)": timestamp, + "Path duration (ms)": analysis['argaze.GazeAnalysis.Basic.ScanPathAnalyzer'].path_duration, + "Number of steps": analysis['argaze.GazeAnalysis.Basic.ScanPathAnalyzer'].steps_number, + "K Coefficient": analysis['argaze.GazeAnalysis.KCoefficient.ScanPathAnalyzer'].K, + "Nearest Neighbor Index": analysis['argaze.GazeAnalysis.NearestNeighborIndex.ScanPathAnalyzer'].nearest_neighbor_index, + "Explore / Exploit ratio": analysis['argaze.GazeAnalysis.ExploreExploitRatio.ScanPathAnalyzer'].explore_exploit_ratio + } self.__ts_metrics.append(metrics) # DEBUG - print(self.__ts_metrics.as_dataframe()) + print(self.__ts_metrics) ''' class AOIScanPathAnalysisPlotter(UtilsFeatures.FileWriter): |