Skip to content

Units #192

@iguinn

Description

@iguinn

We need a way to write units following the conventions settled on in legend-exp/legend-data-format-specs#12.

This means:

  • Drop "fake" units like ADC
  • Use short-form (ns not nanosecond)
  • Use ^ instead of ** for powers (this will require a custom pint format it looks like)

I would propose having an argument for the processing chain to set how units are handled on output; we can default to the above. When units are explicitly provided, they will be passed through this. For "fake" units, we can register them to the units and then use to_reduced_units to automatically convert to unitless if we want to (this would depend on chosen format) (that said if we don't use this in order to keep our fake units, it will also not reduce things like ns/us).

For starters, we can have 3 options:

  • unitful: follow the julia conventions above
  • pint: normal pint conventions (full names, keep fake units, use **)
  • pint_reduced: pint conventions but remove "fake" units
    This system could be extended as needed (e.g. if for some reason somebody wants to use another package)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions