aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze.test/DataLog/FileWriter.py (renamed from src/argaze.test/DataLog/File.py)10
-rw-r--r--src/argaze/ArFeatures.py6
-rw-r--r--src/argaze/DataFeatures.py10
-rw-r--r--src/argaze/DataLog/FileWriter.py (renamed from src/argaze/DataLog/File.py)2
-rw-r--r--src/argaze/DataLog/__init__.py2
-rw-r--r--src/argaze/utils/demo_data/demo_gaze_analysis_setup.json4
6 files changed, 17 insertions, 17 deletions
diff --git a/src/argaze.test/DataLog/File.py b/src/argaze.test/DataLog/FileWriter.py
index 2d66ea6..648385c 100644
--- a/src/argaze.test/DataLog/File.py
+++ b/src/argaze.test/DataLog/FileWriter.py
@@ -11,7 +11,7 @@ import unittest
import os
from argaze import DataFeatures
-from argaze.DataLog import File
+from argaze.DataLog import FileWriter
from argaze.utils import UtilsFeatures
DataFeaturesTest = UtilsFeatures.importFromTestPackage('DataFeatures')
@@ -22,15 +22,15 @@ class TestTimeStampedDataLogger(unittest.TestCase):
def test_creation(self):
"""Test logger creation."""
- file_logger = File.TimeStampedDataLogger(path='./_export/logs/data.txt', separator=',')
+ file_writer = FileWriter.TimeStampedDataLogger(path='./_export/logs/data.txt', separator=',')
# Check file creation
self.assertEqual(os.path.exists('./_export/logs/data.txt'), True)
# Write into file
- file_logger.emit(0, 'A')
- file_logger.emit(1, 'B')
- file_logger.emit(2, 'C')
+ file_writer.emit(0, 'A')
+ file_writer.emit(1, 'B')
+ file_writer.emit(2, 'C')
if __name__ == '__main__':
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py
index 7e7545e..67f60ab 100644
--- a/src/argaze/ArFeatures.py
+++ b/src/argaze/ArFeatures.py
@@ -464,7 +464,7 @@ class ArLayer(DataFeatures.SharedObject):
# Log look data
for logger_module_path, logger in self.loggers.items():
- logger(timestamp, DataFeatures.DataDictionary(look_data))
+ logger.emit(timestamp, DataFeatures.DataDictionary(look_data))
# Unlock layer exploitation
self.release()
@@ -867,7 +867,7 @@ class ArFrame(DataFeatures.SharedObject):
# Assess pipeline execution times
execution_times = {
'gaze_movement_identifier': None,
- 'scan_path_analyzers':{},
+ 'scan_path_analyzers': DataFeatures.DataDictionary({}),
'heatmap': None
}
@@ -987,7 +987,7 @@ class ArFrame(DataFeatures.SharedObject):
# Log look data
for logger_module_path, logger in self.loggers.items():
- logger(timestamp, look_data)
+ logger.emit(timestamp, look_data)
# Unlock frame exploitation
self.release()
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index d58cecf..03776fd 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -460,16 +460,16 @@ class TimeStampedDataLogger():
logger_module = importlib.import_module(logger_module_path)
return logger_module.TimeStampedDataLogger(**logger_parameters)
- 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."""
+ def emit(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 handle method."""
data['timestamp'] = timestamp
if eval(self.selector, globals(), data):
- self.emit(eval(self.formatter, globals(), data))
+ self.handle(eval(self.formatter, globals(), data))
- def emit(self, formatted_log: any):
- """Emit formatted log to a destination."""
+ def handle(self, formatted_log: any):
+ """Handle formatted log emission to destination."""
raise NotImplementedError('handle() method not implemented')
diff --git a/src/argaze/DataLog/File.py b/src/argaze/DataLog/FileWriter.py
index 8179f8f..9b9fc5f 100644
--- a/src/argaze/DataLog/File.py
+++ b/src/argaze/DataLog/FileWriter.py
@@ -48,7 +48,7 @@ class TimeStampedDataLogger(DataFeatures.TimeStampedDataLogger):
self._file.close()
- def emit(self, formatted_log: any):
+ def handle(self, formatted_log: any):
"""Write log as a new line into file. List or tuple are converted into strings separated by separator char."""
# Format list or tuple element into quoted strings
diff --git a/src/argaze/DataLog/__init__.py b/src/argaze/DataLog/__init__.py
index 3f5a36f..febd648 100644
--- a/src/argaze/DataLog/__init__.py
+++ b/src/argaze/DataLog/__init__.py
@@ -1,4 +1,4 @@
"""
Various data logger handler.
"""
-__all__ = ['File'] \ No newline at end of file
+__all__ = ['FileWriter'] \ No newline at end of file
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 008727e..cfe5fc2 100644
--- a/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
+++ b/src/argaze/utils/demo_data/demo_gaze_analysis_setup.json
@@ -48,7 +48,7 @@
"Entropy":{}
},
"loggers": {
- "File" : {
+ "FileWriter" : {
"path": "_export/logs/KCoefficientModified.csv",
"header": "Timestamp (ms), K",
"selector": "'argaze.GazeAnalysis.KCoefficient' in aoi_scan_path_analysis",
@@ -58,7 +58,7 @@
}
},
"loggers": {
- "File" : {
+ "FileWriter" : {
"path": "_export/logs/Fixations.csv",
"header": "Timestamp (ms), Focus (px), Duration (ms), AOI",
"selector": "GazeFeatures.is_fixation(gaze_movement) and gaze_movement.finished",