aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/GazeAnalysis/NearestNeighborIndex.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/argaze.test/GazeAnalysis/NearestNeighborIndex.py')
-rw-r--r--src/argaze.test/GazeAnalysis/NearestNeighborIndex.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/argaze.test/GazeAnalysis/NearestNeighborIndex.py b/src/argaze.test/GazeAnalysis/NearestNeighborIndex.py
new file mode 100644
index 0000000..fb7d4ec
--- /dev/null
+++ b/src/argaze.test/GazeAnalysis/NearestNeighborIndex.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+""" """
+
+__author__ = "Théo de la Hogue"
+__credits__ = []
+__copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
+__license__ = "BSD"
+
+import unittest
+
+from argaze import GazeFeatures
+from argaze.GazeAnalysis import NearestNeighborIndex
+from argaze.utils import MiscFeatures
+
+GazeFeaturesTest = MiscFeatures.importFromTestPackage('GazeFeatures')
+
+class TestScanPathAnalyzer(unittest.TestCase):
+ """Test ScanPathAnalyzer class."""
+
+ def test_analyze(self):
+ """Test analyze."""
+
+ nni_analyzer = NearestNeighborIndex.ScanPathAnalyzer()
+
+ screen_dimension = (100, 100)
+ scan_path = GazeFeaturesTest.build_scan_path(6, screen_dimension)
+
+ # Check aoi scan path
+ self.assertEqual(len(scan_path), 6)
+
+ nni = nni_analyzer.analyze(scan_path, screen_dimension)
+
+ # Check NNI
+ self.assertGreaterEqual(nni, 0)
+ self.assertLessEqual(nni, 1)
+
+if __name__ == '__main__':
+
+ unittest.main() \ No newline at end of file