aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThéo de la Hogue2024-03-12 15:31:55 +0100
committerThéo de la Hogue2024-03-12 15:31:55 +0100
commit182844cfbc1462c266245186f97f05986f0170ce (patch)
tree27f322e20ef5f20e3a5db8d454567add62df04e7 /src
parentaf7657659453b8cf19ce7be5447456c86b35d59c (diff)
downloadargaze-182844cfbc1462c266245186f97f05986f0170ce.zip
argaze-182844cfbc1462c266245186f97f05986f0170ce.tar.gz
argaze-182844cfbc1462c266245186f97f05986f0170ce.tar.bz2
argaze-182844cfbc1462c266245186f97f05986f0170ce.tar.xz
Fixing tests.
Diffstat (limited to 'src')
-rw-r--r--src/argaze.test/AreaOfInterest/AOI2DScene.py19
-rw-r--r--src/argaze.test/AreaOfInterest/AOI3DScene.py19
-rw-r--r--src/argaze.test/GazeAnalysis/DispersionThresholdIdentification.py10
-rw-r--r--src/argaze.test/GazeAnalysis/VelocityThresholdIdentification.py2
-rw-r--r--src/argaze.test/GazeFeatures.py16
-rw-r--r--src/argaze/GazeAnalysis/VelocityThresholdIdentification.py2
-rw-r--r--src/argaze/PupillAnalysis/WorkloadIndex.py3
7 files changed, 16 insertions, 55 deletions
diff --git a/src/argaze.test/AreaOfInterest/AOI2DScene.py b/src/argaze.test/AreaOfInterest/AOI2DScene.py
index 10ff430..1649e54 100644
--- a/src/argaze.test/AreaOfInterest/AOI2DScene.py
+++ b/src/argaze.test/AreaOfInterest/AOI2DScene.py
@@ -177,25 +177,6 @@ class TestAOI2DSceneClass(unittest.TestCase):
self.assertEqual(len(aoi_2d_scene_copy.items()), 1)
self.assertEqual(list(aoi_2d_scene_copy.keys()), ["A"])
-class TestTimeStampedAOIScenesClass(unittest.TestCase):
- """Test TimeStampedAOIScenes class."""
-
- def test___setitem__(self):
- """Test TimeStampedAOIScenes creation."""
-
- aoi_2D_A = AOIFeatures.AreaOfInterest([[0, 0], [0, 1], [1, 1], [1, 0]])
- 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_aoi_scenes = AOIFeatures.TimeStampedAOIScenes()
-
- ts_aoi_scenes[0] = aoi_2d_scene
-
- # Check that only AOIScene can be added
- with self.assertRaises(AssertionError):
-
- ts_aoi_scenes[1] = "This string is not an AOI2DScene"
-
if __name__ == '__main__':
unittest.main() \ No newline at end of file
diff --git a/src/argaze.test/AreaOfInterest/AOI3DScene.py b/src/argaze.test/AreaOfInterest/AOI3DScene.py
index d09f2a8..152f545 100644
--- a/src/argaze.test/AreaOfInterest/AOI3DScene.py
+++ b/src/argaze.test/AreaOfInterest/AOI3DScene.py
@@ -97,25 +97,6 @@ class TestAOI3DSceneClass(unittest.TestCase):
self.assertEqual(len(aoi_3d_scene_copy.items()), 1)
self.assertEqual(list(aoi_3d_scene_copy.keys()), ["A"])
-class TestTimeStampedAOIScenesClass(unittest.TestCase):
- """Test TimeStampedAOIScenes class."""
-
- def test___setitem__(self):
- """Test TimeStampedAOIScenes creation."""
-
- aoi_3D_A = AOIFeatures.AreaOfInterest([[0, 0, 0], [0, 1, 0], [1, 1, 0], [1, 0, 0]])
- 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_aoi_scenes = AOIFeatures.TimeStampedAOIScenes()
-
- ts_aoi_scenes[0] = aoi_3d_scene
-
- # Check that only AOIScene can be added
- with self.assertRaises(AssertionError):
-
- ts_aoi_scenes[1] = "This string is not an AOI3DScene"
-
if __name__ == '__main__':
unittest.main() \ No newline at end of file
diff --git a/src/argaze.test/GazeAnalysis/DispersionThresholdIdentification.py b/src/argaze.test/GazeAnalysis/DispersionThresholdIdentification.py
index 1c54bd1..95453d2 100644
--- a/src/argaze.test/GazeAnalysis/DispersionThresholdIdentification.py
+++ b/src/argaze.test/GazeAnalysis/DispersionThresholdIdentification.py
@@ -302,12 +302,12 @@ class TestDispersionThresholdIdentificationClass(unittest.TestCase):
fixation_C = DispersionThresholdIdentification.Fixation(ts_gaze_positions_C)
# Check that fixation doesn't overlap
- self.assertFalse(fixation_A.overlap(fixation_B))
- self.assertFalse(fixation_B.overlap(fixation_A))
+ self.assertFalse(fixation_A.is_overlapping()(fixation_B))
+ self.assertFalse(fixation_B.is_overlapping()(fixation_A))
# Check that fixation overlaps
- self.assertTrue(fixation_B.overlap(fixation_C))
- self.assertTrue(fixation_C.overlap(fixation_B))
+ self.assertTrue(fixation_B.is_overlapping()(fixation_C))
+ self.assertTrue(fixation_C.is_overlapping()(fixation_B))
@unittest.skip("Fixation overlapping is not supported anymore.")
def test_fixation_overlapping_identification(self):
@@ -362,7 +362,7 @@ class TestDispersionThresholdIdentificationClass(unittest.TestCase):
# Iterate on gaze positions
for gaze_position in ts_gaze_positions:
- finished_gaze_movement = gaze_movement_identifier.identify(gaze_position.timestamp, gaze_position, terminate=(gaze_position.timestamp == ts_gaze_positions[-1].timestamp))
+ finished_gaze_movement = gaze_movement_identifier.identify(gaze_position, terminate=(gaze_position.timestamp == ts_gaze_positions[-1].timestamp))
if GazeFeatures.is_fixation(finished_gaze_movement):
diff --git a/src/argaze.test/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze.test/GazeAnalysis/VelocityThresholdIdentification.py
index 051265c..5dce9b2 100644
--- a/src/argaze.test/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze.test/GazeAnalysis/VelocityThresholdIdentification.py
@@ -300,7 +300,7 @@ class TestVelocityThresholdIdentificationClass(unittest.TestCase):
# Iterate on gaze positions
for gaze_position in ts_gaze_positions:
- finished_gaze_movement = gaze_movement_identifier.identify(gaze_position.timestamp, gaze_position, terminate=(gaze_position.timestamp == ts_gaze_positions[-1]))
+ finished_gaze_movement = gaze_movement_identifier.identify(gaze_position, terminate=(gaze_position.timestamp == ts_gaze_positions[-1]))
# Check that last gaze position date is not equal to given gaze position date
if finished_gaze_movement:
diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py
index 2d052ab..11e7c24 100644
--- a/src/argaze.test/GazeFeatures.py
+++ b/src/argaze.test/GazeFeatures.py
@@ -141,16 +141,16 @@ class TestGazePositionClass(unittest.TestCase):
gaze_position_C = GazeFeatures.GazePosition((5, 0), precision=5)
gaze_position_D = GazeFeatures.GazePosition((4, 0), precision=5)
- self.assertFalse(gaze_position_A.overlap(gaze_position_B))
- self.assertTrue(gaze_position_A.overlap(gaze_position_C))
- self.assertFalse(gaze_position_A.overlap(gaze_position_C, both=True))
+ self.assertFalse(gaze_position_A.is_overlapping()(gaze_position_B))
+ self.assertTrue(gaze_position_A.is_overlapping()(gaze_position_C))
+ self.assertFalse(gaze_position_A.is_overlapping()(gaze_position_C, both=True))
- self.assertFalse(gaze_position_B.overlap(gaze_position_A))
- self.assertTrue(gaze_position_B.overlap(gaze_position_C))
- self.assertFalse(gaze_position_B.overlap(gaze_position_C, both=True))
+ self.assertFalse(gaze_position_B.is_overlapping()(gaze_position_A))
+ self.assertTrue(gaze_position_B.is_overlapping()(gaze_position_C))
+ self.assertFalse(gaze_position_B.is_overlapping()(gaze_position_C, both=True))
- self.assertFalse(gaze_position_C.overlap(gaze_position_A))
- self.assertFalse(gaze_position_C.overlap(gaze_position_B))
+ self.assertFalse(gaze_position_C.is_overlapping()(gaze_position_A))
+ self.assertFalse(gaze_position_C.is_overlapping()(gaze_position_B))
def test___repr__(self):
"""Test GazePosition string representation."""
diff --git a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
index 64fd3d0..2ee75e2 100644
--- a/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
+++ b/src/argaze/GazeAnalysis/VelocityThresholdIdentification.py
@@ -173,7 +173,7 @@ class GazeMovementIdentifier(GazeFeatures.GazeMovementIdentifier):
return last_movement
# Velocity
- velocity = abs(gaze_position.distance(self.__last_position) / (timestamp - self.__last_ts))
+ velocity = abs(gaze_position.distance(self.__last_position) / (gaze_position.timestamp - self.__last_ts))
# Remember last position
self.__last_ts = gaze_position.timestamp
diff --git a/src/argaze/PupillAnalysis/WorkloadIndex.py b/src/argaze/PupillAnalysis/WorkloadIndex.py
index f97dce3..3c963e9 100644
--- a/src/argaze/PupillAnalysis/WorkloadIndex.py
+++ b/src/argaze/PupillAnalysis/WorkloadIndex.py
@@ -8,10 +8,9 @@ __copyright__ = "Copyright 2023, Ecole Nationale de l'Aviation Civile (ENAC)"
__license__ = "BSD"
from typing import TypeVar
-from dataclasses import dataclass, field
import math
-from argaze import PupillFeatures
+from argaze import DataFeatures, PupillFeatures
import numpy