GalacticDynamics / unxt

Unitful Quantities in JAX
https://unxt.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11 stars 3 forks source link

Add concept of unitsystem flags and enable overriding / extending unit systems #219

Closed adrn closed 3 days ago

adrn commented 4 days ago

This adds a new (currently not used) set of Flag types so we can dispatch on the type of unit system (will be useful for the follow-up to add a new SimulationUnitSystem). This also adds the ability to extend or override units in an existing unit system via:

>>> usys = unitsystem(...)
>>> new_usys = unitsystem(usys, u.pc, u.erg)
codecov[bot] commented 4 days ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.03%. Comparing base (33059de) to head (8218632). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #219 +/- ## ========================================== + Coverage 95.98% 96.03% +0.05% ========================================== Files 40 41 +1 Lines 1543 1565 +22 ========================================== + Hits 1481 1503 +22 Misses 62 62 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

adrn commented 3 days ago

OK I think this is ready for another look. IMO we don't need to test AbstractUnitSystemFlag but coverage is complaining about it...

adrn commented 3 days ago

Previous approving review - rebased and added a test for coverage completeness 💅.