diff options
author | Théo de la Hogue | 2022-11-23 11:56:30 +0100 |
---|---|---|
committer | Théo de la Hogue | 2022-11-23 11:56:30 +0100 |
commit | 1bc991f8bbe59a5a487ad347022ac5ee891bbc58 (patch) | |
tree | 6b2724753f440b06a847ef3b12eb8668437794d3 | |
parent | 66dee98df2163890b43476e2954c547768c5b491 (diff) | |
download | argaze-1bc991f8bbe59a5a487ad347022ac5ee891bbc58.zip argaze-1bc991f8bbe59a5a487ad347022ac5ee891bbc58.tar.gz argaze-1bc991f8bbe59a5a487ad347022ac5ee891bbc58.tar.bz2 argaze-1bc991f8bbe59a5a487ad347022ac5ee891bbc58.tar.xz |
Renaming Movement into GazeMovement.
-rw-r--r-- | src/argaze/GazeFeatures.py | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index f7e8c01..1e7ba9b 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -88,8 +88,8 @@ class TimeStampedGazePositions(DataStructures.TimeStampedBuffer): super().__setitem__(key, value) @dataclass -class Movement(): - """Define abstract movement class as a buffer of timestamped positions.""" +class GazeMovement(): + """Define abstract gaze movement class as a buffer of timestamped positions.""" positions: TimeStampedGazePositions """All timestamp gaze positions.""" @@ -104,34 +104,34 @@ class Movement(): self.duration = round(end_position_ts - start_position_ts) -Fixation = Movement -"""Define abstract fixation as movement.""" +Fixation = GazeMovement +"""Define abstract fixation as gaze movement.""" -Saccade = Movement -"""Define abstract saccade as movement.""" +Saccade = GazeMovement +"""Define abstract saccade as gaze movement.""" -class TimeStampedMovements(DataStructures.TimeStampedBuffer): - """Define timestamped buffer to store movements.""" +class TimeStampedGazeMovements(DataStructures.TimeStampedBuffer): + """Define timestamped buffer to store gaze movements.""" - def __setitem__(self, key, value: Movement): - """Force value to inherit from Movement.""" + def __setitem__(self, key, value: GazeMovement): + """Force value to inherit from GazeMovement.""" - assert(type(value).__bases__[0] == Movement) + assert(type(value).__bases__[0] == GazeMovement) super().__setitem__(key, value) @dataclass class GazeStatus(): - """Define gaze status as a position belonging to an identified and indexed movement.""" + """Define gaze status as a position belonging to an identified and indexed gaze movement.""" position: GazePosition """Gaze position""" movement_type: str - """Movement type to which gaze position belongs.""" + """GazeMovement type to which gaze position belongs.""" movement_index: int - """Movement index to which gaze positon belongs.""" + """GazeMovement index to which gaze positon belongs.""" class TimeStampedGazeStatus(DataStructures.TimeStampedBuffer): """Define timestamped buffer to store gaze status.""" @@ -139,8 +139,8 @@ class TimeStampedGazeStatus(DataStructures.TimeStampedBuffer): def __setitem__(self, key, value: GazeStatus): super().__setitem__(key, value) -class MovementIdentifier(): - """Abstract class to define what should provide a movement identifier.""" +class GazeMovementIdentifier(): + """Abstract class to define what should provide a gaze movement identifier.""" def __init__(self, ts_gaze_positions: TimeStampedGazePositions): @@ -153,7 +153,7 @@ class MovementIdentifier(): def __next__(self): raise NotImplementedError('__next__() method not implemented') -class DispersionBasedMovementIdentifier(MovementIdentifier): +class DispersionBasedGazeMovementIdentifier(GazeMovementIdentifier): """Implementation of the I-DT algorithm as described in: Dario D. Salvucci and Joseph H. Goldberg. 2000. Identifying fixations and @@ -206,7 +206,7 @@ class DispersionBasedMovementIdentifier(MovementIdentifier): def __post_init__(self): super().__post_init__() - def __init__(self, ts_gaze_positions, dispersion_threshold = 10, duration_threshold = 100): + def __init__(self, ts_gaze_positions, dispersion_threshold: float, duration_threshold: float): super().__init__(ts_gaze_positions) @@ -219,7 +219,7 @@ class DispersionBasedMovementIdentifier(MovementIdentifier): self.__last_fixation = None def __iter__(self): - """Movement identification generator.""" + """GazeMovement identification generator.""" # while there are 2 gaze positions at least while len(self.__ts_gaze_positions) >= 2: @@ -256,7 +256,7 @@ class DispersionBasedMovementIdentifier(MovementIdentifier): break # is it a new fixation ? - new_fixation = DispersionBasedMovementIdentifier.DispersionBasedFixation(ts_gaze_positions) + new_fixation = DispersionBasedGazeMovementIdentifier.DispersionBasedFixation(ts_gaze_positions) # dispersion is small if new_fixation.dispersion <= self.__dispersion_threshold: @@ -278,7 +278,7 @@ class DispersionBasedMovementIdentifier(MovementIdentifier): ts_gaze_positions[ts_next] = position_next # how much gaze is dispersed ? - updated_fixation = DispersionBasedMovementIdentifier.DispersionBasedFixation(ts_gaze_positions) + updated_fixation = DispersionBasedGazeMovementIdentifier.DispersionBasedFixation(ts_gaze_positions) # dispersion is becomes too wide : ignore updated fixation if updated_fixation.dispersion > self.__dispersion_threshold: @@ -306,7 +306,7 @@ class DispersionBasedMovementIdentifier(MovementIdentifier): if end_position_ts > start_position_ts: - new_saccade = DispersionBasedMovementIdentifier.DispersionBasedSaccade(ts_saccade_positions) + new_saccade = DispersionBasedGazeMovementIdentifier.DispersionBasedSaccade(ts_saccade_positions) yield new_saccade @@ -465,12 +465,12 @@ class PointerBasedVisualScan(VisualScanGenerator): class FixationBasedVisualScan(VisualScanGenerator): """Build visual scan on the basis of timestamped fixations.""" - def __init__(self, ts_aoi_scenes: AOIFeatures.TimeStampedAOIScenes, ts_fixations: TimeStampedMovements): + def __init__(self, ts_aoi_scenes: AOIFeatures.TimeStampedAOIScenes, ts_fixations: TimeStampedGazeMovements): super().__init__(ts_aoi_scenes) - if type(ts_fixations) != TimeStampedMovements: - raise ValueError('second argument must be a GazeFeatures.TimeStampedMovements') + if type(ts_fixations) != TimeStampedGazeMovements: + raise ValueError('second argument must be a GazeFeatures.TimeStampedGazeMovements') # process identification on a copy self.__ts_aoi_scenes = ts_aoi_scenes.copy() |