docs(space_ops): fix return order in cartesian_to_spherical docstring#4867
Open
SupernovaIa wants to merge 1 commit into
Open
docs(space_ops): fix return order in cartesian_to_spherical docstring#4867SupernovaIa wants to merge 1 commit into
SupernovaIa wants to merge 1 commit into
Conversation
The docstring claimed the returned array is (distance, phi, theta), but the function actually returns np.array([r, theta, phi]) -- matching spherical_to_cartesian's own docstring/unpacking order (r, theta, phi). Only the docstring text was wrong; no behavior change. Refs ManimCommunity#3123
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cartesian_to_spherical's docstring says it returns(distance, phi, theta), but the function actually returnsnp.array([r, theta, phi])— i.e.(distance, theta, phi). This matchesspherical_to_cartesian's own docstring/unpacking order (r, theta, phi = spherical), and matches the existing test (test_polar_coordsintests/module/utils/test_space_ops.py), which already asserts the(r, theta, phi)order. The only thing wrong was the docstring text.For context: the 0.12.0 changelog references #2168, which fixed the actual return order of this function — the docstring just never got updated to match at the time.
No behavior change, docs only.
Fixes #3123
Test plan
uv run pytest tests/module/utils/test_space_ops.py -v— 8 passeduv run pre-commit run --files manim/utils/space_ops.py— ruff, mypy, codespell all passarc.py'sangles[1]for the azimuthal angle) already assumes the(r, theta, phi)order, confirming the code was always correct and only the docstring was stale