set_enabled_equivalencies#
- astropy.units.set_enabled_equivalencies(equivalencies)[source]#
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
oftuple
list of equivalent pairs, e.g., as returned by
dimensionless_angles
.
- equivalencies
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>