diff --git a/docs/changes/979.bugfix.rst b/docs/changes/979.bugfix.rst new file mode 100644 index 000000000..f758c05a9 --- /dev/null +++ b/docs/changes/979.bugfix.rst @@ -0,0 +1 @@ +Stingray can now be imported with newer Numba versions that no longer accept ``bool(...)`` in vectorized function signatures. diff --git a/stingray/fourier.py b/stingray/fourier.py index 00de2eae3..8a40834ef 100644 --- a/stingray/fourier.py +++ b/stingray/fourier.py @@ -23,6 +23,9 @@ rebin_data, njit, vectorize, + boolean, + float64, + int64, ) @@ -979,8 +982,8 @@ def _intrinsic_coherence_uncertainties( @vectorize( [ - "bool(float64, float64, float64, float64, int64, float64)", - "bool(float64, float64, float64, float64, float64, float64)", + boolean(float64, float64, float64, float64, int64, float64), + boolean(float64, float64, float64, float64, float64, float64), ], nopython=True, ) diff --git a/stingray/tests/test_fourier.py b/stingray/tests/test_fourier.py index 13d9c8c9b..138508887 100644 --- a/stingray/tests/test_fourier.py +++ b/stingray/tests/test_fourier.py @@ -316,6 +316,9 @@ def test_check_powers_for_intrinsic_coherence(self): res = check_powers_for_intrinsic_coherence(pow1, pow2, pow1_noise, pow2_noise, n_ave, 3.0) assert np.all(res == np.array([True, False, False])) + scalar_res = check_powers_for_intrinsic_coherence(10, 10, pow1_noise, pow2_noise, 1, 3.0) + assert scalar_res is True or scalar_res == np.bool_(True) + class TestFourier(object): @classmethod diff --git a/stingray/utils.py b/stingray/utils.py index fc4eb923b..d2263ea68 100644 --- a/stingray/utils.py +++ b/stingray/utils.py @@ -77,14 +77,14 @@ def decorator(func, *a, **kw): def generic(*args, **kwargs): return None - float32 = float64 = int32 = int64 = generic + float32 = float64 = int32 = int64 = boolean = generic def prange(x): return range(x) if HAS_NUMBA: - from numba import njit, prange, vectorize, float32, float64, int32, int64 + from numba import njit, prange, vectorize, float32, float64, int32, int64, boolean from numba.core.errors import NumbaValueError, NumbaNotImplementedError, TypingError