astropy/astropy — pull request #1171 by mhvk (2013-06-09 21:07:20+00:00)
Title: Comparisons of Time and TimeDelta

Procrastinating on things I should really be doing, I implemented comparisons of `Time` and `TimeDelta` objects, with comparisons only possible if the two are the same type (when it seemed without ambiguity). Setting up with:
```
from astropy.time import Time, TimeDelta
import numpy as np
t1 = Time(np.arange(49995,50005), format='mjd', scale='utc')
t2 = Time(np.arange(49000,51000,200), format='mjd', scale='utc')
```
One gets:
```
In [5]: t1 < t2
Out[5]: array([False, False, False, False, False, False, True, True, True, True], dtype=bool)

In [6]: t1 == t2
Out[6]: array([False, False, False, False, False, True, False, False, False, False], dtype=bool)

In [7]: t1[0] > t2[0]
Out[7]: True

In [8]: t1[0] > t2
Out[8]: array([ True, True, True, True, True, False, False, False, False, False], dtype=bool)

In [9]: t1 > t2[0]
Out[9]: array([ True, True, True, True, True, True, True, True, True, True], dtype=bool)

In [10]: dt = t2-t1
In [11]: t1 > dt
ERROR: OperandTypeError [astropy.time.core]
... (full message omitted) ...

In [12]: dt > TimeDelta(0., format='sec')
Out[12]: array([False, False, False, False, False, False, True, True, True, True], dtype=bool)
```