aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/ArFeatures.py12
-rw-r--r--src/argaze/DataFeatures.py4
-rw-r--r--src/argaze/utils/demo_data/demo_gaze_analysis_setup.json40
3 files changed, 39 insertions, 17 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 67f60ab..281dec8 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -291,9 +291,9 @@ class ArLayer(DataFeatures.SharedObject):
new_loggers_value = layer_data.pop('loggers')
- for logger_module_path, logger_parameters in new_loggers_value.items():
+ for logger_name, logger_data in new_loggers_value.items():
- new_loggers[logger_module_path] = DataFeatures.TimeStampedDataLogger.from_dict(logger_module_path, logger_parameters)
+ new_loggers[logger_name] = DataFeatures.TimeStampedDataLogger.from_dict(logger_data)
except KeyError:
@@ -462,7 +462,7 @@ class ArLayer(DataFeatures.SharedObject):
})
# Log look data
- for logger_module_path, logger in self.loggers.items():
+ for logger_name, logger in self.loggers.items():
logger.emit(timestamp, DataFeatures.DataDictionary(look_data))
@@ -769,9 +769,9 @@ class ArFrame(DataFeatures.SharedObject):
new_loggers_value = frame_data.pop('loggers')
- for logger_module_path, logger_parameters in new_loggers_value.items():
+ for logger_name, logger_data in new_loggers_value.items():
- new_loggers[logger_module_path] = DataFeatures.TimeStampedDataLogger.from_dict(logger_module_path, logger_parameters)
+ new_loggers[logger_name] = DataFeatures.TimeStampedDataLogger.from_dict(logger_data)
except KeyError:
@@ -985,7 +985,7 @@ class ArFrame(DataFeatures.SharedObject):
})
# Log look data
- for logger_module_path, logger in self.loggers.items():
+ for logger_name, logger in self.loggers.items():
logger.emit(timestamp, look_data)
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index 03776fd..95b4f3f 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -445,7 +445,7 @@ class TimeStampedDataLogger():
"""Code (or list of codes) evaluated to format timestamp and data to emit. Default 'timestamp, data' string means that all incoming timestamp and data values will be emitted."""
@classmethod
- def from_dict(self, logger_module_path: str, logger_parameters: dict) -> TimeStampedDataLoggerType:
+ def from_dict(self, logger_data: dict) -> TimeStampedDataLoggerType:
"""Load timestamped data logger from dictionary.
Parameters:
@@ -453,6 +453,8 @@ class TimeStampedDataLogger():
logger_parameters: attributes to load
"""
+ logger_module_path, logger_parameters = logger_data.popitem()
+
# Prepend argaze.DataLog path when a single name is provided
if len(logger_module_path.split('.')) == 1:
logger_module_path = f'argaze.DataLog.{logger_module_path}'
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 cfe5fc2..bea5f57 100644
--- a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
+++ b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
@@ -48,21 +48,41 @@
"Entropy":{}
},
"loggers": {
- "FileWriter" : {
- "path": "_export/logs/KCoefficientModified.csv",
- "header": "Timestamp (ms), K",
- "selector": "'argaze.GazeAnalysis.KCoefficient' in aoi_scan_path_analysis",
- "formatter": "timestamp, aoi_scan_path_analysis['argaze.GazeAnalysis.KCoefficient'].K"
+ "KCoefficientModified": {
+ "FileWriter" : {
+ "path": "_export/logs/KCoefficientModified.csv",
+ "header": "Timestamp (ms), K",
+ "selector": "'argaze.GazeAnalysis.KCoefficient' in aoi_scan_path_analysis",
+ "formatter": "timestamp, aoi_scan_path_analysis['argaze.GazeAnalysis.KCoefficient'].K"
+ }
+ },
+ "LempelZivComplexity": {
+ "FileWriter" : {
+ "path": "_export/logs/LempelZivComplexity.csv",
+ "header": "Timestamp (ms), LZC",
+ "selector": "'argaze.GazeAnalysis.LempelZivComplexity' in aoi_scan_path_analysis",
+ "formatter": "timestamp, aoi_scan_path_analysis['argaze.GazeAnalysis.LempelZivComplexity'].lempel_ziv_complexity"
+ }
}
}
}
},
"loggers": {
- "FileWriter" : {
- "path": "_export/logs/Fixations.csv",
- "header": "Timestamp (ms), Focus (px), Duration (ms), AOI",
- "selector": "GazeFeatures.is_fixation(gaze_movement) and gaze_movement.finished",
- "formatter": "timestamp, gaze_movement.focus, gaze_movement.duration, layers.main_layer.looked_aoi_name"
+ "Fixations": {
+ "FileWriter" : {
+ "path": "_export/logs/Fixations.csv",
+ "header": "Timestamp (ms), Focus (px), Duration (ms), AOI",
+ "selector": "GazeFeatures.is_fixation(gaze_movement) and gaze_movement.finished",
+ "formatter": "timestamp, gaze_movement.focus, gaze_movement.duration, layers.main_layer.looked_aoi_name"
+ }
+ },
+ "KCoefficient": {
+ "FileWriter" : {
+ "path": "_export/logs/KCoefficient.csv",
+ "header": "Timestamp (ms), K",
+ "selector": "'argaze.GazeAnalysis.KCoefficient' in scan_path_analysis",
+ "formatter": "timestamp, scan_path_analysis['argaze.GazeAnalysis.KCoefficient'].K"
+ }
}
},
"image_parameters": {