From 2a509a307e9ba47cf86831f83fa29fd41de1cac8 Mon Sep 17 00:00:00 2001 From: Alexander Druz Date: Tue, 19 Sep 2023 12:04:49 +0200 Subject: [PATCH] Fix dtype checks in descriptors --- renumics/spotlight/dataset/descriptors/__init__.py | 2 +- renumics/spotlight/dataset/descriptors/data_alignment.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/renumics/spotlight/dataset/descriptors/__init__.py b/renumics/spotlight/dataset/descriptors/__init__.py index 6e44966a..9925c590 100644 --- a/renumics/spotlight/dataset/descriptors/__init__.py +++ b/renumics/spotlight/dataset/descriptors/__init__.py @@ -78,7 +78,7 @@ def catch22( if suffix is None: suffix = "catch24" if catch24 else "catch22" dtype = dataset.get_dtype(column) - if dtypes.is_audio_dtype(dtype) or dtypes.is_sequence_1d_dtype(dtype): + if not dtypes.is_audio_dtype(dtype) and not dtypes.is_sequence_1d_dtype(dtype): raise InvalidDTypeError( f"catch22 is only applicable to columns of type `Audio` and " f'`Sequence1D`, but column "{column}" of type {dtype} received.' diff --git a/renumics/spotlight/dataset/descriptors/data_alignment.py b/renumics/spotlight/dataset/descriptors/data_alignment.py index 8410b49b..b409eda4 100644 --- a/renumics/spotlight/dataset/descriptors/data_alignment.py +++ b/renumics/spotlight/dataset/descriptors/data_alignment.py @@ -83,7 +83,7 @@ def align_image_data(dataset: Dataset, column: str) -> Tuple[np.ndarray, np.ndar Align data from an image column. """ dtype = dataset.get_dtype(column) - if dtypes.is_image_dtype(dtype): + if not dtypes.is_image_dtype(dtype): raise exceptions.InvalidDTypeError( f'An image column expected, but column "{column}" of type {dtype} received.' ) @@ -125,7 +125,7 @@ def align_sequence_1d_data( Align data from an sequence 1D column. """ dtype = dataset.get_dtype(column) - if dtypes.is_sequence_1d_dtype(dtype): + if not dtypes.is_sequence_1d_dtype(dtype): raise exceptions.InvalidDTypeError( f'A sequence 1D column expected, but column "{column}" of type {dtype} received.' )