diff options
-rw-r--r-- | src/argaze/GazeFeatures.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index e5dfdf0..d829e92 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -146,10 +146,21 @@ class Fixation(GazeMovement): class Saccade(GazeMovement): """Define abstract saccade as gaze movement.""" + distance: float = field(init=False) + """Inferred distance from first and last positions.""" + def __post_init__(self): super().__post_init__() + _, start_position = self.positions.first + _, end_position = self.positions.last + + distance = numpy.linalg.norm( numpy.array(start_position.value) - numpy.array(end_position.value)) + + # Update frozen distance attribute + object.__setattr__(self, 'distance', distance) + class UnknownGazeMovement(GazeMovement): """Define abstract unknown gaze movement.""" |