diff options
-rw-r--r-- | src/argaze/DataFeatures.py | 6 | ||||
-rw-r--r-- | src/argaze/utils/demo_data/demo_gaze_analysis_setup.json | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py index ac3000c..1f3ae7a 100644 --- a/src/argaze/DataFeatures.py +++ b/src/argaze/DataFeatures.py @@ -463,9 +463,11 @@ class TimeStampedDataLogger(): def __call__(self, timestamp: TimeStampType, data: DataDictionary) -> Any: """Apply selector code to decide if data have to be logged, then apply formatter code before to call specific logger emit method.""" - if eval(self.selector): + data['timestamp'] = timestamp - return self.emit(eval(self.formatter)) + if eval(self.selector, globals(), data): + + return self.emit(eval(self.formatter, globals(), data)) def emit(self, formatted_log: any): """Emit formatted log to a destination.""" diff --git a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json index 39eaeca..d4447c0 100644 --- a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json +++ b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json @@ -51,8 +51,8 @@ "File" : { "path": "_export/logs/aoi.csv", "header": "Timestamp, AOI", - "selector": "data.looked_aoi_name is not None", - "formatter": "timestamp, data.looked_aoi_name" + "selector": "looked_aoi_name is not None", + "formatter": "timestamp, looked_aoi_name" } } } @@ -61,8 +61,8 @@ "File" : { "path": "_export/logs/fixations.csv", "header": "Timestamp, Focus, Duration", - "selector": "GazeFeatures.is_fixation(data.identified_gaze_movement)", - "formatter": "timestamp, data.identified_gaze_movement.focus, data.identified_gaze_movement.duration" + "selector": "GazeFeatures.is_fixation(identified_gaze_movement)", + "formatter": "timestamp, identified_gaze_movement.focus, identified_gaze_movement.duration" } }, "image_parameters": { |