diff options
Diffstat (limited to 'src/argaze/GazeFeatures.py')
-rw-r--r-- | src/argaze/GazeFeatures.py | 21 |
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(): |