-
Notifications
You must be signed in to change notification settings - Fork 4
✨ feat(all): uconvert_value for value conversion, not requiring Quantity
#550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
uconvert_value for value conversion, not requiring Quantity
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #550 +/- ##
==========================================
- Coverage 96.90% 96.84% -0.06%
==========================================
Files 54 44 -10
Lines 2260 2158 -102
Branches 82 77 -5
==========================================
- Hits 2190 2090 -100
+ Misses 53 52 -1
+ Partials 17 16 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces a new uconvert_value function that performs unit conversions on raw numerical values without requiring Quantity objects. This is a lower-level function compared to uconvert, enabling high-performance batch conversions and seamless integration with JAX transformations.
Changes:
- Added
uconvert_valueas an abstract dispatch function to theunxt-apipackage - Implemented multiple dispatches for different unit type combinations (strings, AbstractUnit, AbstractUnitSystem)
- Added Astropy interop support with hot-path optimization for identical units
- Provided comprehensive test coverage including JAX transformations, edge cases, and error handling
- Updated documentation with detailed API reference and usage examples
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/unxt-api/src/unxt_api/_src/quantity.py |
Adds abstract uconvert_value dispatch function definition |
packages/unxt-api/src/unxt_api/__init__.py |
Exports uconvert_value from the API package |
packages/unxt-api/tests/test_quantity.py |
Tests for abstract dispatch functionality of uconvert_value |
packages/unxt-api/tests/test_package.py |
Verifies uconvert_value is properly exported |
packages/unxt-api/docs/api.md |
Comprehensive documentation for the new function |
src/unxt/_src/quantity/register_api.py |
Implements dispatches for unit systems, strings, AbstractUnit, and convenience Quantity dispatch |
src/unxt/_interop/unxt_interop_astropy/quantity.py |
Adds Astropy unit support with hot-path optimization |
src/unxt/quantity.py |
Exports uconvert_value from main package |
src/unxt/__init__.py |
Adds uconvert_value to top-level exports |
src/unxt/_src/quantity/base.py |
Refactors to use uapi prefix for consistency |
tests/unit/test_quantity.py |
Extensive tests for all uconvert_value dispatches |
tests/unit/test_astropy_interop_quantity.py |
Tests for Astropy interop including JAX transformations |
docs/interop/astropy.md |
Documentation for Astropy integration |
docs/guides/quantity.md |
User guide with examples and best practices |
Signed-off-by: nstarman <nstarman@users.noreply.github.com>
bb4db4c to
424e71e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.
No description provided.