Skip to content

Natural-unit equivalencies: convert mass↔energy↔length under natural unit systems #767

Description

@nstarman

Background

Natural unit systems (#228#232) are now implemented as numeric-1 systems: the base units are chosen so the defining constants (ħ, c, G, k_B, m_e, e, 4πε₀) evaluate to 1.0, while the full dimensional structure is preserved. This mirrors DynamicalSimUSysFlag and is enough to make q.decompose(usys) yield natural-unit values.

What it deliberately does not do: it does not let you convert between dimensions that natural units identify. In HEP units (ħ = c = 1) a mass and an energy are physically the same thing, but in unxt a Quantity in MeV is still an energy — e.g. you can't hand 0.511 MeV to something expecting a mass, or uconvert("g", energy, usys=hep).

Proposal

Add opt-in equivalencies attached to (or derivable from) a natural unit system, so conversions across the dimensions a system identifies are allowed:

  • HEP / particle (ħ = c = 1): mass ↔ energy ↔ momentum ↔ 1/length ↔ 1/time
  • Geometrized (c = G = 1): mass ↔ length ↔ time
  • Planck / atomic similarly

This is essentially integrating astropy-style equivalencies (mass_energy(), etc.) with the unit-system abstraction and threading them through uconvert / ustrip.

Scope / open questions

  • Where do the equivalencies live — on the AbstractUnitSystem, or a separate object passed to uconvert?
  • Should they be automatic when a usys is supplied, or explicit opt-in (to avoid surprising silent mass→energy conversions)?
  • Interaction with dimension checking / plum dispatch on dimension-parametric quantities.

This is a larger feature than the numeric-1 systems and was intentionally split out. See #228 and the "Working in Natural Units" guide for the current behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions