-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default units for each dimension? #353
Comments
This sounds like a nice idea, and to have the default units be persistent, you could just place them in your |
Thank you for your request. One (minor?) difficulty arises because the mapping between phys. dimensions and 'default units' is not a bijection. For example: energy is typically measured in units of joule and torque is typically measured in units of newton meters (mathematically the same as joule). If we have an expression in units of kg m² / s², there is no way of knowing whether it's supposed to be an energy or a torque. And whether we should prefer J or N·m. |
Good point. In that case it doesn't seem too bad to just use one of them (as set by the user). Just to be clear, for any dimensions that don't have a default unit set explicitly by the user, the current behaviour would be retained. |
@sharkdp good point, that's something we should account for. A user should be able to make a conversion explicitly, which would override the default unit previously set. We should also add a facility to "unset" default units. Any syntax suggestions? |
Follow up ticket in Numbat with idea on how to implement this: sharkdp/numbat#116 See also: sharkdp/numbat#91 / sharkdp/numbat#167 which could potentially resolve this Energy/Torque ambiguity. But it comes at a cost... |
First of all, this is a very nice library!
I wonder if it would be easy to add the ability to set a default unit for a dimension (on a per-session basis or globally). I didn't find another issue about this.
Suppose I want to do a bunch of calculations with lumens per area, and I want all the results to be in lumens per cm^2 for easy comparison.
By default I get this behaviour:
I have to manually do:
and keep typing
-> lmcm2
every time I want to calculate something.It would be great to be able to define default units for a dimension, something like:
Internally each dimension could be represented by its SI base unit form. Then you would have a default mapping from dimensions to units. So e.g. the dimension of "illluminance" (of which
lm/cm^2
andlm/m^2
are units) would be represented bycandela*sr/m^2
. The mapping would mapcandela*sr/m^2
to the desiredlm/cm^2
unit.The text was updated successfully, but these errors were encountered: