Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changes/979.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stingray can now be imported with newer Numba versions that no longer accept ``bool(...)`` in vectorized function signatures.
7 changes: 5 additions & 2 deletions stingray/fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
rebin_data,
njit,
vectorize,
boolean,
float64,
int64,
)


Expand Down Expand Up @@ -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,
)
Expand Down
3 changes: 3 additions & 0 deletions stingray/tests/test_fourier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions stingray/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading