astro py:docs

- Index
- Modules

### Navigation

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

# set_enabled_equivalencies

astropy.units.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 `python:list` of `python:tuple`

      list of equivalent pairs, e.g., as returned by `dimensionless_angles`.

  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.+1.2246468e-16j>