aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2023-07-05 17:11:31 +0200
committerThéo de la Hogue2023-07-05 17:11:31 +0200
commit078cf666c46992765d9aed898a207c464800e934 (patch)
tree604f6d4dd21084cfb131d14700dc217f8bb2f65e
parent0d866d860a988104f531a2accbf5819681ec1336 (diff)
downloadargaze-078cf666c46992765d9aed898a207c464800e934.zip
argaze-078cf666c46992765d9aed898a207c464800e934.tar.gz
argaze-078cf666c46992765d9aed898a207c464800e934.tar.bz2
argaze-078cf666c46992765d9aed898a207c464800e934.tar.xz
Renaming variables and removing useless internal attribute.
-rw-r--r--src/argaze/ArFeatures.py41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 2a54349..dc696ee 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -93,9 +93,6 @@ class ArFrame():
# Init current gaze position
self.__gaze_position = GazeFeatures.UnvalidGazePosition()
- # Init current look at aoi
- self.__look_at = None
-
# Init heatmap if required
if self.heatmap:
@@ -144,11 +141,11 @@ class ArFrame():
gaze_movement_identifier_type, gaze_movement_identifier_parameters = gaze_movement_identifier_value.popitem()
gaze_movement_identifier_module = importlib.import_module(f'argaze.GazeAnalysis.{gaze_movement_identifier_type}')
- new_gaze_movement_identifier = gaze_movement_identifier_module.GazeMovementIdentifier(**gaze_movement_identifier_parameters)
+ ended_gaze_movement_identifier = gaze_movement_identifier_module.GazeMovementIdentifier(**gaze_movement_identifier_parameters)
except KeyError:
- new_gaze_movement_identifier = None
+ ended_gaze_movement_identifier = None
# Load scan path analyzers
new_scan_path_analyzers = {}
@@ -251,7 +248,7 @@ class ArFrame():
return ArFrame(new_frame_name, \
new_frame_size, \
new_frame_background, \
- new_gaze_movement_identifier, \
+ ended_gaze_movement_identifier, \
GazeFeatures.ScanPath() if len(new_scan_path_analyzers) > 0 else None, \
new_scan_path_analyzers, \
GazeFeatures.AOIScanPath() if len(new_aoi_scan_path_analyzers) > 0 else None, \
@@ -315,35 +312,35 @@ class ArFrame():
# Identify gaze movement
if self.gaze_movement_identifier:
- # Identify gaze movement
- new_gaze_movement = self.gaze_movement_identifier.identify(timestamp, self.__gaze_position)
+ # Identify ended gaze movement
+ ended_gaze_movement = self.gaze_movement_identifier.identify(timestamp, self.__gaze_position)
- if GazeFeatures.is_fixation(new_gaze_movement):
+ if GazeFeatures.is_fixation(ended_gaze_movement):
# Does the fixation match an AOI?
- self.__look_at = None
+ look_at = None
for name, aoi in self.aoi_2d_scene.items():
- _, _, circle_ratio = aoi.circle_intersection(new_gaze_movement.focus, new_gaze_movement.deviation_max)
+ _, _, circle_ratio = aoi.circle_intersection(ended_gaze_movement.focus, ended_gaze_movement.deviation_max)
if circle_ratio > 0.25:
if name != self.name:
- # Update current lookt at
- self.__look_at = name
+ # Update current look at
+ look_at = name
break
# Append fixation to scan path
if self.scan_path != None:
- self.scan_path.append_fixation(timestamp, new_gaze_movement)
+ self.scan_path.append_fixation(timestamp, ended_gaze_movement)
# Append fixation to aoi scan path
- if self.aoi_scan_path != None and self.__look_at != None:
+ if self.aoi_scan_path != None and look_at != None:
- aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, new_gaze_movement, self.__look_at)
+ aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, ended_gaze_movement, look_at)
# Analyze aoi scan path
if aoi_scan_step and len(self.aoi_scan_path) > 1:
@@ -354,15 +351,15 @@ class ArFrame():
aoi_scan_step_analysis[aoi_scan_path_analyzer_type] = aoi_scan_path_analyzer.analysis
- elif GazeFeatures.is_saccade(new_gaze_movement):
+ elif GazeFeatures.is_saccade(ended_gaze_movement):
# Update current look at
- self.__look_at = None
+ look_at = None
# Append saccade to scan path
if self.scan_path != None:
- scan_step = self.scan_path.append_saccade(timestamp, new_gaze_movement)
+ scan_step = self.scan_path.append_saccade(timestamp, ended_gaze_movement)
# Analyze aoi scan path
if scan_step and len(self.scan_path) > 1:
@@ -376,7 +373,7 @@ class ArFrame():
# Append saccade to aoi scan path
if self.aoi_scan_path != None:
- self.aoi_scan_path.append_saccade(timestamp, new_gaze_movement)
+ self.aoi_scan_path.append_saccade(timestamp, ended_gaze_movement)
# Update heatmap
if self.heatmap:
@@ -387,7 +384,7 @@ class ArFrame():
self.__look_lock.release()
# Return look data
- return new_gaze_movement, self.__look_at, scan_step_analysis, aoi_scan_step_analysis
+ return ended_gaze_movement, look_at, scan_step_analysis, aoi_scan_step_analysis
def draw(self, image:numpy.array):
"""
@@ -403,7 +400,7 @@ class ArFrame():
# Draw aoi
self.aoi_2d_scene.draw(image, color=(0, 0, 0))
- # Draw gaze position
+ # Draw current gaze position
self.__gaze_position.draw(image, color=(255, 255, 255))
# Draw current gaze movements