1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
Log gaze analysis
=================
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) logging are optional pipeline steps. They are executed at each new scan path step to update logs.
## Enable ArFrame and ArLayer logging
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) have a log attribute to enable analysis logging.
Here is an extract from the JSON ArFrame configuration file where logging is enabled for the [ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and for one [ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer):
```json
{
"name": "My FullHD screen",
"size": [1920, 1080],
"log": true,
...
"layers": {
"MyLayer": {
"log": true,
...
}
}
}
```
Then, here is how to access to logs dictionaries:
```python
# Assuming that all timestamped gaze positions have been processed by ArFrame.look method
...
# Access to ArFame scan path analysis logs
for analysis, log in ar_frame.logs.items():
# Do something with scan path analysis log
...
# Access to ArLayers AOI scan path analysis logs
for layer_name, layer in ar_frame.layers.items():
for analysis, log in layer.logs.items():
# Do something with AOI scan path analysis log
...
```
!!! note
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) and its [ArLayers](../../argaze.md/#argaze.ArFeatures.ArLayer) logging are automatically done each time the [ArFrame.look](../../argaze.md/#argaze.ArFeatures.ArFrame.look) method is called.
[ArFrame](../../argaze.md/#argaze.ArFeatures.ArFrame) logging records each scan path analysis into a dedicated timestamped data buffer each time a new scan step happens.
[ArLayer](../../argaze.md/#argaze.ArFeatures.ArLayer) logging records each AOI scan path analysis into a dedicated timestamped data buffer each time a new AOI scan step happens.
## Export gaze analysis logs to CSV file
It is possible to convert gaze analysis log as [Pandas DataFrame](https://pandas.pydata.org/docs/getting_started/intro_tutorials/01_table_oriented.html#min-tut-01-tableoriented) object which can be writen into a CSV file.
```python
import pandas
# Assuming that all timestamped gaze positions have been processed by ArFrame.look method
...
# Export ArFame scan path analysis logs
for analysis, log in ar_frame.logs.items():
log.as_dataframe().to_csv(f'./{ar_frame.name}_{analysis}.csv')
# Export ArLayers layers AOI scan path analysis logs
for layer_name, layer in ar_frame.layers.items():
for analysis, log in layer.logs.items():
log.as_dataframe().to_csv(f'./{ar_frame.name}_{layer_name}_{analysis}.csv')
```
Assuming that [ArGaze.GazeAnalysis.Basic](../../argaze.md/#argaze.GazeAnalysis.Basic) scan path analysis module is enabled for 'My FullHD screen' ArFrame, a ***My FullHD screen_argaze.GazeAnalysis.Basic.csv*** file would be created:
|timestamped|path_duration|step_fixation_durations_average|steps_number|
|:----------|:------------|:------------------------------|:-----------|
|3460 |1750 |563.0 |2 |
|4291 |2623 |652.0 |3 |
|4769 |3107 |544.0 |4 |
|6077 |4411 |652.8 |5 |
|6433 |4760 |595.1 |6 |
|7719 |6050 |652.8 |7 |
|... |... |... |... |
Assuming that [ArGaze.GazeAnalysis.NGram](../../argaze.md/#argaze.GazeAnalysis.NGram) AOI scan path analysis module is enabled for 'MyLayer' ArLayer, a ***My FullHD screen_MyLayer_argaze.GazeAnalysis.NGram.csv*** file would be created:
|timestamped|ngrams_count|
|:----------|:-----------|
|5687 |"{3: {}, 4: {}, 5: {}}"|
|6208 |"{3: {('LeftPanel', 'GeoSector', 'CircularWidget'): 1}, 4: {}, 5: {}}"|
|... |... |
|