aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/gaze_analysis_pipeline/advanced_topics/plugin_loading.md
blob: 21e1f8b7a4cf9547d58ee8a9184127c42b0af7f3 (plain)
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
Loading plugins from another package
====================================

It possible to load GazeMovementIdentifier, ScanPathAnalyzer or AOIScanPathAnalyzer plugins from another [python package](https://docs.python.org/3/tutorial/modules.html#packages).

To do so, simply prepend the package where to find the plugin into the JSON configuration file:

```
{
		...
		"gaze_movement_identifier": {
			"my_package.MyGazeMovementIdentifierMethod": {
				"specific_plugin_parameter": 0
			}
		},
		...
		"scan_path_analyzers": {
			"my_package.MyScanPathAnalyzerAlgorithm": {
				"specific_plugin_parameter": 0
			}
		}
		...
		"aoi_scan_path_analyzers": {
			"my_package.MyAOIScanPathAnalyzerAlgorithm": {
				"specific_plugin_parameter": 0
			}
		}
}
```

Then, load your package from the python script where the ArFrame is created.

```python
from argaze import ArFeatures

# Import your own package
import my_package

# Load ArFrame
ar_frame = ArFeatures.ArFrame.from_json('./configuration.json')

# Print ArFrame attributes

for name, scan_path_analyzer in ar_frame.scan_path_analyzers.items():
	print('scan path analyzer type:', type(scan_path_analyzer))
```