aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze.test/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py15
-rw-r--r--src/argaze/GazeFeatures.py17
2 files changed, 10 insertions, 22 deletions
diff --git a/src/argaze.test/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py b/src/argaze.test/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py
index b342ea9..c732a6f 100644
--- a/src/argaze.test/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py
+++ b/src/argaze.test/GazeAnalysis/DispersionBasedGazeMovementIdentifier.py
@@ -96,12 +96,11 @@ class TestDispersionBasedGazeMovementIdentifierClass(unittest.TestCase):
ts_gaze_positions = build_gaze_fixation(size, center, deviation_max, start_time, min_time, max_time)
gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(deviation_max_threshold=deviation_max, duration_min_threshold=max_time*2)
- ts_fixations, ts_saccades, ts_movements, ts_status = gaze_movement_identifier.identify(ts_gaze_positions)
+ ts_fixations, ts_saccades, ts_status = gaze_movement_identifier.browse(ts_gaze_positions)
# Check result size
self.assertEqual(len(ts_fixations), 1)
self.assertEqual(len(ts_saccades), 0)
- self.assertEqual(len(ts_movements), 0)
self.assertEqual(len(ts_status), size)
# Check fixation
@@ -129,12 +128,11 @@ class TestDispersionBasedGazeMovementIdentifierClass(unittest.TestCase):
ts_gaze_positions = ts_gaze_positions_A.append(ts_gaze_positions_B)
gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(deviation_max_threshold=deviation_max, duration_min_threshold=max_time*2)
- ts_fixations, ts_saccades, ts_movements, ts_status = gaze_movement_identifier.identify(ts_gaze_positions)
+ ts_fixations, ts_saccades, ts_status = gaze_movement_identifier.browse(ts_gaze_positions)
# Check result size
self.assertEqual(len(ts_fixations), 2)
self.assertEqual(len(ts_saccades), 1)
- self.assertEqual(len(ts_movements), 0)
self.assertEqual(len(ts_status), size*2)
# Check first fixation
@@ -182,12 +180,11 @@ class TestDispersionBasedGazeMovementIdentifierClass(unittest.TestCase):
ts_gaze_positions = ts_gaze_positions_A.append(ts_move_positions).append(ts_gaze_positions_B)
gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(deviation_max_threshold=deviation_max, duration_min_threshold=max_time*2)
- ts_fixations, ts_saccades, ts_movements, ts_status = gaze_movement_identifier.identify(ts_gaze_positions)
+ ts_fixations, ts_saccades, ts_status = gaze_movement_identifier.browse(ts_gaze_positions)
# Check result size
self.assertEqual(len(ts_fixations), 2)
self.assertEqual(len(ts_saccades), 1)
- self.assertEqual(len(ts_movements), 0)
self.assertEqual(len(ts_status), size*2 + move)
# Check first fixation
@@ -227,12 +224,11 @@ class TestDispersionBasedGazeMovementIdentifierClass(unittest.TestCase):
ts_gaze_positions = build_gaze_fixation(size, center, deviation_max, start_time, min_time, max_time, validity)
gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(deviation_max_threshold=deviation_max, duration_min_threshold=max_time*2)
- ts_fixations, ts_saccades, ts_movements, ts_status = gaze_movement_identifier.identify(ts_gaze_positions)
+ ts_fixations, ts_saccades, ts_status = gaze_movement_identifier.browse(ts_gaze_positions)
# Check result size
self.assertEqual(len(ts_fixations), 1)
self.assertEqual(len(ts_saccades), 0)
- self.assertEqual(len(ts_movements), 0)
self.assertEqual(len(ts_status), size-3)
# Check fixation
@@ -288,12 +284,11 @@ class TestDispersionBasedGazeMovementIdentifierClass(unittest.TestCase):
ts_gaze_positions = ts_gaze_positions_A.append(ts_gaze_positions_B)
gaze_movement_identifier = DispersionBasedGazeMovementIdentifier.GazeMovementIdentifier(deviation_max_threshold=deviation_max, duration_min_threshold=max_time*2)
- ts_fixations, ts_saccades, ts_movements, ts_status = gaze_movement_identifier.identify(ts_gaze_positions)
+ ts_fixations, ts_saccades, ts_status = gaze_movement_identifier.browse(ts_gaze_positions)
# Check result size
self.assertEqual(len(ts_fixations), 1)
self.assertEqual(len(ts_saccades), 0)
- self.assertEqual(len(ts_movements), 0)
self.assertEqual(len(ts_status), size*2)
# Check unique fixation
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index 40ce77b..83835d2 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -237,16 +237,15 @@ class GazeMovementIdentifier():
"""Abstract class to define what should provide a gaze movement identifier."""
def identify(self, ts, gaze_position) -> GazeMovementType:
- raise NotImplementedError('identify_position() method not implemented')
+ raise NotImplementedError('identify() method not implemented')
- def __call__(self, ts_gaze_positions: TimeStampedGazePositions) -> Tuple[TimeStampedGazeMovementsType, TimeStampedGazeMovementsType, TimeStampedGazeStatusType]:
- """Identifiy fixations and saccades from timestamped gaze positions."""
+ def browse(self, ts_gaze_positions: TimeStampedGazePositions) -> Tuple[TimeStampedGazeMovementsType, TimeStampedGazeMovementsType, TimeStampedGazeStatusType]:
+ """Identify fixations and saccades browsing timestamped gaze positions."""
assert(type(ts_gaze_positions) == TimeStampedGazePositions)
ts_fixations = TimeStampedGazeMovements()
ts_saccades = TimeStampedGazeMovements()
- ts_movements = TimeStampedGazeMovements()
ts_status = TimeStampedGazeStatus()
for ts, gaze_position in ts_gaze_positions.items():
@@ -275,15 +274,9 @@ class GazeMovementIdentifier():
else:
- start_ts, start_position = gaze_movement.positions.first
-
- ts_movements[start_ts] = gaze_movement
-
- for ts, position in gaze_movement.positions.items():
-
- ts_status[ts] = GazeStatus.from_position(position, 'GazeMovement', len(ts_movements))
+ continue
- return ts_fixations, ts_saccades, ts_movements, ts_status
+ return ts_fixations, ts_saccades, ts_status
@dataclass
class VisualScanStep():