yunruse / Noether

Just another units package
MIT License
9 stars 0 forks source link

`bit` is not the default display unit? #54

Closed yunruse closed 1 year ago

yunruse commented 1 year ago

General info

in-development bug (Noether 1.0, Py3.11)

Steps

>>> B / s
byte / second  # data_rate, 8 B / s

Expected behaviour

B shouldn't be used to express "bit" here

yunruse commented 1 year ago

This issue also appears in eg

>>> display(mile)
>>> mile / hour
mile / hour  # speed, 0.44704 mi / s

where we know of course that

>>> mile / hour @ m/s
0.44704 m / s  # speed

This is because Measure._repr_measure - the backup in case there is no explicit display unit fetchable - simply checks the value and the symbols for each dimension's assigned unit, making the assumption that each dimension's assigned unit has a value of 1.

This should be fixed by having display_unit always return a unit, which is (as backup) a GeometricUnit.