nipy/nitime — pull request #91 by ivanov (2011-12-08 07:17:32+00:00)
Title: Timearray math

with this PR, adding and subtracting values which aren't TimeArrays first converts them and gives them the unit of the time array. For example

In [1]: import nitime

In [2]: nitime.TimeArray(1) + 1
Out[2]: 2.0 s

In [3]: nitime.TimeArray(1, time_unit='ms') + 1
Out[3]: 2.0 ms

In [4]: nitime.TimeArray(1, time_unit='ms') + 1 + nitime.TimeArray(1)
Out[4]: 1002.0 ms

In [5]: a = nitime.TimeArray(1)

In [6]: a
Out[6]: 1.0 s

In [7]: a.convert_unit('ms')

In [8]: a
Out[8]: 1000.0 ms

In [9]: a+1
Out[9]: 1001.0 ms