Bases: astropy.units.quantity.Quantity
One or more angular value(s) with units equivalent to radians or degrees.
An angle can be specified either as an array, scalar, tuple (see below), string, Quantity or another Angle.
The input parser is flexible and supports a variety of formats:
Angle('10.2345d')
Angle(['10.2345d', '-20d'])
Angle('1:2:30.43 degrees')
Angle('1 2 0 hours')
Angle(np.arange(1, 8), unit=u.deg)
Angle(u'1°2′3″')
Angle('1d2m3.4s')
Angle('-1h2m3s')
Angle((-1, 2, 3), unit=u.deg) # (d, m, s)
Angle(10.2345 * u.deg)
Angle(Angle(10.2345 * u.deg))
Parameters: | angle : array, scalar, Quantity, Angle
unit : UnitBase, str, optional
dtype : dtype, optional
copy : bool, optional
|
---|---|
Raises: | `~astropy.units.UnitsError`
|
Attributes Summary
dms | The angle’s value in degrees, as a named tuple with (d, m, s) members. |
hms | The angle’s value in hours, as a named tuple with (h, m, s) members. |
hour | The angle’s value in hours (read-only property). |
signed_dms | The angle’s value in degrees, as a named tuple with (sign, d, m, s) members. |
Methods Summary
format(*args, **kwargs) | Deprecated since version 0.3. |
is_within_bounds([lower, upper]) | Check if all angle(s) satisfy lower <= angle < upper If lower is not specified (or None) then no lower bounds check is performed. |
to_string([unit, decimal, sep, precision, ...]) | A string representation of the angle. |
wrap_at(wrap_angle[, inplace]) | Wrap the Angle object at the given wrap_angle. |
Attributes Documentation
The angle’s value in degrees, as a named tuple with (d, m, s) members. (This is a read-only property.)
The angle’s value in hours, as a named tuple with (h, m, s) members. (This is a read-only property.)
The angle’s value in hours (read-only property).
The angle’s value in degrees, as a named tuple with (sign, d, m, s) members. The d, m, s are thus always positive, and the sign of the angle is given by sign. (This is a read-only property.)
This is primarily intented for use with dms to generate string representations of coordinates that are correct for negative angles.
Methods Documentation
Deprecated since version 0.3: The format function is deprecated and may be removed in a future version. Use to_string instead.
Check if all angle(s) satisfy lower <= angle < upper
If lower is not specified (or None) then no lower bounds check is performed. Likewise upper can be left unspecified. For example:
>>> from astropy.coordinates import Angle
>>> import astropy.units as u
>>> a = Angle([-20, 150, 350] * u.deg)
>>> a.is_within_bounds('0d', '360d')
False
>>> a.is_within_bounds(None, '360d')
True
>>> a.is_within_bounds(-30 * u.deg, None)
True
Parameters: | lower : str, Angle, angular Quantity, None
upper : str, Angle, angular Quantity, None
|
---|---|
Returns: | is_within_bounds : bool
|
A string representation of the angle.
Parameters: | unit : UnitBase, optional
decimal : bool, optional
sep : str, optional
precision : int, optional
alwayssign : bool, optional pad : bool, optional
fields : int, optional
format : str, optional
|
---|---|
Returns: | strrepr : str
|
Wrap the Angle object at the given wrap_angle.
This method forces all the angle values to be within a contiguous 360 degree range so that wrap_angle - 360d <= angle < wrap_angle. By default a new Angle object is returned, but if the inplace argument is True then the Angle object is wrapped in place and nothing is returned.
For instance:
>>> from astropy.coordinates import Angle
>>> import astropy.units as u
>>> a = Angle([-20.0, 150.0, 350.0] * u.deg)
>>> a.wrap_at(360 * u.deg).degree # Wrap into range 0 to 360 degrees
array([ 340., 150., 350.])
>>> a.wrap_at('180d', inplace=True) # Wrap into range -180 to 180 degrees
>>> a.degree
array([ -20., 150., -10.])
Parameters: | wrap_angle : str, Angle, angular Quantity
inplace : bool |
---|---|
Returns: | out : Angle or None |