astropy/astropy — pull request #1615 by eteq (2013-10-20 05:54:01+00:00)
Title: Coordinates indexing

This adds the feature requested in #1508 (originally mentioned by @adrn in #1499): the ability to index an array coordinate object:
```
c = ICRSCoordinates(...)
idx = np.array([1,4,7,6])
c[idx]
```
and have it yield a new coordinate object with the angles (and distances) requested by the index passed in. It turns out this is really valuable for coordinate matching, and makes life a lot easier there.

I had originally planned to deal with this after #682, but #682 is a fair amount of work that probably will change in the next version anyway, given all the suggested changes for coordinate class' representations. So this just implements `__getitem__` without cleaning up the boilerplate stuff too much.

Because of that, to get this to work, I had to make a subtle but possibly significant change to coordinates. Previously, the attributes like `ra` and `dec` were just regular attributes and could be freely altered. Now, they are read-only properties that access underlying `_latangle` and `_lonangle` objects. I'd say this is a good thing on its own, because it makes the coordinate objects into something more like immutable objects, which is the safer way to handle all of this (and is the likely direction we will go in the next version).

Note that this collides somewhat with #1614, but I should be able to rebase fairly easily when that is merged, but the opposite is less true. So this should be merged *after* #1614, if #1614 is accepted.