aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2022-12-13 10:54:11 +0100
committerThéo de la Hogue2022-12-13 10:54:11 +0100
commit097980e2c67ad81b1acbbc00707b141dd55397bf (patch)
tree9aae83febbabbec5a59899c5d380f8a8f6dc984e /src
parent447397a3703dd03982c464bce7d3c9cb4a6ced6b (diff)
downloadargaze-097980e2c67ad81b1acbbc00707b141dd55397bf.zip
argaze-097980e2c67ad81b1acbbc00707b141dd55397bf.tar.gz
argaze-097980e2c67ad81b1acbbc00707b141dd55397bf.tar.bz2
argaze-097980e2c67ad81b1acbbc00707b141dd55397bf.tar.xz
Adding message to unvalid gaze position.
Diffstat (limited to 'src')
-rw-r--r--src/argaze/GazeFeatures.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index dd07974..c3778bb 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -83,7 +83,9 @@ class GazePosition():
class UnvalidGazePosition(GazePosition):
"""Unvalid gaze position."""
- def __init__(self):
+ def __init__(self, message=None):
+
+ self.message = message
super().__init__((None, None), precision=None)
@@ -161,13 +163,6 @@ class Saccade(GazeMovement):
# Update frozen distance attribute
object.__setattr__(self, 'distance', distance)
-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
@@ -175,9 +170,9 @@ class TimeStampedGazeMovements(DataStructures.TimeStampedBuffer):
"""Define timestamped buffer to store gaze movements."""
def __setitem__(self, key, value: GazeMovement):
- """Force value to inherit from GazeMovement."""
+ """Force value to be or inherit from GazeMovement."""
- assert(type(value).__bases__[0] == Fixation or type(value).__bases__[0] == Saccade or type(value).__bases__[0] == UnknownGazeMovement)
+ assert(isinstance(value, GazeMovement) or type(value).__bases__[0] == Fixation or type(value).__bases__[0] == Saccade)
super().__setitem__(key, value)
@@ -243,7 +238,7 @@ class GazeMovementIdentifier():
ts_fixations = TimeStampedGazeMovements()
ts_saccades = TimeStampedGazeMovements()
- ts_unknown = TimeStampedGazeMovements()
+ ts_movements = TimeStampedGazeMovements()
ts_status = TimeStampedGazeStatus()
for gaze_movement in self(ts_gaze_positions):
@@ -272,13 +267,13 @@ class GazeMovementIdentifier():
start_ts, start_position = gaze_movement.positions.first
- ts_unknown[start_ts] = gaze_movement
+ ts_movements[start_ts] = gaze_movement
for ts, position in gaze_movement.positions.items():
- ts_status[ts] = GazeStatus.from_position(position, 'UnknownGazeMovement', len(ts_unknown))
+ ts_status[ts] = GazeStatus.from_position(position, 'GazeMovement', len(ts_movements))
- return ts_fixations, ts_saccades, ts_unknown, ts_status
+ return ts_fixations, ts_saccades, ts_movements, ts_status
@dataclass
class VisualScanStep():