Skip to content

Archive Coordinates SkyCoord

github-actions[bot] edited this page Sep 28, 2026 · 1 revision

Astropy SkyCoord helpers: name resolution, constellations, cross-matching.

  • Module name: coordinates
  • Python class: astropy.coordinates.SkyCoord
  • Functions: 7

Call any function below with the astroquery_execute MCP tool. Descriptions are taken from the upstream astroquery/astropy docstrings.

Function Summary
from_name Given a name, query the CDS name resolver to attempt to retrieve
from_pixel Create a new SkyCoord from pixel coordinates using a World Coordinate System.
get_constellation Determines the constellation(s) of the coordinates this SkyCoord contains.
get_mask Get the mask associated with these coordinates.
guess_from_table A convenience method to create and return a new SkyCoord from the data
search_around_3d Searches for all coordinates in this object around a supplied set of
search_around_sky Searches for all coordinates in this object around a supplied set of

Functions

from_name

Given a name, query the CDS name resolver to attempt to retrieve

SkyCoord.from_name(name, frame='icrs', parse=False, cache=True)

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="from_name",
    params={"name": "<name>"},
)

coordinate information for that object. The search database, sesame url, and query timeout can be set through configuration items in astropy.coordinates.name_resolve -- see docstring for get_icrs_coordinates for more information.

Parameters

Parameter Type Default Description
name (required) str The name of the object to get coordinates for, e.g. 'M42'.
frame str or BaseCoordinateFrame class or instance 'icrs' The frame to transform the object to.
parse bool False Whether to attempt extracting the coordinates from the name by parsing with a regex. For objects catalog names that have J-coordinates embedded in their names, e.g., 'CRTS SSS100805 J194428-420209', this may be much faster than a Sesame query for the same object name. The coordinates extracted in this way may differ from the database coordinates by a few deci-arcseconds, so only use this option if you do not need sub-arcsecond accuracy for coordinates.
cache bool True Determines whether to cache the results or not. To update or overwrite an existing value, pass cache='update'.

Returns

SkyCoord — Instance of the SkyCoord class.

from_pixel

Create a new SkyCoord from pixel coordinates using a World Coordinate System.

SkyCoord.from_pixel(xp, yp, wcs, origin=0, mode='all')

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="from_pixel",
    params={"xp": "<xp>", "yp": "<yp>", "wcs": "<wcs>"},
)

Parameters

Parameter Type Default Description
xp (required)
yp (required)
wcs (required) WCS The WCS to use for convert
origin int 0 Whether to return 0 or 1-based pixel coordinates.
mode 'all' or 'wcs' 'all' Whether to do the transformation including distortions ('all') or only including only the core WCS transformation ('wcs').

Returns

SkyCoord — A new object with sky coordinates corresponding to the input xp and yp.

See Also

to_pixel : to do the inverse operation astropy.wcs.utils.pixel_to_skycoord : the implementation of this method

get_constellation

Determines the constellation(s) of the coordinates this SkyCoord contains.

SkyCoord.get_constellation(short_name=False, constellation_list='iau')

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="get_constellation",
    params={},
)

Parameters

Parameter Type Default Description
short_name bool False If True, the returned names are the IAU-sanctioned abbreviated names. Otherwise, full names for the constellations are used.
constellation_list str 'iau' The set of constellations to use. Currently only 'iau' is supported, meaning the 88 "modern" constellations endorsed by the IAU.

Returns

str or string array — If this is a scalar coordinate, returns the name of the constellation. If it is an array |SkyCoord|, it returns an array of names.

Notes

To determine which constellation a point on the sky is in, this first precesses to B1875, and then uses the Delporte boundaries of the 88 modern constellations, as tabulated by Roman 1987.

See Also

astropy.coordinates.get_constellation

get_mask

Get the mask associated with these coordinates.

SkyCoord.get_mask(*attrs)

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="get_mask",
    params={},
)

Parameters

Parameter Type Default Description
*attrs

Returns

~numpy.ndarray of bool — The combined, read-only mask. If the instance is not masked, it is an array of False with the correct shape.

Raises

  • ValueError: If the coordinate frame has no associated data.

