[Numpy-discussion] Units; was Bug or surprising undocumented behaviour in irfft

Bryan Van de Ven bryanv at enthought.com
Thu Aug 30 11:17:00 EDT 2007


> Do you know if there's a current package to associate units with numpy
> arrays? For my purposes it would usually be sufficient to have arrays
> of quantities with uniform units. Conversions need only be
> multiplicative (I don't care about Celsius-to-Fahrenheit style
> conversions) and need not even be automatic, though of course that
> would be convenient. Right now I use Frink for that sort of thing, but
> it would have saved me from making a number of minor mistakes in
> several pieces of python code I've written.

Anne,

We have an enthought.units package in ETS, and for unit-ed numpy arrays we have 
(fairly new) UnitArray and UnitScalar in enthought.numerical_modeling.units.api 
Automatic conversions on arithmetic expressions are not performed; however, we 
do have a "@has_units" function decorator that will perform unit conversions on 
function inputs automatically (and will label--but not convert--the outputs of a 
function) If you are interested in checking it out I can get you more 
information/examples.

Bryan




More information about the NumPy-Discussion mailing list