aboutsummaryrefslogtreecommitdiff
path: root/docs/user_guide/gaze_analysis_pipeline/advanced_topics/module_loading.md
blob: 8242a7f7db95a1caadf1b002be7f175c7d851d2a (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
Load objects from external package
==================================

It is possible to load pipeline step objects [from external Python package](https://docs.python.org/3/tutorial/modules.html#packages).

To do so, simply prepend the package module where to find a class into the JSON configuration file. The exemple below shows how to load an external [GazeMovementIdentifier](../../../argaze.md/#argaze.GazeFeatures.GazeMovementIdentifier):

```
{
		...
		"gaze_movement_identifier": {
			"my_package.my_module.my_class": {
				"my_parameter": 0
			}
		}
}
```

Then, load your package from the Python script where the [ArFrame](../../../argaze.md/#argaze.ArFeatures.ArFrame) is created.

```python
import argaze

# Import your own package
import my_package

# Load ArFrame
with argaze.load('./configuration.json') as ar_frame:

	# Print gaze movement identifier type
	print(type(ar_frame.gaze_movement_identifier))
```

This logic would be the same for [ScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.ScanPathAnalyzer), [AOIMatcher](../../../argaze.md/#argaze.GazeFeatures.AOIMatcher), [AOIScanPathAnalyzer](../../../argaze.md/#argaze.GazeFeatures.AOIScanPathAnalyzer) or [GazePositionCalibrator](../../../argaze.md/#argaze.GazeFeatures.GazePositionCalibrator).