Skip to content

docs(space_ops): fix return order in cartesian_to_spherical docstring#4867

Open
SupernovaIa wants to merge 1 commit into
ManimCommunity:mainfrom
SupernovaIa:docs/cartesian-to-spherical-order
Open

docs(space_ops): fix return order in cartesian_to_spherical docstring#4867
SupernovaIa wants to merge 1 commit into
ManimCommunity:mainfrom
SupernovaIa:docs/cartesian-to-spherical-order

Conversation

@SupernovaIa

Copy link
Copy Markdown

Summary

cartesian_to_spherical's docstring says it returns (distance, phi, theta), but the function actually returns np.array([r, theta, phi]) — i.e. (distance, theta, phi). This matches spherical_to_cartesian's own docstring/unpacking order (r, theta, phi = spherical), and matches the existing test (test_polar_coords in tests/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 passed
  • uv run pre-commit run --files manim/utils/space_ops.py — ruff, mypy, codespell all pass
  • Checked the one internal usage of this function (arc.py's angles[1] for the azimuthal angle) already assumes the (r, theta, phi) order, confirming the code was always correct and only the docstring was stale

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
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.

Confusing/Misleading docstring for cartesian_to_spherical

1 participant