diff --git a/sed/calibrator/energy.py b/sed/calibrator/energy.py index ec19f72e..d09d5923 100644 --- a/sed/calibrator/energy.py +++ b/sed/calibrator/energy.py @@ -1732,10 +1732,8 @@ def peakdetect1d( if lookahead < 1: raise ValueError("Lookahead must be '1' or above in value") - if not (np.isscalar(delta) and cast(int, delta) >= 0): + if not (np.ndim(delta) == 0 and delta >= 0): raise ValueError("delta must be a positive number") - # Hack because TypeGuard with numpy 1.22.4 seems broken - delta = cast(int, delta) # maxima and minima candidates are temporarily stored in # mx and mn respectively diff --git a/tests/test_binning.py b/tests/test_binning.py index fceceb78..74062cb5 100644 --- a/tests/test_binning.py +++ b/tests/test_binning.py @@ -1,7 +1,6 @@ """This file contains code that performs several tests for the sed.binning module """ from typing import Any -from typing import cast from typing import List from typing import Sequence from typing import Tuple @@ -394,9 +393,8 @@ def test_simplify_binning_arguments( ranges_, ) - for i, bin_ in enumerate(bins__): - # TODO: Why does typing fail? - np.testing.assert_array_equal(cast(np.ndarray, bin_), bins_expected[i]) + for i, _ in enumerate(bins__): + np.testing.assert_array_equal(bins__[i], bins_expected[i]) np.testing.assert_array_equal(axes__[i], axes_expected[i]) if ranges__ is not None: np.testing.assert_array_equal(ranges__[i], ranges_expected[i])