Closed yunruse closed 1 year ago
LogarithmicScale
should have a .from_ratio
, too.
Other logarithmic units: A lovely amount, actually!
In the SI system the non SI modifier decibel (dB) is not permitted for use directly alongside SI units so the dBW is not directly permitted but 10 dBW may be written 10 dB (1 watt).
Some optional info_log_scales
could e.g. give info on pH, Richter scales.
To make a point about the interfacing – and this needs noting down properly in documentation - that *
is always multiplication, and unit(value)
may be within-scale, just like with AffineUnit
. (Recall that in the CLI e.g. 3dB
-> dB(3)
)
Therefore we should see
>>> dB(3) # 10^0.3
1.99526231
>>> dB * 3 # 3 * 10^0.1
3.77677624
To clarify, dB(10) == 10
; we will use power scale throughout.
Oh, and also:
LogarithmicMeasure
- eg dB(3)
shows as 3 dB
2 @ dB
return 0.30103 dB
c.f. https://en.wikipedia.org/wiki/Decibel
Support for e.g.
dBf
,dBZ
units, where instead of being relative to1
, it is relative to a specific unit.Implementation detail
A
LogarithmicScale
fordB
which functions as a unit, holding how it scales.Meanwhile, a dimensionless
LogarithmicMeasure(log_value, scale, relative_to=1)
can handle e.g.dB(Z)
. Perhaps internally the should store the actual value, and take as input (and give as display) the "decibel" value.