aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/PupillFeatures.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/argaze/PupillFeatures.py b/src/argaze/PupillFeatures.py
index b150f47..5fc578c 100644
--- a/src/argaze/PupillFeatures.py
+++ b/src/argaze/PupillFeatures.py
@@ -6,7 +6,6 @@ __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
__license__ = "BSD"
from typing import TypeVar
-from dataclasses import dataclass, field
import json
import math
@@ -44,9 +43,6 @@ class TimeStampedPupillDiameters(DataFeatures.TimestampedObjectsList):
DataFeatures.TimestampedObjectsList.__init__(self, PupillDiameter, pupill_diameters)
-TimeStampedBufferType = TypeVar('TimeStampedBuffer', bound="TimeStampedBuffer")
-# Type definition for type annotation convenience
-
class PupillDiameterAnalyzer(DataFeatures.PipelineStepObject):
"""Abstract class to define what should provide a pupill diameter analyser."""
@@ -56,12 +52,20 @@ class PupillDiameterAnalyzer(DataFeatures.PipelineStepObject):
raise NotImplementedError('analyze() method not implemented')
- def browse(self, ts_pupill_diameters: TimeStampedPupillDiameters) -> TimeStampedBufferType:
- """Analyze by browsing timestamped pupill diameters."""
+ def browse(self, ts_pupill_diameters: TimeStampedPupillDiameters) -> list:
+ """Analyze by browsing timestamped pupill diameters.
+
+ Parameters:
+ ts_pupill_diameters: list of timestamped pupill diameters.
+
+ Returns:
+ ts_analysis: list of (timestamp, analysis).
+ """
assert(type(ts_pupill_diameters) == TimeStampedPupillDiameters)
- ts_analyzis = DataFeatures.TimeStampedBuffer()
+ # TODO: Have TimestampedDataDictionary and TimestampedDataDictionaryList classes?
+ ts_analyzis = []
# Iterate on pupill diameters
for pupill_diameter in ts_pupill_diameters:
@@ -70,6 +74,6 @@ class PupillDiameterAnalyzer(DataFeatures.PipelineStepObject):
if analysis is not None:
- ts_analyzis[ts] = analysis
+ ts_analyzis.append((pupill_diameter.timestamp, analysis))
return ts_analyzis