aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThéo de la Hogue2024-01-25 23:54:49 +0100
committerThéo de la Hogue2024-01-25 23:54:49 +0100
commit7dc4017943435196aafe2a908c90fdfb702f1155 (patch)
tree4a398765311a4ac950398682c60bd79b190d2c8f
parent679d6f3358679d9eb3f63110ebabbe18ed5d05cc (diff)
downloadargaze-7dc4017943435196aafe2a908c90fdfb702f1155.zip
argaze-7dc4017943435196aafe2a908c90fdfb702f1155.tar.gz
argaze-7dc4017943435196aafe2a908c90fdfb702f1155.tar.bz2
argaze-7dc4017943435196aafe2a908c90fdfb702f1155.tar.xz
Removing debug print. Fixing property listing for analyzer.
-rw-r--r--docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md4
-rw-r--r--src/argaze/ArFeatures.py46
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoCamera.py12
-rw-r--r--src/argaze/ArUcoMarkers/ArUcoScene.py8
-rw-r--r--src/argaze/DataFeatures.py16
-rw-r--r--src/argaze/GazeFeatures.py12
6 files changed, 38 insertions, 60 deletions
diff --git a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md
index dc92dd5..12b5dd1 100644
--- a/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md
+++ b/docs/user_guide/gaze_analysis_pipeline/advanced_topics/scripting.md
@@ -104,7 +104,7 @@ Calling [ArFrame.look](../../../argaze.md/#argaze.ArFeatures.ArFrame.look) metho
if ar_layer.aoi_scan_path_analyzed:
- for aoi_scan_path_analyzer_name, aoi_scan_path_analysis in ar_layer.aoi_scan_path_analysis():
+ for aoi_scan_path_analyzer_name, aoi_scan_path_analysis in ar_layer.aoi_scan_path_analysis:
...
@@ -141,7 +141,7 @@ This an iterator to access to all scan path analysis.
This flag allows to now when new aoi scan path analysis are available.
-### *ar_layer.aoi_scan_path_analysis()*
+### *ar_layer.aoi_scan_path_analysis*
This an iterator to access to all aoi scan path analysis.
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 509712e..4524823 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -216,7 +216,8 @@ class ArLayer(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
"aoi_matcher": self.__aoi_matcher,
"aoi_scan_path": self.__aoi_scan_path,
"aoi_scan_path_analyzers": self.__aoi_scan_path_analyzers,
- "draw_parameters": self.__draw_parameters
+ "draw_parameters": self.__draw_parameters,
+ **DataFeatures.PipelineStepObject.as_dict(self)
}
@classmethod
@@ -381,9 +382,6 @@ class ArLayer(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
# Load temporary pipeline step object from layer_data then export it as dict
temp_pipeline_step_object_data = DataFeatures.PipelineStepObject.from_dict(layer_data, working_directory).as_dict()
- # DEBUG
- print('ArLayer.from_dict: temp_pipeline_step_object_data=', temp_pipeline_step_object_data)
-
# Create layer
return ArLayer( \
new_layer_name, \
@@ -411,6 +409,14 @@ class ArLayer(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
return ArLayer.from_dict(layer_data, working_directory)
+ def __str__(self) -> str:
+ """
+ Returns:
+ String representation
+ """
+
+ return str(self.aoi_scene.keys())
+
@DataFeatures.PipelineStepMethod
def look(self, timestamp: int|float, gaze_movement: GazeFeatures.GazePosition = GazeFeatures.UnvalidGazePosition()):
"""
@@ -543,9 +549,6 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
image_parameters: default parameters passed to image method
"""
- # DEBUG
- print('ArFrame.__init__', name, layers, kwargs)
-
# Init parent classes
DataFeatures.SharedObject.__init__(self)
DataFeatures.PipelineStepObject.__init__(self, **kwargs)
@@ -687,7 +690,8 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
"background": self.__background,
"heatmap": self.__heatmap,
"layers": self.__layers,
- "image_parameters": self.__image_parameters
+ "image_parameters": self.__image_parameters,
+ **DataFeatures.PipelineStepObject.as_dict(self)
}
@classmethod
@@ -894,9 +898,6 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
# Load temporary pipeline step object from frame_data then export it as dict
temp_pipeline_step_object_data = DataFeatures.PipelineStepObject.from_dict(frame_data, working_directory).as_dict()
- # DEBUG
- print('ArFrame.from_dict: temp_pipeline_step_object_data=', temp_pipeline_step_object_data)
-
# Create frame
return ArFrame( \
new_frame_name, \
@@ -929,6 +930,14 @@ class ArFrame(DataFeatures.SharedObject, DataFeatures.PipelineStepObject):
return ArFrame.from_dict(frame_data, working_directory)
+ def __str__(self) -> str:
+ """
+ Returns:
+ String representation
+ """
+
+ return str(self.size)
+
@DataFeatures.PipelineStepMethod
def look(self, timestamp: int|float, gaze_position: GazeFeatures.GazePosition = GazeFeatures.UnvalidGazePosition()) -> Iterator[Union[object, type, dict]]:
"""
@@ -1108,7 +1117,7 @@ class ArScene(DataFeatures.PipelineStepObject):
Define abstract Augmented Reality scene with ArLayers and ArFrames inside.
"""
- def __init__(self, name: str = None, layers: dict = None, frames: dict = None, angle_tolerance: float = 0., distance_tolerance: float = 0.):
+ def __init__(self, name: str = None, layers: dict = None, frames: dict = None, angle_tolerance: float = 0., distance_tolerance: float = 0., **kwargs):
""" Initialize ArScene
Parameters:
@@ -1120,7 +1129,7 @@ class ArScene(DataFeatures.PipelineStepObject):
"""
# Init parent classes
- super().__init__()
+ super().__init__(**kwargs)
# Init private attributes
self.__name = name
@@ -1193,7 +1202,8 @@ class ArScene(DataFeatures.PipelineStepObject):
"layers": self.__layers,
"frames": self.__frames,
"angle_tolerance": self.__angle_tolerance,
- "distance_tolerance": self.__distance_tolerance
+ "distance_tolerance": self.__distance_tolerance,
+ **DataFeatures.PipelineStepObject.as_dict(self)
}
@classmethod
@@ -1411,9 +1421,6 @@ class ArCamera(ArFrame):
visual_vfov: Optional angle in degree to clip scenes projection according visual vertical field of view (VFOV).
"""
- # DEBUG
- print('ArCamera.__init__ kwargs', kwargs)
-
# Init parent class
super().__init__(**kwargs)
@@ -1508,7 +1515,8 @@ class ArCamera(ArFrame):
return {
"scenes": self.__scenes,
"visual_hfov": self.__visual_hfov,
- "visual_vfov": self.__visual_vfov
+ "visual_vfov": self.__visual_vfov,
+ **ArFrame.as_dict(self)
}
def __str__(self) -> str:
@@ -1517,7 +1525,7 @@ class ArCamera(ArFrame):
String representation
"""
- output = f'Name:\n{self.__name}\n'
+ output = f'Name:\n{self.name}\n'
for name, scene in self.__scenes.items():
output += f'\"{name}\" {type(scene)}:\n{scene}\n'
diff --git a/src/argaze/ArUcoMarkers/ArUcoCamera.py b/src/argaze/ArUcoMarkers/ArUcoCamera.py
index ae97c96..12afbd9 100644
--- a/src/argaze/ArUcoMarkers/ArUcoCamera.py
+++ b/src/argaze/ArUcoMarkers/ArUcoCamera.py
@@ -44,9 +44,6 @@ class ArUcoCamera(ArFeatures.ArCamera):
aruco_detector: ArUco marker detector
"""
- # DEBUG
- print('ArUcoCamera.__init__ kwargs', kwargs)
-
# Init parent class
super().__init__(**kwargs)
@@ -119,17 +116,14 @@ class ArUcoCamera(ArFeatures.ArCamera):
for layer_name, layer_data in aruco_camera_data['layers'].items():
aruco_camera_data['image_parameters']['draw_layers'][layer_name] = ArFeatures.DEFAULT_ARLAYER_DRAW_PARAMETERS
- # Load temporary camera from aruco_camera_data then export it as dict
- temp_camera_data = ArFeatures.ArCamera.from_dict(aruco_camera_data, working_directory).as_dict()
-
- # DEBUG
- print('ArUcoCamera.from_dict: temp_camera_data=', temp_camera_data)
+ # Load temporary frame from aruco_camera_data then export it as dict
+ temp_frame_data = ArFeatures.ArFrame.from_dict(aruco_camera_data, working_directory).as_dict()
# Create new aruco camera using temporary ar frame values
return ArUcoCamera( \
aruco_detector = new_aruco_detector, \
scenes = new_scenes, \
- **temp_camera_data \
+ **temp_frame_data \
)
@classmethod
diff --git a/src/argaze/ArUcoMarkers/ArUcoScene.py b/src/argaze/ArUcoMarkers/ArUcoScene.py
index c09cbbc..997ad40 100644
--- a/src/argaze/ArUcoMarkers/ArUcoScene.py
+++ b/src/argaze/ArUcoMarkers/ArUcoScene.py
@@ -33,9 +33,6 @@ class ArUcoScene(ArFeatures.ArScene):
aruco_markers_group: ArUco markers 3D scene description used to estimate scene pose from detected markers: see [estimate_pose][argaze.ArFeatures.ArScene.estimate_pose] function below.
"""
- # DEBUG
- print(f'ArUcoScene.__init__', kwargs)
-
# Init parent classes
super().__init__(**kwargs)
@@ -91,11 +88,8 @@ class ArUcoScene(ArFeatures.ArScene):
# Load temporary scene from aruco_scene_data then export it as dict
temp_scene_data = ArFeatures.ArScene.from_dict(aruco_scene_data, working_directory).as_dict()
- # DEBUG
- print('ArUcoScene.from_dict: temp_scene_data=', temp_scene_data)
-
# Create new aruco scene using temporary ar scene values
- return ArUcoScene(
+ return ArUcoScene( \
aruco_markers_group = new_aruco_markers_group, \
**temp_scene_data \
)
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index fe03b4c..0dcd8c4 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -347,9 +347,6 @@ class SharedObject():
def __init__(self):
- # DEBUG
- print('SharedObject.__init__')
-
self._lock = threading.Lock()
self._timestamp = math.nan
self._execution_times = {}
@@ -403,9 +400,6 @@ class PipelineStepObject():
observers: dictionary with observers objects.
"""
- # DEBUG
- print('PipelineStepObject.__init__', observers)
-
# Init private attribute
self.__observers = observers if observers is not None else {}
self.__execution_times = {}
@@ -427,7 +421,7 @@ class PipelineStepObject():
object_data: dictionary with pipeline step object attributes values.
"""
return {
- "observers": self.__observers,
+ "observers": self.__observers
}
@classmethod
@@ -494,9 +488,6 @@ def PipelineStepAttribute(method):
return method
-# DEBUG
-from argaze import ArFeatures
-
def PipelineStepMethod(method):
"""Define a decorator use into PipelineStepObject class to declare pipeline method.
@@ -507,11 +498,6 @@ def PipelineStepMethod(method):
def wrapper(self, timestamp, *args, **kw):
"""Wrap pipeline step method to measure execution time."""
- # DEBUG
- if type(self) == ArFeatures.ArFrame:
-
- print(timestamp, self.name, method.__name__, len(self.observers))
-
# Initialize execution time assessment
start = time.perf_counter()
diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py
index d69a6cc..af5a940 100644
--- a/src/argaze/GazeFeatures.py
+++ b/src/argaze/GazeFeatures.py
@@ -827,7 +827,7 @@ class ScanPathAnalyzer(DataFeatures.PipelineStepObject):
super().__init__()
- self.__properties = [name for (name, value) in getmembers(type(self), lambda v: isinstance(v, property))]
+ self.__properties = [name for (name, value) in self.__class__.__dict__.items() if isinstance(value, property)]
@property
def analysis(self) -> DataFeatures.DataDictionary:
@@ -836,9 +836,7 @@ class ScanPathAnalyzer(DataFeatures.PipelineStepObject):
for p in self.__properties:
- if p != 'analysis':
-
- analysis[p] = getattr(self, p)
+ analysis[p] = getattr(self, p)
return DataFeatures.DataDictionary(analysis)
@@ -1171,7 +1169,7 @@ class AOIScanPathAnalyzer(DataFeatures.PipelineStepObject):
super().__init__()
- self.__properties = [name for (name, value) in getmembers(type(self), lambda v: isinstance(v, property))]
+ self.__properties = [name for (name, value) in self.__class__.__dict__.items() if isinstance(value, property)]
@property
def analysis(self) -> dict:
@@ -1180,9 +1178,7 @@ class AOIScanPathAnalyzer(DataFeatures.PipelineStepObject):
for p in self.__properties:
- if p != 'analysis':
-
- analysis[p] = getattr(self, p)
+ analysis[p] = getattr(self, p)
return DataFeatures.DataDictionary(analysis)