guess_from_table

A convenience method to create and return a new SkyCoord from the data

SkyCoord.guess_from_table(table, **coord_kwargs)

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="guess_from_table",
    params={"table": "<table>"},
)

in an astropy Table.

This method matches table columns that start with the case-insensitive names of the components of the requested frames (including differentials), if they are also followed by a non-alphanumeric character. It will also match columns that end with the component name if a non-alphanumeric character is before it.

For example, the first rule means columns with names like 'RA[J2000]' or 'ra' will be interpreted as ra attributes for ICRS frames, but 'RAJ2000' or 'radius' are not. Similarly, the second rule applied to the Galactic frame means that a column named 'gal_l' will be used as the l component, but gall or 'fill' will not.

The definition of alphanumeric here is based on Unicode's definition of alphanumeric, except without _ (which is normally considered alphanumeric). So for ASCII, this means the non-alphanumeric characters are <space>_!"#$%&'()*+,-./\:;<=>?@[]^`{|}~).

Parameters

Parameter Type Default Description
table (required) Table or subclass The table to load data from.
**coord_kwargs

Returns

``SkyCoord or subclass — The new instance.

Raises

  • ValueError: If more than one match is found in the table for a component, unless the additional matches are also valid frame component names. If a "coord_kwargs" is provided for a value also found in the table.

search_around_3d

Searches for all coordinates in this object around a supplied set of

SkyCoord.search_around_3d(searcharoundcoords, distlimit)

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="search_around_3d",
    params={"searcharoundcoords": "<searcharoundcoords>", "distlimit": "<distlimit>"},
)

points within a given 3D radius.

This is intended for use on SkyCoord objects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to use separation_3d.

For more on how to use this (and related) functionality, see the examples in :ref:astropy-coordinates-separations-matching.

Parameters

Parameter Type Default Description
searcharoundcoords (required) SkyCoord or BaseCoordinateFrame The coordinates to search around to try to find matching points in this |SkyCoord|. This must be a one-dimensional coordinate array.
distlimit (required) Quantity ['length'] The physical radius to search within. It should be broadcastable to the same shape as searcharoundcoords.

Returns

CoordinateSearchResult — A NamedTuple with attributes representing the indices of the elements of found pairs in the other set of coordinates and this |SkyCoord| and angular and physical separations of the pairs.

Notes

This method requires SciPy to be installed or it will fail.

In the current implementation, the return values are always sorted in the same order as the searcharoundcoords (so idxsearcharound is in ascending order). This is considered an implementation detail, though, so it could change in a future release.

See Also

astropy.coordinates.search_around_3d SkyCoord.search_around_sky

search_around_sky

Searches for all coordinates in this object around a supplied set of

SkyCoord.search_around_sky(searcharoundcoords, seplimit)

Call via MCP

astroquery_execute(
    module_name="coordinates",
    function_name="search_around_sky",
    params={"searcharoundcoords": "<searcharoundcoords>", "seplimit": "<seplimit>"},
)

points within a given on-sky separation.

This is intended for use on SkyCoord objects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to use separation.

For more on how to use this (and related) functionality, see the examples in :ref:astropy-coordinates-separations-matching.

Parameters

Parameter Type Default Description
searcharoundcoords (required) coordinate-like The coordinates to search around to try to find matching points in this |SkyCoord|. This must be a one-dimensional coordinate array.
seplimit (required) Quantity ['angle'] The on-sky separation to search within. It should be broadcastable to the same shape as searcharoundcoords.

Returns

CoordinateSearchResult — A NamedTuple with attributes representing the indices of the elements of found pairs in the other set of coordinates and this |SkyCoord| and angular and physical separations of the pairs. If either set of sources lack distances, the physical separation is the 3D distance on the unit sphere, rather than a true distance.

Notes

This method requires SciPy to be installed or it will fail.

In the current implementation, the return values are always sorted in the same order as the searcharoundcoords (so idxsearcharound is in ascending order). This is considered an implementation detail, though, so it could change in a future release.

See Also

astropy.coordinates.search_around_sky SkyCoord.search_around_3d

Clone this wiki locally