Skip to content

Interoperability with other units packages / future merging? #8210

Open

Description

@mhvk

From a short discussion at the coordination meeting: there are quite a few units packages around, which implement basically the same functionality in different ways. Some things we may want to do (in rough order of increasing difficulty):

Interoperation

  • Ensure the different packages interoperate at the most basic level: OurUnit(OtherUnit) and OurQuantity(OhterQuantity) work. For units, this may be as simple as trying OurUnit(str(OtherUnit)), while for quantities we perhaps can rely on having .unit attribute (EDIT: unyt uses units instead of unit) and some way to get the value (.value? Perhaps just __array__?). Alternatively, we might agree on some quantity-specific dunder method.
  • Interoperate in more detail, such that, e.g., our_quantity * other_quantity "just works". And that one could, e.g., do SkyCoord(other_quantity, ...), with auto-conversion to astropy Quantity.
  • Try to be so agnostic to specific quantity implementations that one could just one type or another (in, e.g., SkyCoord) and everything just works, with now all output being in the type of quantity one put in.

Mutual Improvements

  • List strong and weak points of different unit packages.
  • Copy missing implementations, or replace poor ones with better ones.

Merge implementations

  • Determine whether we are so similar that we can just merge implementations?
  • Move a common implementation upstream? Really, numpy or scipy should support quantities, and possibly python itself should support units (and float quantities?).

cc @ngoldbaum, @astrofrog, @adrn, @eteq

EDIT: for some earlier thoughts about interoperability and abstract base classes, see #3650.

Activity

  1. added this to the v3.2 milestone on Feb 8, 2019
  2. pllim commented on Feb 8, 2019

    @pllim
    Member
  3. bsipocz commented on Apr 11, 2019

    @bsipocz
    Member

    I'm removing this from the 3.2 milestone as we discussed it during the latest dev-telecon.

  4. removed this from the v3.2 milestone on Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions