From b947573f7dbccb5b2b13b64677192145f2dbb864 Mon Sep 17 00:00:00 2001 From: Theo De La Hogue Date: Fri, 22 Sep 2023 22:06:20 +0200 Subject: Working on AOI frame feature: now 2D AOI in scene frame are merged into 3D AOI in scene layer. --- src/argaze.test/AreaOfInterest/AOIFeatures.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/argaze.test') diff --git a/src/argaze.test/AreaOfInterest/AOIFeatures.py b/src/argaze.test/AreaOfInterest/AOIFeatures.py index bced0aa..6df33ca 100644 --- a/src/argaze.test/AreaOfInterest/AOIFeatures.py +++ b/src/argaze.test/AreaOfInterest/AOIFeatures.py @@ -118,13 +118,17 @@ class TestAreaOfInterestClass(unittest.TestCase): aoi_2D = AOIFeatures.AreaOfInterest([[0, 0], [0, 2], [2, 2], [2, 0]]) - self.assertEqual(aoi_2D.inner_axis((1, 1)), (0.5, 0.5)) + self.assertEqual(aoi_2D.inner_axis(1, 1), (0.5, 0.5)) def test_outter_axis(self): aoi_2D = AOIFeatures.AreaOfInterest([[0, 0], [0, 2], [2, 2], [2, 0]]) - self.assertEqual(aoi_2D.outter_axis((0.5, 0.5)), (1, 1)) + self.assertEqual(aoi_2D.outter_axis(0.5, 0.5), (1, 1)) + + aoi_3D = AOIFeatures.AreaOfInterest([[1, 0, 0], [1, 0, 2], [1, 2, 2], [1, 2, 0]]) + + self.assertEqual(aoi_3D.outter_axis(0.5, 0.5), (1, 1, 1)) def test_circle_intersection(self): @@ -181,21 +185,15 @@ class TestAOISceneClass(unittest.TestCase): aoi_2d_scene_AB["A"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]]) aoi_2d_scene_AB["B"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 2], [2, 2], [2, 0]]) - print('aoi_2d_scene_AB vars: ', vars(aoi_2d_scene_AB)) - # Create second scene with C and D aoi aoi_2d_scene_CD = AOIFeatures.AOIScene(2,) aoi_2d_scene_CD["C"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 3], [3, 3], [3, 0]]) aoi_2d_scene_CD["D"] = AOIFeatures.AreaOfInterest([[0, 0], [0, 4], [4, 4], [4, 0]]) - print('aoi_2d_scene_CD vars: ', vars(aoi_2d_scene_CD)) - # Merge first scene and second scene into a third scene aoi_2d_scene_ABCD = aoi_2d_scene_AB | aoi_2d_scene_CD - print('aoi_2d_scene_ABCD vars: ', vars(aoi_2d_scene_ABCD)) - # Check third scene self.assertEqual(aoi_2d_scene_ABCD.dimension, 2) self.assertEqual(len(aoi_2d_scene_ABCD.items()), 4) @@ -205,8 +203,6 @@ class TestAOISceneClass(unittest.TestCase): # Merge second scene into first scene aoi_2d_scene_AB |= aoi_2d_scene_CD - print('aoi_2d_scene_AB vars: ', vars(aoi_2d_scene_AB)) - # Check first scene self.assertEqual(aoi_2d_scene_AB.dimension, 2) self.assertEqual(len(aoi_2d_scene_AB.items()), 4) -- cgit v1.1 From 12ae7e20aba323624d360567ea424ac2d315fbc7 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 26 Sep 2023 10:47:43 +0200 Subject: Harmonizing AOI/aoi without s at the end. --- src/argaze.test/AreaOfInterest/AOI2DScene.py | 6 +++--- src/argaze.test/AreaOfInterest/AOI3DScene.py | 6 +++--- src/argaze.test/GazeFeatures.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/argaze.test') diff --git a/src/argaze.test/AreaOfInterest/AOI2DScene.py b/src/argaze.test/AreaOfInterest/AOI2DScene.py index 4e96e98..10ff430 100644 --- a/src/argaze.test/AreaOfInterest/AOI2DScene.py +++ b/src/argaze.test/AreaOfInterest/AOI2DScene.py @@ -187,14 +187,14 @@ class TestTimeStampedAOIScenesClass(unittest.TestCase): aoi_2D_B = AOIFeatures.AreaOfInterest([[1, 1], [1, 2], [2, 2], [2, 1]]) aoi_2d_scene = AOI2DScene.AOI2DScene({"A": aoi_2D_A, "B": aoi_2D_B}) - ts_aois_scenes = AOIFeatures.TimeStampedAOIScenes() + ts_aoi_scenes = AOIFeatures.TimeStampedAOIScenes() - ts_aois_scenes[0] = aoi_2d_scene + ts_aoi_scenes[0] = aoi_2d_scene # Check that only AOIScene can be added with self.assertRaises(AssertionError): - ts_aois_scenes[1] = "This string is not an AOI2DScene" + ts_aoi_scenes[1] = "This string is not an AOI2DScene" if __name__ == '__main__': diff --git a/src/argaze.test/AreaOfInterest/AOI3DScene.py b/src/argaze.test/AreaOfInterest/AOI3DScene.py index b386432..d09f2a8 100644 --- a/src/argaze.test/AreaOfInterest/AOI3DScene.py +++ b/src/argaze.test/AreaOfInterest/AOI3DScene.py @@ -107,14 +107,14 @@ class TestTimeStampedAOIScenesClass(unittest.TestCase): aoi_3D_B = AOIFeatures.AreaOfInterest([[1, 1, 0], [1, 2, 0], [2, 2, 0], [2, 1, 0]]) aoi_3d_scene = AOI3DScene.AOI3DScene({"A": aoi_3D_A, "B": aoi_3D_B}) - ts_aois_scenes = AOIFeatures.TimeStampedAOIScenes() + ts_aoi_scenes = AOIFeatures.TimeStampedAOIScenes() - ts_aois_scenes[0] = aoi_3d_scene + ts_aoi_scenes[0] = aoi_3d_scene # Check that only AOIScene can be added with self.assertRaises(AssertionError): - ts_aois_scenes[1] = "This string is not an AOI3DScene" + ts_aoi_scenes[1] = "This string is not an AOI3DScene" if __name__ == '__main__': diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py index d609dd2..b41c7c7 100644 --- a/src/argaze.test/GazeFeatures.py +++ b/src/argaze.test/GazeFeatures.py @@ -497,10 +497,10 @@ class TestAOIScanStepClass(unittest.TestCase): aoi_scan_step = GazeFeatures.AOIScanStep(movements, 'Test') -def build_aoi_scan_path(expected_aois, aoi_path): +def build_aoi_scan_path(expected_aoi, aoi_path): """Build AOI scan path""" - aoi_scan_path = GazeFeatures.AOIScanPath(expected_aois) + aoi_scan_path = GazeFeatures.AOIScanPath(expected_aoi) # Append a hidden last step to allow last given step creation aoi_path.append(aoi_path[-2]) -- cgit v1.1 From d7107ed868229b9665ee7432dcdc1da90c97c75a Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Tue, 10 Oct 2023 16:25:56 +0200 Subject: Replacing ExploitExplore by ExploreExploit. --- src/argaze.test/GazeAnalysis/ExploitExploreRatio.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/argaze.test') diff --git a/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py b/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py index 0e6b74a..7b323d4 100644 --- a/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py +++ b/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py @@ -10,7 +10,7 @@ __license__ = "BSD" import unittest from argaze import GazeFeatures -from argaze.GazeAnalysis import ExploitExploreRatio +from argaze.GazeAnalysis import ExploreExploitRatio from argaze.utils import UtilsFeatures GazeFeaturesTest = UtilsFeatures.importFromTestPackage('GazeFeatures') @@ -21,7 +21,7 @@ class TestScanPathAnalyzer(unittest.TestCase): def test_analyze(self): """Test analyze method.""" - xxr_analyzer = ExploitExploreRatio.ScanPathAnalyzer() + xxr_analyzer = ExploreExploitRatio.ScanPathAnalyzer() scan_path = GazeFeaturesTest.build_scan_path(10) @@ -31,7 +31,7 @@ class TestScanPathAnalyzer(unittest.TestCase): xxr_analyzer.analyze(scan_path) # Check exploit explore ratio: it should greater than 1 because of build_scan_path - self.assertGreaterEqual(xxr_analyzer.exploit_explore_ratio, 1.) + self.assertGreaterEqual(xxr_analyzer.explore_exploit_ratio, 1.) if __name__ == '__main__': -- cgit v1.1 From 46b2ac7ea7fb83d520d3fe5deee46d629d6dc9d0 Mon Sep 17 00:00:00 2001 From: Théo de la Hogue Date: Wed, 11 Oct 2023 07:34:33 +0200 Subject: renaming test file. --- .../GazeAnalysis/ExploitExploreRatio.py | 38 ---------------------- .../GazeAnalysis/ExploreExploitRatio.py | 38 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 38 deletions(-) delete mode 100644 src/argaze.test/GazeAnalysis/ExploitExploreRatio.py create mode 100644 src/argaze.test/GazeAnalysis/ExploreExploitRatio.py (limited to 'src/argaze.test') diff --git a/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py b/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py deleted file mode 100644 index 7b323d4..0000000 --- a/src/argaze.test/GazeAnalysis/ExploitExploreRatio.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/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 ExploreExploitRatio -from argaze.utils import UtilsFeatures - -GazeFeaturesTest = UtilsFeatures.importFromTestPackage('GazeFeatures') - -class TestScanPathAnalyzer(unittest.TestCase): - """Test ScanPathAnalyzer class.""" - - def test_analyze(self): - """Test analyze method.""" - - xxr_analyzer = ExploreExploitRatio.ScanPathAnalyzer() - - scan_path = GazeFeaturesTest.build_scan_path(10) - - # Check scan path - self.assertEqual(len(scan_path), 10) - - xxr_analyzer.analyze(scan_path) - - # Check exploit explore ratio: it should greater than 1 because of build_scan_path - self.assertGreaterEqual(xxr_analyzer.explore_exploit_ratio, 1.) - -if __name__ == '__main__': - - unittest.main() \ No newline at end of file diff --git a/src/argaze.test/GazeAnalysis/ExploreExploitRatio.py b/src/argaze.test/GazeAnalysis/ExploreExploitRatio.py new file mode 100644 index 0000000..7b323d4 --- /dev/null +++ b/src/argaze.test/GazeAnalysis/ExploreExploitRatio.py @@ -0,0 +1,38 @@ +#!/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 ExploreExploitRatio +from argaze.utils import UtilsFeatures + +GazeFeaturesTest = UtilsFeatures.importFromTestPackage('GazeFeatures') + +class TestScanPathAnalyzer(unittest.TestCase): + """Test ScanPathAnalyzer class.""" + + def test_analyze(self): + """Test analyze method.""" + + xxr_analyzer = ExploreExploitRatio.ScanPathAnalyzer() + + scan_path = GazeFeaturesTest.build_scan_path(10) + + # Check scan path + self.assertEqual(len(scan_path), 10) + + xxr_analyzer.analyze(scan_path) + + # Check exploit explore ratio: it should greater than 1 because of build_scan_path + self.assertGreaterEqual(xxr_analyzer.explore_exploit_ratio, 1.) + +if __name__ == '__main__': + + unittest.main() \ No newline at end of file -- cgit v1.1