TheBIPM / SI_Digital_Framework

The SI Digital Framework public repository
Other
6 stars 2 forks source link

Representing Units with non integer exponents like in V/√H̅z̅ #2

Open BeSeeTek opened 3 months ago

BeSeeTek commented 3 months ago

Hello All

I played around with the website a bit and was quite happy. I'm implementing a Python module using the D-SI Unit representation but i want to add support for the unit representation suggested here as well.

I tried the parsing option shown here https://si-digital-framework.org/SI/unitExpr?lang=en I tryed to represent the unit $$\frac{\text{V}}{\sqrt{\text{Hz}}}$$ witch is quite common for noise densities.

In the format for the parsing tool which should be V.Hz-0.5 this will not work since the . is used as separator :( so i tried V.Hz-0,5 witch dosen work as well :(

so how do i represent sie kind of units?

Decimal representation

using , as exponent decimal separator

V.Hz-0,5

when thinking about this a problem arises.

Sometimes we have units with rational exponents $$\mathrm{unit}^\frac{c}{d}~~{ c,d\in \N} $$ like $$\mathrm{unit}^{\frac{1}{3}}\Longrightarrow \sqrt[3]{\mathrm{Unit}}$$

So we have to take care of the precision if we use a decimal representation to be able to reduce 0.3333 to 1/3 as example. When using decimal representation i would suggest 4 digits precision as in thies D-SI Issue

Integer fraction representation

Or to avoid this problem implementing an integer fraction representation with an speration symbol like / or | the representation for $\frac{\text{V}}{\sqrt{\text{Hz}}}$

V.Hz-1\2

or

V.Hz-1|2

only the intger before the fraction symbol \ or | is allowed to be negative.

Thanks in advance

fmeynadier commented 3 months ago

Thanks for this contribution.

The initial goal of this representation is to be able to represent all compound units found in the SI Brochure. Note that the PID uses a similar notation, but with explicit strings of units and prefixes (e.g. https://si-digital-framework.org/SI/units/kilogram.metre2.second-2) : it is probably towards this that you may want to connect your module, instead of the "condensed" representation for which we provide this parser. However this PID scheme, too, does not allow to use non-integer exponents.

This has not been identified as a problem because the goal was to stay focused on the content of the Brochure (i.e we do not aim at duplicating the existing digital units representation systems). Widening the scope and allowing to use non-integer unit exponents could be a desirable goal, though.

The fact that we aimed at URL-like PIDs limited the choice of usable characters (unreserved characters in https://www.ietf.org/rfc/rfc3986.txt). We also wanted them to be directly human-readable.

A possibility would be to use underscores in the PID , i.e. https://si-digital-framework.org/SI/units/kilogram_metre2_second-2 Thus allowing https://si-digital-framework.org/SI/units/volt_hertz-0.5 (but then the expression parser's syntax is not as intuitive).

I can not say how likely it is that such a change would be agreed in the future versions, but I keep that in mind...

mgrub commented 2 months ago

As a (late) comment: This would also require some adjustments on the semantic side, as the underlying si:UnitPower concept and its si:hasNumericExponent property is currently defined in way, that asserts integer exponents ( see the ttl source ). Hence, providing a non-integer exponent would lead to an inconsistent knowledge graph.

BeSeeTek commented 2 months ago

@mgrub i would prefere integerfractions over float exponetnts since otherwise quantisation will always be a problem. Would adding a property hasNumericExponentDenominator brekaing the underlying concept and leading to an inconsistent knowledge graph? I would sugest ~ as seperator. https://si-digital-framework.org/SI/units/volt.hertz1~2