Numeric with units

John Hunter jdhunter at ace.bsd.uchicago.edu
Fri May 16 13:03:02 EDT 2003


I need to work with Numeric arrays with units.  I have found the unum
package, which helps some

>>> from  Numeric import *
>>> from ubase import *
>>>
>>> f = 1/S
>>>
>>> t = arange(0.0,1.0,0.2)*S
>>> phi = 2*pi*t*f
>>> t.as(MS)
[   0.  200.  400.  600.  800.] [ms]
>>> phi
[ 0.          1.25663706  2.51327412  3.76991118  5.02654825] []

Cool.  But I can't do something like

>>> print sin(phi)
or 
>>> phi.typecode()
or
>>> t[0]

Has anyone written some code to integrate Numeric arrays with unum, or
another units package?

Thanks,
John Hunter





More information about the Python-list mailing list