pymad / cpymad

cPyMAD is a python interface to Mad-X using cython and libmadx
http://cern.ch/pymad
Apache License 2.0
3 stars 3 forks source link

physical units #42

Closed coldfix closed 9 years ago

coldfix commented 10 years ago

There is plenty of reason and little downside to enforce explicit unit calculation rather than doing it implicitly in an uncontrolled way:

Code that only performs simple operations on the returned data (and performs no explicit type-checking) will not need to be changed. However, before using functions like math.log the data needs to be explicitly casted to the desired unit first (which is a necessity IMO, since many mathematical functions don't make sense on dimensional quantities).

This could also be made an optional feature (e.g. via inheritance) if we don't want to break user code.

There are several python modules for this task:

Among them I have found unum to be a reasonable candidate regarding the following issues:

I think this would be really nice to have at some point.