numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
20 stars 7 forks source link

Unit conversion mode `"simplify"` should use metric prefixes #270

Closed numeredev closed 3 weeks ago

numeredev commented 3 weeks ago

DESCRIPTION

Is your change request related to a problem? Please describe. The unit conversion mode "simplify" should make use of metric prefixes to simplify the returned unit even more.

Describe the solution you'd like Instead of

ans = "pF*µV"
dat().toSIunits(1, "simplify", true)
ans = "1 pF*µV = 1e-18 C"

I'd expect something like

ans = "1 pF*µV = 1 aC"

I.e. the scaling factor is embedded into the metric prefix (1e-18 -> atto).

Describe possible alternatives you've considered A clear and concise description of any alternative solutions or features you've considered, if any.

Additional context Add any other context or screenshots about the feature request here.

(Do not write below this line)


DEVS' SECTION

ANALYSIS

This is principle only possible for pure linear conversion, i.e. conversions, were f [UNIT] == f * x [UNIT] with some constant scaling factor x applies. It should then be possible to combine all scaling factors into the final factor, reduce it by a common metric prefix and add the latter to the final unit.

IMPLEMENTATION STEPS

(see also our Wiki for implementation guidelines)

DOCUMENTATION STEPS

(see also our Wiki for further information)

PULL REQUEST