-
Notifications
You must be signed in to change notification settings - Fork 29
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
Use unit prefix only instead of full unit #10
Comments
We can stay compatible to the old interface by just evaluating the first char. |
full ack |
I would not add a unit feature at all. It should be understood that all is in SI base units. Adding a e.g. e-3 at the base unit should be no issue. Otherwise one can only understand any value with the unit string. At least I would make this a not mandatory API feature, but an optional way to define values. And the standard unit should be SI base units. |
depends, actually I can live without that feature. Others are using it. |
A conversion for a ADC/DAC? What is that? ADC/DAC is just a value and no unit at all. |
You do not want to thing what is 1.273V in DAC units. And calibration on On Sat, Mar 14, 2015 at 6:15 PM, D.-L.Pohl [email protected] wrote:
|
Now we are talking about calibration and not units ;-). But for calibration data it is much better to have the SI base units only, otherwise some calibrations will be in mV, some in V... |
One does not go against other we assume we use default Si unit as default so e-3 etc will work. |
We do this? |
instead set_voltage(self, channel, value, unit='mV') use set_voltage(self, channel, value, unit='m').
Makes things easier when comes to abstraction. We can also do some unit conversion based on a new class that we can put inside utils. The conversion is then based on a dict like that one:
_prefix = {'y': 1e-24, # yocto
'z': 1e-21, # zepto
'a': 1e-18, # atto
'f': 1e-15, # femto
'p': 1e-12, # pico
'n': 1e-9, # nano
'u': 1e-6, # micro
'm': 1e-3, # mili
'c': 1e-2, # centi
'd': 1e-1, # deci
'k': 1e3, # kilo
'M': 1e6, # mega
'G': 1e9, # giga
'T': 1e12, # tera
'P': 1e15, # peta
'E': 1e18, # exa
'Z': 1e21, # zetta
'Y': 1e24, # yotta
}
also check http://stackoverflow.com/questions/10969759/python-library-to-convert-between-si-unit-prefixes.
The text was updated successfully, but these errors were encountered: