diff options
-rw-r--r-- | src/argaze/ArFeatures.py | 2 | ||||
-rw-r--r-- | src/argaze/DataFeatures.py | 32 |
2 files changed, 27 insertions, 7 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 43c017e..d08463b 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -1443,7 +1443,7 @@ class ArCamera(ArFrame): """ # Project gaze position into camera frame - super().look(timestamp, gaze_position) + super().look(timestamp, gaze_position, unwrap=True) # Use camera frame lock feature with self._lock: diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py index 7ac6a4b..62f81a6 100644 --- a/src/argaze/DataFeatures.py +++ b/src/argaze/DataFeatures.py @@ -395,15 +395,19 @@ class PipelineStepObject(): Define class to assess pipeline step methods execution time and observe them. """ - def __init__(self, name: str = None, observers: dict = None): + def __init__(self, name: str = None, working_directory: str = None, observers: dict = None): """Initialize PipelineStepObject Parameters: + name: object name + working_directory: folder path to use for relative file path. observers: dictionary with observers objects. + """ # Init private attribute self.__name = name + self.__working_directory = None self.__observers = observers if observers is not None else {} self.__execution_times = {} self.__properties = {} @@ -431,12 +435,17 @@ class PipelineStepObject(): @property def name(self) -> str: - """Get layer's name.""" + """Get pipeline step object's name.""" return self.__name @property + def working_directory(self) -> str: + """Get pipeline step object's working_directory.""" + return self.__working_directory + + @property def parent(self) -> object: - """Get layer's parent object.""" + """Get pipeline step object's parent object.""" return self.__parent @parent.setter @@ -519,6 +528,7 @@ class PipelineStepObject(): # Create pipeline step object return PipelineStepObject(\ new_name, \ + working_directory, \ new_observers \ ) @@ -676,8 +686,18 @@ def PipelineStepMethod(method): PipelineStepMethod must have a timestamp as first argument. """ - def wrapper(self, timestamp, *args, **kw): - """Wrap pipeline step method to measure execution time.""" + def wrapper(self, timestamp, *args, unwrap: bool = False): + """Wrap pipeline step method to measure execution time. + + Parameters: + timestamp: PipelineStepMethod must define timestamp as first parameter. + args: Any arguments defined by PipelineStepMethod. + unwrap: Extra arguments used in wrapper function to call wrapped method directly. + """ + + if unwrap: + + return method(self, timestamp, *args) # Initialize execution time assessment start = time.perf_counter() @@ -687,7 +707,7 @@ def PipelineStepMethod(method): try: # Execute wrapped method - result = method(self, timestamp, *args, **kw) + result = method(self, timestamp, *args) except Exception as e: |