API/Reference

Index

Types

SkyCoords.ICRSCoordsType
ICRSCoords(ra::Real, dec::Real)
ICRSCoords(ra::AbstractString, dec::AbstractString)

International Celestial Reference System

This is the current standard adopted by the International Astronomical Union notably due to its high level of accuracy compared to standard equatorial coordinate systems. What sets this apart from FK5Coords is that it is completely defined using extragalactic radio sources rather than a geocentric frame, which means the reference frame will not change due to Earth's motion.

If the coordinates are given as numbers, they will be assumed to be radians. If they are given as strings, ra will be assumed to be an hour angle and dec will be assumed to be in degrees.

Coordinates

  • ra - Right ascension in radians (0, 2π)
  • dec - Declination in radians (-π/2, π/2)
source
SkyCoords.GalCoordsType
GalCoords(l, b)

Galactic Coordinate System

This coordinate system is defined based on the projection of the Milky Way galaxy onto our celestial sphere, with (0, 0) being approximately the center of our galaxy.

If the coordinates are given as numbers, they will be assumed to be radians. If they are given as strings, both will be assumed to be in degrees.

Coordinates

  • l - Galactic longitude in radians (-π, π)
  • b - Galactic latitude in radians (-π/2, π/2)
source
SkyCoords.FK5CoordsType
FK5Coords{equinox}(ra, dec)

Equatorial Coordinate System

This coordinate system maps the celestial sphere based on a geocentric observer. Historically the oldest, this coordinate system has been shown to be inaccurate due to its definitions based on the Earth, which has long-scale precession causing the reference frame to change. Because of this, an equinox must be provided (typically 2000, commonly known as J2000) which defines the reference frame.

If the coordinates are given as numbers, they will be assumed to be radians. If they are given as strings, ra will be assumed to be an hour angle and dec will be assumed to be in degrees.

Coordinates

  • ra - Right ascension in radians (0, 2π)
  • dec - Declination in radians (-π/2, π/2)
source

Conversion

To convert between types, there are three (equivalent) methods of doing so.

julia> c1 = ICRSCoords(0., 0.)
ICRSCoords{Float64}(0.0, 0.0)
  • using convert
julia> convert(GalCoords, c1)
GalCoords{Float64}(1.6814027872278692, -1.0504884034813007)
  • using constructors
julia> GalCoords(c1)
GalCoords{Float64}(1.6814027872278692, -1.0504884034813007)
  • using |>
julia> c1 |> GalCoords
GalCoords{Float64}(1.6814027872278692, -1.0504884034813007)

Functions

SkyCoords.str2radFunction
SkyCoords.str2rad(::AbstractString, force_ha=false)

Parses strings that specify common astronomical coordinates into radians. A simplified version of the regex allowed for both

  • hour angle - "xx [h] xx ['′m:] xx [\"″s]?"
  • degree - "xx [°d:] xx ['′m:] xx [\"″s]?"

So, you can see that this will parse an hour angle if the leading unit contains an h otherwise it will parse a degree if the leading unit contains a °, d or :. Also, you can forego the final unit, since it will be parsed automatically. The values (xx) will be parsed as Float64.

If force_ha is true then the input will be parsed as an hour angle using a looser regex that allows the leading unit to be a :

  • loose hour angle - "xx [h:] xx ['′m:] xx [\"″s]?"

Examples

julia> import SkyCoords: str2rad

julia> str2rad("12h52m64.300s")
3.3731614843033575

julia> str2rad("0°12'5\"") # Note that you have to escape the "
0.003514899188044136

julia> str2rad("-  10° 02 ′  10.885 ″") # Whitespace does not matter
-0.17389837681291273

julia> str2rad("12:0:0", true)
3.141592653589793
source
SkyCoords.separationFunction
separation(c1::AbstractSkyCoords, c2::AbstractSkyCoords) -> distance

Return angular separation between two sky coordinates, in radians.

The angular separation is calculated using the Vincenty formula, which is slightly more complex and computationally expensive than some alternatives, but is stable at at all distances, including the poles and antipodes.

source
SkyCoords.position_angleFunction
position_angle(c1::AbstractSkyCoords, c2::AbstractSkyCoords) -> angle

Return position angle between two sky coordinates, in positive radians.

Examples

julia> c1 = ICRSCoords(0, 0); c2 = ICRSCoords(deg2rad(1), 0);

julia> position_angle(c1, c2) |> rad2deg
90.0
source
SkyCoords.offsetFunction
offset(::AbstractSkyCoords, separation, pa) -> coordinate

Offset a coordinate by a given angular separation, separation, in radians and position angle, pa, in radians.

Uses the sine and cosine rules in spherical coordinates with corrections for the antipodes. Returns a sky coordinate of the same type as input.

Examples

julia> c1 = ICRSCoords(0, 0);

julia> c2 = offset(c1, deg2rad(1), deg2rad(90))
ICRSCoords{Float64}(0.017453292519943295, 1.0686516840418957e-18)

julia> offset(c1, c2) .|> rad2deg
(1.0, 90.0)

See Also

source
offset(::AbstractSkyCoords, AbstractSkyCoords) -> angle, angle

Return the separation and position angle in radians between two sky coordinates.

Examples

julia> c1 = ICRSCoords(0, 0); c2 = ICRSCoords(deg2rad(1), 0);

julia> offset(c1, c2) .|> rad2deg
(1.0, 90.0)

See Also

source