Angle Units¶
- class coord.AngleUnit(value)[source]¶
A class for defining angular units used by Angle objects.
Initialization:
An AngleUnit takes a single argument for initialization, a float that specifies the size of the desired angular unit in radians. For example:
>>> gradian = AngleUnit(2. * math.pi / 400.) >>> print(gradian) coord.AngleUnit(0.015707963267948967)
Built-in units:
There are five built-in AngleUnits which are always available for use:
- coord.radians:
coord.AngleUnit(1.)
- coord.degrees:
coord.AngleUnit(pi / 180.)
- coord.hours:
coord.AngleUnit(pi / 12.)
- coord.arcmin:
coord.AngleUnit(pi / 180. / 60.)
- coord.arcsec:
coord.AngleUnit(pi / 180. / 3600.)
Attribute:
An AngleUnit as the following (read-only) attribute:
- value:
The measure of the unit in radians.
- property value¶
A read-only attribute giving the measure of the AngleUnit in radians.
- static from_name(unit)[source]¶
Convert a string into the corresponding AngleUnit.
Only the start of the string is checked, so for instance ‘radian’ or ‘radians’ is equivalent to ‘rad’.
Valid options are:
- rad:
AngleUnit(1.)
- deg:
AngleUnit(pi / 180.)
- hour or hr:
AngleUnit(pi / 12.)
- arcmin:
AngleUnit(pi / 180. / 60.)
- arcsec:
AngleUnit(pi / 180. / 3600.)
Note: these valid names are listed in AngleUnit.valid_names.
- Parameters:
unit – The string name of the unit to return
- Returns:
an AngleUnit