Skip to content

Refactor transformations to rely on scipy directly.#86

Merged
kyleaoman merged 3 commits intomainfrom
fix_rotation
Mar 26, 2026
Merged

Refactor transformations to rely on scipy directly.#86
kyleaoman merged 3 commits intomainfrom
fix_rotation

Conversation

@kyleaoman
Copy link
Copy Markdown
Member

Rotations were inconsistent with the scipy rotation system even though that's how they were asked to be defined. For example:

rotation = scipy.spatial.transform.Rotation.from_matrix(...)  # ... is some rotation matrix
coordinates_before = sg.gas.coordinates
sg.rotate(rotation)
# glossing over Rotation.apply stripping cosmo attributes & comparison of arrays with !=, conceptually:
sg.gas.coordinates != rotation.apply(coordinates_before)  # the inverse was actually applied!

I've refactored the whole coordinate transformation backend to rely much more on scpiy.spatial.transform. Unfortunately it's not directly compatible with unyt_array or cosmo_array, so a little bit of wrapping is still needed, but much of the previous internal ambiguity around .dot(transformation) (or should it be .dot(transformation.T?) has been removed.

@kyleaoman kyleaoman self-assigned this Mar 26, 2026
@kyleaoman kyleaoman added the bug Something isn't working label Mar 26, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e6e7429) to head (936cabd).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #86   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines         2289      2286    -3     
  Branches       260       262    +2     
=========================================
- Hits          2289      2286    -3     

☔ View full report in Codecov by Sentry.
📢 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.

@kyleaoman kyleaoman merged commit 3b63f14 into main Mar 26, 2026
9 checks passed
@kyleaoman kyleaoman deleted the fix_rotation branch March 26, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant