diff options
author | Théo de la Hogue | 2022-12-10 18:31:04 +0100 |
---|---|---|
committer | Théo de la Hogue | 2022-12-10 18:31:04 +0100 |
commit | 78419533cbeb31d5d7f5418b72f0caf31f40a159 (patch) | |
tree | 7c37190b9b375e4788352cf8a2b5d01ee2a8c2ce /src | |
parent | 1b9957ab30697c57370469b5334e48ce4fe9202e (diff) | |
download | argaze-78419533cbeb31d5d7f5418b72f0caf31f40a159.zip argaze-78419533cbeb31d5d7f5418b72f0caf31f40a159.tar.gz argaze-78419533cbeb31d5d7f5418b72f0caf31f40a159.tar.bz2 argaze-78419533cbeb31d5d7f5418b72f0caf31f40a159.tar.xz |
Adding Saccade distance attribute.
Diffstat (limited to 'src')
-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.""" |