Skip to content

[codex] Fix vectorized boolean signature#980

Draft
EltonChang1 wants to merge 1 commit into
StingraySoftware:mainfrom
EltonChang1:codex/fix-vectorized-boolean-type
Draft

[codex] Fix vectorized boolean signature#980
EltonChang1 wants to merge 1 commit into
StingraySoftware:mainfrom
EltonChang1:codex/fix-vectorized-boolean-type

Conversation

@EltonChang1

Copy link
Copy Markdown

Relevant Issue(s)/PR(s)

Fixes #979.

Provide an overview of the implemented solution or the fix and elaborate on the modifications.

Newer Numba versions evaluate signature strings against numba.types, where bool(...) resolves to Python's built-in bool and raises TypeError: bool expected at most 1 argument, got 6 during Stingray import.

This changes the check_powers_for_intrinsic_coherence vectorized signatures to use Numba type objects with an explicit boolean return type instead of parsing bool(...) strings. It also exposes boolean through Stingray's Numba compatibility wrapper, adds scalar regression coverage for the affected function, and includes a bugfix changelog fragment.

Is there a new dependency introduced by your contribution? If so, please specify.

No new dependencies.

Any other comments?

Validation performed:

  • .venv/bin/python -m pytest stingray/tests/test_fourier.py -q with NumPy 2.4.6, Astropy 8.0.0, Numba 0.65.1: 199 passed.
  • .venv/bin/python -m pytest stingray/tests/test_fourier.py -k check_powers_for_intrinsic_coherence -q with NumPy 1.24.4, Astropy 6.1.3, Matplotlib 3.10.9, Numba 0.65.1: 1 passed, 198 deselected.
  • Manual import check with NumPy 1.24.4, Astropy 6.1.3, Matplotlib 3.10.9, Numba 0.65.1: import stingray succeeds and check_powers_for_intrinsic_coherence(...) returns normally.
  • git diff --check.

Limitations: I did not run the full repository test suite.

AI disclosure: OpenAI Codex/ChatGPT was used to inspect the issue, identify the affected signature, make the code/test/changelog edits, and draft this PR description. The final patch was validated locally with the checks listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stingray incorrectly referencing boolean type

1 participant