aboutsummaryrefslogtreecommitdiff
path: root/src/argaze.test/GazeAnalysis/NearestNeighborIndex.py
diff options
context:
space:
mode:
authorThéo de la Hogue2023-05-31 15:35:28 +0200
committerThéo de la Hogue2023-05-31 15:35:28 +0200
commite35e90d161ffb9202459631a0049448cde905b3c (patch)
tree0ad987c3ffcea30f739cc8e106df2a5f00ad22da /src/argaze.test/GazeAnalysis/NearestNeighborIndex.py
parentd1cdae406d349023eb9e221fd226c05744064dfd (diff)
downloadargaze-e35e90d161ffb9202459631a0049448cde905b3c.zip
argaze-e35e90d161ffb9202459631a0049448cde905b3c.tar.gz
argaze-e35e90d161ffb9202459631a0049448cde905b3c.tar.bz2
argaze-e35e90d161ffb9202459631a0049448cde905b3c.tar.xz
Testing all gaze analysis algorithm. Unifying paper citation.
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