bluesky / ophyd-async

Hardware abstraction for bluesky written using asyncio
https://blueskyproject.io/ophyd-async
BSD 3-Clause "New" or "Revised" License
11 stars 24 forks source link

SignalMetadata units attribute is too broad #616

Open DiamondJoseph opened 2 weeks ago

DiamondJoseph commented 2 weeks ago

SignalMetadata, which is used by SoftSignals to present information about units and precision, uses just a str as its datatype. While the use case of providing arbitrary configuration-like metadata is to be discouraged, the use of consolidating several signals into another value should get additional support for developers to ensure data is consistent and maintains integrity.

This could be accomplished by ensuring that the units is an instance of e.g. this library's SI units representation. This would allow propagating units from the physical signals that back the SoftSignal, including relations between multiple signals in a simple way.

Acceptance Criteria

Tom-Willemsen commented 1 week ago

If we do this, could we explore making the underlying units library pluggable? e.g. at ISIS we're already using scipp for our units handling (which uses llnl-units under the hood), I could imagine other facilities wanting to use pint or forallpeople as you suggested, or various domain-specific libraries, or ...