API Reference for Enthought Tool Suite 3.2.0
Methods to handle unit conversion into/outoff function components.
Component decorators wrap standard python functions with "conversion" routines that can either change or add information to functions before the actual python function call is made. A standard need for this is unit conversion. There are a couple of common cases that we run into in scientific applications. The first is that we want to take objects that have one set of units and convert their data to another set of units before handing them into the function. This is important if a function was written expecting data in a specific set of units (ie. m/s instead of ft/s). convert_units() does this as well as adding units to non-united objects. On output, it is common to want to take objects that may not have units associated with them and convert them to a 'united' object that has units assoicated with them set_units() does this.
Create a UnitArray with units='units' from the given 'array'.
Returns True if any of the arguments have units attached to them.
This is a bit of a hack specifically for has_units and tied to the conventions of convert_units().
Convert the *args to the specified units using the converters.
This function is general purpose in that it could do a unit conversion, it could overwrite the objects' units, or whatever. The behavior is up to the converter functions.
Create a UnitScalar with units='units' from the given scalar 'x'.
Remove units from arguments.
Convert a UnitArray from one set of units to another.
Overwrite the units for a UnitArray with the new units.
| Local name | Refers to |
|---|---|
| ndarray | numpy.ndarray |
| UnitArray | enthought.numerical_modeling.units.unit_array.UnitArray |
| units | enthought.units |
| UnitScalar | enthought.numerical_modeling.units.unit_scalar.UnitScalar |
© Copyright 2002-2009 Enthought, Inc.