gavo.imp.angle_formats module¶
This module contains formatting functions that are for internal use in astropy.coordinates.angles. Mainly they are conversions from one format of data to another.
- exception gavo.imp.angle_formats.BoundsError[source]¶
Bases:
RangeError
Raised when an angle is outside of its user-specified bounds.
- exception gavo.imp.angle_formats.IllegalHourError(hour)[source]¶
Bases:
RangeError
Raised when an hour value is not in the range [0,24).
Parameters¶
hour : int, float
Examples¶
if not 0 <= hr < 24: raise IllegalHourError(hour)
- exception gavo.imp.angle_formats.IllegalHourWarning(hour, alternativeactionstr=None)[source]¶
Bases:
AstropyWarning
Raised when an hour value is 24.
Parameters¶
hour : int, float
- exception gavo.imp.angle_formats.IllegalMinuteError(minute)[source]¶
Bases:
RangeError
Raised when an minute value is not in the range [0,60].
Parameters¶
minute : int, float
Examples¶
if not 0 <= min < 60: raise IllegalMinuteError(minute)
- exception gavo.imp.angle_formats.IllegalMinuteWarning(minute, alternativeactionstr=None)[source]¶
Bases:
AstropyWarning
Raised when a minute value is 60.
Parameters¶
minute : int, float
- exception gavo.imp.angle_formats.IllegalSecondError(second)[source]¶
Bases:
RangeError
Raised when an second value (time) is not in the range [0,60].
Parameters¶
second : int, float
Examples¶
if not 0 <= sec < 60: raise IllegalSecondError(second)
- exception gavo.imp.angle_formats.IllegalSecondWarning(second, alternativeactionstr=None)[source]¶
Bases:
AstropyWarning
Raised when a second value is 60.
Parameters¶
second : int, float
- exception gavo.imp.angle_formats.RangeError[source]¶
Bases:
ValueError
Raised when some part of an angle is out of its valid range.
- gavo.imp.angle_formats.check_hms_ranges(h, m, s)[source]¶
Checks that the given hour, minute and second are all within reasonable range.
- gavo.imp.angle_formats.degrees_to_dms(d)[source]¶
Convert a floating-point degree value into a
(degree, arcminute, arcsecond)
tuple.
- gavo.imp.angle_formats.degrees_to_string(d, precision=5, pad=False, sep=':', fields=3)[source]¶
Takes a decimal hour value and returns a string formatted as dms with separator specified by the ‘sep’ parameter.
d
must be a scalar.
- gavo.imp.angle_formats.dms_to_degrees(d, m, s=None)[source]¶
Convert degrees, arcminute, arcsecond to a float degrees value.
- gavo.imp.angle_formats.hms_to_degrees(h, m, s)[source]¶
Convert hour, minute, second to a float degrees value.
- gavo.imp.angle_formats.hms_to_dms(h, m, s)[source]¶
Convert degrees, arcminutes, arcseconds to an
(hour, minute, second)
tuple.
- gavo.imp.angle_formats.hms_to_hours(h, m, s=None)[source]¶
Convert hour, minute, second to a float hour value.
- gavo.imp.angle_formats.hms_to_radians(h, m, s)[source]¶
Convert hour, minute, second to a float radians value.
- gavo.imp.angle_formats.hours_to_decimal(h)[source]¶
Convert any parseable hour value into a float value.
- gavo.imp.angle_formats.hours_to_hms(h)[source]¶
Convert an floating-point hour value into an
(hour, minute, second)
tuple.
- gavo.imp.angle_formats.hours_to_string(h, precision=5, pad=False, sep=('h', 'm', 's'), fields=3)[source]¶
Takes a decimal hour value and returns a string formatted as hms with separator specified by the ‘sep’ parameter.
h
must be a scalar.
- gavo.imp.angle_formats.radians_to_dms(r)[source]¶
Convert an angle in Radians to an
(degree, arcminute, arcsecond)
tuple.