astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- Units and Quantities (`astropy.units`) »
- set_enabled_equivalencies

# set_enabled_equivalencies

`astropy.units.core.``set_enabled_equivalencies`(equivalencies)

  Sets the equivalencies enabled in the unit registry.

  These equivalencies are used if no explicit equivalencies are given, both in unit conversion and in finding equivalent units.

  This is meant in particular for allowing angles to be dimensionless. Use with care.

  Parameters:

  equivalencies : list of equivalent pairs

  > E.g., as returned by `astropy.units.angles_dimensionless`.

  Examples

  Exponentiation normally requires dimensionless quantities. To avoid problems with complex phases:

      >>> from astropy import units as u
      >>> with u.set_enabled_equivalencies(u.dimensionless_angles()):
      ...     phase = 0.5 * u.cycle
      ...     np.exp(1j*phase)
      <Quantity (-1+...j) >