aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-12-09 23:04:03 +0100
committerThéo de la Hogue2022-12-09 23:04:03 +0100
commita9c7ba832d26b869aa442e4665f38295b311aed5 (patch)
treeb9f99a1235b902739e5b20ea2138c67cf1c5d93d /src
parentba315fb98cec40bdbf2a1a607c7eb4eaef6c0331 (diff)
downloadargaze-a9c7ba832d26b869aa442e4665f38295b311aed5.zip
argaze-a9c7ba832d26b869aa442e4665f38295b311aed5.tar.gz
argaze-a9c7ba832d26b869aa442e4665f38295b311aed5.tar.bz2
argaze-a9c7ba832d26b869aa442e4665f38295b311aed5.tar.xz
Adding a new abstract UnknownGazeMovement.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/GazeFeatures.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 4d2ef80..e5dfdf0 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -150,6 +150,13 @@ class Saccade(GazeMovement):
super().__post_init__()
+class UnknownGazeMovement(GazeMovement):
+ """Define abstract unknown gaze movement."""
+
+ def __post_init__(self):
+
+ super().__post_init__()
+
TimeStampedGazeMovementsType = TypeVar('TimeStampedGazeMovements', bound="TimeStampedGazeMovements")
# Type definition for type annotation convenience
@@ -159,7 +166,7 @@ class TimeStampedGazeMovements(DataStructures.TimeStampedBuffer):
def __setitem__(self, key, value: GazeMovement):
"""Force value to inherit from GazeMovement."""
- assert(type(value).__bases__[0] == Fixation or type(value).__bases__[0] == Saccade)
+ assert(type(value).__bases__[0] == Fixation or type(value).__bases__[0] == Saccade or type(value).__bases__[0] == UnknownGazeMovement)
super().__setitem__(key, value)
@@ -225,6 +232,7 @@ class GazeMovementIdentifier():
ts_fixations = TimeStampedGazeMovements()
ts_saccades = TimeStampedGazeMovements()
+ ts_unknown = TimeStampedGazeMovements()
ts_status = TimeStampedGazeStatus()
for gaze_movement in self(ts_gaze_positions):
@@ -250,9 +258,16 @@ class GazeMovementIdentifier():
ts_status[end_ts] = GazeStatus.from_position(end_position, 'Saccade', len(ts_saccades))
else:
- continue
- return ts_fixations, ts_saccades, ts_status
+ start_ts, start_position = gaze_movement.positions.first
+
+ ts_unknown[start_ts] = gaze_movement
+
+ for ts, position in gaze_movement.positions.items():
+
+ ts_status[ts] = GazeStatus.from_position(position, 'UnknownGazeMovement', len(ts_unknown))
+
+ return ts_fixations, ts_saccades, ts_unknown, ts_status
@dataclass
class VisualScanStep():