Skip to content

Commit

Permalink
Fix dtype checks in descriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
druzsan committed Sep 19, 2023
1 parent bdfe271 commit 2a509a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion renumics/spotlight/dataset/descriptors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
4 changes: 2 additions & 2 deletions renumics/spotlight/dataset/descriptors/data_alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
)
Expand Down Expand Up @@ -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.'
)
Expand Down

0 comments on commit 2a509a3

Please sign in to comment.