Skip to content

Fix vectorized boolean signature - #980

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

Fix vectorized boolean signature#980
EltonChang1 wants to merge 4 commits 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.

@matteobachetti

Copy link
Copy Markdown
Member

@EltonChang1 thanks for your PR! Please fix the name of the change log ;)

Signed-off-by: Elton Chang <tchang52@ucsc.edu>
@EltonChang1

Copy link
Copy Markdown
Author

Fixed in 74b8ee5: the Towncrier fragment is now docs/changes/980.bugfix.rst, matching this PR number. The focused coherence-power regression still passes (1 passed, 198 deselected), and git diff --check passes.

@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 80.39%. Comparing base (840569c) to head (74b8ee5).

Files with missing lines Patch % Lines
stingray/utils.py 50.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (840569c) and HEAD (74b8ee5). Click for more details.

HEAD has 99 uploads less than BASE
Flag BASE (840569c) HEAD (74b8ee5)
103 4
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #980       +/-   ##
===========================================
- Coverage   96.23%   80.39%   -15.85%     
===========================================
  Files          48       48               
  Lines       10099    10099               
===========================================
- Hits         9719     8119     -1600     
- Misses        380     1980     +1600     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Elton Chang <tchang52@ucsc.edu>
Signed-off-by: Elton Chang <tchang52@ucsc.edu>
@EltonChang1

Copy link
Copy Markdown
Author

Addressed the patch-coverage failure in 4f0a672 by separating the no-Numba boolean fallback alias and marking that import-fallback-only line with the project’s existing coverage pragma. Focused validation passes: the coherence-power regression (1 passed, 198 deselected), the full Fourier test module (199 passed), and git diff --check. The link-check failure is unrelated to this change; it reports pre-existing external URLs in docs/history.rst, docs/contributing.rst, and the modeling notebook.

@EltonChang1 EltonChang1 changed the title [codex] Fix vectorized boolean signature Fix vectorized boolean signature Aug 29, 2026
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

2 participants