astropy/astropy — pull request #1593 by mhvk (2013-10-17 03:23:43+00:00)
Title: Units equivalency context manager -- mostly for dimensionless angles

This is a follow-up on #1161, which introduced an equivalency that allows radian to be dimensionless. That PR still required the equivalency to be explicitly given, which does not address all uses (in particular, the example below). The present PR adds `equivalencies` to the `UnitRegistry` class, and with that the ability to set an equivalency context. E.g.,
```
import astropy.units as u; import numpy as np
with u.set_enabled_equivalencies_context(u.angles_dimensionless()):
omega = u.cycle/(2.*u.s)
t = 1.*u.min
c = np.exp(1j*omega*t)
c
```
yields
```

```

@mdboom: one change beyond introducing, testing, and documenting this, is that the default for `equivalencies` for all user-facing methods is changed to `None`, so that `[]` can be used to override any global equivalencies in effect.