Fix NumPy array handling for plot limits - #2000
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughChangesNumPy plot limits
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change fixes NumPy plot-limit handling and adds regression coverage; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the problem, solution, affected functions, issue reference, regression test, validation results, and checklist status. It also documents the three environment-related test failures and their fallback reruns.
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I noticed after opening this PR that @BHARATH0153 had already described a fix for item 1 in #1978. I’m sorry I missed that comment. I couldn’t find a linked PR or public branch for the change, so could you confirm whether that work is still active? |
What does this PR do?
prepare_for_plot()currently checks for empty limits usinglimits == [].For NumPy arrays, this performs an element-wise comparison and can raise a
broadcasting error.
This PR replaces that comparison with a length check, updates the
pairplot()and
marginal_plot()type hints to include NumPy arrays, and adds a regressiontest verifying that NumPy limits are applied to the correct plot axes.
Does this close any issues?
Addresses the NumPy limits item in #1978.
Anything else we should know?
Validation performed:
uv run pytest tests/plot_test.py: 496 passed, 9 xfailed.uv run pyright sbi: 0 errors.xfailed, and three environment-related PyTensor failures. Those three tests
passed when rerun using PyTensor's Python fallback instead of the incompatible
local MinGW compiler.
Checklist
uv run pytest -n auto -m "not slow and not gpu"passes.uv run pre-commit run --all-filespasses (ruff and formatting).uv run pyright sbipasses.with
pytest.mark.slow.