diff --git a/src/pymovements/gaze/gaze_dataframe.py b/src/pymovements/gaze/gaze_dataframe.py index 81fab5357..592ec58ed 100644 --- a/src/pymovements/gaze/gaze_dataframe.py +++ b/src/pymovements/gaze/gaze_dataframe.py @@ -646,21 +646,22 @@ def _infer_eye_components(self, eye: str) -> tuple[int, int]: elif eye == 'left': if isinstance(self.n_components, int) and self.n_components < 4: # Left only makes sense if there are at least two eyes. - raise AttributeError() + raise AttributeError('right eye is only supported for at least binocular data') eye_components = 0, 1 elif eye == 'right': if isinstance(self.n_components, int) and self.n_components < 4: # Right only makes sense if there are at least two eyes. - raise AttributeError() + raise AttributeError('right eye is only supported for at least binocular data') eye_components = 2, 3 elif eye == 'cyclops': if isinstance(self.n_components, int) and self.n_components < 6: - raise AttributeError() + raise AttributeError('cyclops components are not available') eye_components = 4, 5 - elif eye == 'mono': - eye_components = 0, 1 else: - raise ValueError() + raise ValueError( + f'value {eye} for eye is not supported. ' + f"Supported values are: ['auto', 'left', 'right', 'cyclops', 'mono']", + ) return eye_components diff --git a/tests/dataset/dataset_test.py b/tests/dataset/dataset_test.py index 9e2f99c1c..4e6348875 100644 --- a/tests/dataset/dataset_test.py +++ b/tests/dataset/dataset_test.py @@ -756,7 +756,7 @@ def test_detect_events_multiple_calls( { 'method': 'microsaccades', 'threshold': 1, - 'eye': 'left', + 'eye': 'auto', 'clear': False, 'verbose': True, }, @@ -771,7 +771,7 @@ def test_detect_events_alias(dataset_configuration, detect_kwargs, monkeypatch): dataset.pos2vel() mock = Mock() - monkeypatch.setattr(dataset, 'detect_events', mock) + monkeypatch.setattr(dataset, 'detect', mock) dataset.detect(**detect_kwargs) mock.assert_called_with(**detect_kwargs) diff --git a/tests/gaze/detect_test.py b/tests/gaze/detect_test.py index 3132ec7fd..5ed6f16dc 100644 --- a/tests/gaze/detect_test.py +++ b/tests/gaze/detect_test.py @@ -526,7 +526,7 @@ events=pm.EventDataFrame(name='fixation', onsets=[0], offsets=[100]), ), pm.EventDataFrame(), - id='fixation_from_start_to_end_no_fill', + id='fill_fixation_from_start_to_end_no_fill', ), pytest.param( @@ -541,7 +541,7 @@ onsets=[0], offsets=[9], ), - id='fixation_10_ms_after_start_to_end_single_fill', + id='fill_fixation_10_ms_after_start_to_end_single_fill', ), pytest.param( @@ -556,7 +556,7 @@ onsets=[90], offsets=[99], ), - id='fixation_from_start_to_10_ms_before_end_single_fill', + id='fill_fixation_from_start_to_10_ms_before_end_single_fill', ), pytest.param( @@ -571,7 +571,7 @@ onsets=[40], offsets=[49], ), - id='fixation_10_ms_break_at_40ms_single_fill', + id='fill_fixation_10_ms_break_at_40ms_single_fill', ), pytest.param( @@ -588,7 +588,7 @@ onsets=[40], offsets=[49], ), - id='fixation_10_ms_break_then_saccade_until_end_single_fill', + id='fill_fixation_10_ms_break_then_saccade_until_end_single_fill', ), ], )