diff options
-rw-r--r-- | docs/user_guide/gaze_analysis/scan_path.md | 8 | ||||
-rw-r--r-- | src/argaze.test/GazeFeatures.py | 4 | ||||
-rw-r--r-- | src/argaze/GazeAnalysis/LempelZivComplexity.py | 2 | ||||
-rw-r--r-- | src/argaze/GazeAnalysis/NGram.py | 2 | ||||
-rw-r--r-- | src/argaze/GazeFeatures.py | 8 |
5 files changed, 10 insertions, 14 deletions
diff --git a/docs/user_guide/gaze_analysis/scan_path.md b/docs/user_guide/gaze_analysis/scan_path.md index 60e9d31..fba0524 100644 --- a/docs/user_guide/gaze_analysis/scan_path.md +++ b/docs/user_guide/gaze_analysis/scan_path.md @@ -132,18 +132,18 @@ lzc_analyzer = LempelZivComplexity.AOIScanPathAnalyzer() The [AOIScanPath](../../../argaze/#argaze.GazeFeatures.AOIScanPath) class provides some advanced features to analyse it. -#### String representation +#### Letter sequence When a new [AOIScanStep](../../../argaze/#argaze.GazeFeatures.AOIScanStep) is created, the [AOIScanPath](../../../argaze/#argaze.GazeFeatures.AOIScanPath) internally affects a unique letter index related to its AOI to ease pattern analysis. -Then, the [AOIScanPath str](../../../argaze/#argaze.GazeFeatures.AOIScanPath.__str__) representation returns the concatenation of each [AOIScanStep](../../../argaze/#argaze.GazeFeatures.AOIScanStep) letter. +Then, the [AOIScanPath letter_sequence](../../../argaze/#argaze.GazeFeatures.AOIScanPath.letter_sequence) property returns the concatenation of each [AOIScanStep](../../../argaze/#argaze.GazeFeatures.AOIScanStep) letter. The [AOIScanPath get_letter_aoi](../../../argaze/#argaze.GazeFeatures.AOIScanPath.get_letter_aoi) method helps to get back the AOI related to a letter index. ``` python # Assuming the following AOI scan path is built: Foo > Bar > Shu > Foo aoi_scan_path = ... -# String representation should be: 'ABCA' -print(str(aoi_scan_path)) +# Letter sequence representation should be: 'ABCA' +print(aoi_scan_path.letter_sequence) # Output should be: 'Bar' print(aoi_scan_path.get_letter_aoi('B')) diff --git a/src/argaze.test/GazeFeatures.py b/src/argaze.test/GazeFeatures.py index a6709cb..d609dd2 100644 --- a/src/argaze.test/GazeFeatures.py +++ b/src/argaze.test/GazeFeatures.py @@ -631,8 +631,8 @@ class TestAOIScanPathClass(unittest.TestCase): self.assertEqual(aoi_scan_path.get_letter_aoi('B'), 'Shu') self.assertEqual(aoi_scan_path.get_letter_aoi('C'), 'Foo') - # Check string representation - self.assertEqual(str(aoi_scan_path), 'ABCA') + # Check letter sequence representation + self.assertEqual(aoi_scan_path.letter_sequence, 'ABCA') def test_transition_matrix(self): """Test AOIScanPath transition matrix feature.""" diff --git a/src/argaze/GazeAnalysis/LempelZivComplexity.py b/src/argaze/GazeAnalysis/LempelZivComplexity.py index c836235..82ef05f 100644 --- a/src/argaze/GazeAnalysis/LempelZivComplexity.py +++ b/src/argaze/GazeAnalysis/LempelZivComplexity.py @@ -33,7 +33,7 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): assert(len(aoi_scan_path) > 1) - self.__lempel_ziv_complexity = lempel_ziv_complexity(str(aoi_scan_path)) + self.__lempel_ziv_complexity = lempel_ziv_complexity(aoi_scan_path.letter_sequence) @property def lempel_ziv_complexity(self) -> int: diff --git a/src/argaze/GazeAnalysis/NGram.py b/src/argaze/GazeAnalysis/NGram.py index 662060e..bee9767 100644 --- a/src/argaze/GazeAnalysis/NGram.py +++ b/src/argaze/GazeAnalysis/NGram.py @@ -40,7 +40,7 @@ class AOIScanPathAnalyzer(GazeFeatures.AOIScanPathAnalyzer): assert(len(aoi_scan_path) > 1) - sequence = str(aoi_scan_path) + sequence = aoi_scan_path.letter_sequence self.__ngrams_count = {} diff --git a/src/argaze/GazeFeatures.py b/src/argaze/GazeFeatures.py index 224e2d9..bb5f991 100644 --- a/src/argaze/GazeFeatures.py +++ b/src/argaze/GazeFeatures.py @@ -799,11 +799,6 @@ class AOIScanPath(list): self.expected_aois = expected_aois self.__duration = 0 - - def __repr__(self): - """String representation.""" - - return str(super()) @property def duration(self) -> float: @@ -846,7 +841,8 @@ class AOIScanPath(list): return self.__letter_aoi[letter] - def __str__(self) -> str: + @property + def letter_sequence(self) -> str: """Convert aoi scan path into a string with unique letter per aoi step.""" sequence = '' |