Coordinates (SkyCoord)
Astropy SkyCoord helpers: name resolution, constellations, cross-matching.
Module name:
coordinatesPython class:
astropy.coordinates.SkyCoordFunctions: 7
Call any function below with the astroquery_execute MCP tool. Descriptions are taken from the upstream astroquery/astropy docstrings.
Function |
Summary |
|---|---|
Given a name, query the CDS name resolver to attempt to retrieve |
|
Create a new SkyCoord from pixel coordinates using a World Coordinate System. |
|
Determines the constellation(s) of the coordinates this SkyCoord contains. |
|
Get the mask associated with these coordinates. |
|
A convenience method to create and return a new SkyCoord from the data |
|
Searches for all coordinates in this object around a supplied set of |
|
Searches for all coordinates in this object around a supplied set of |
Functions
from_name
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="from_name",
params={"name": "<name>"},
)
- classmethod SkyCoord.from_name(name, frame='icrs', parse=False, cache=True)
Given a name, query the CDS name resolver to attempt to retrieve 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 forget_icrs_coordinatesfor more information.- Parameters:
name (
str) – The name of the object to get coordinates for, e.g.'M42'.frame (
strorBaseCoordinateFrameclass orinstance) – The frame to transform the object to.parse (
bool) – 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, optional) – Determines whether to cache the results or not. To update or overwrite an existing value, passcache='update'.
- Returns:
coord – Instance of the SkyCoord class.
- Return type:
SkyCoord
from_pixel
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="from_pixel",
params={"xp": "<xp>", "yp": "<yp>", "wcs": "<wcs>"},
)
- classmethod SkyCoord.from_pixel(xp, yp, wcs, origin=0, mode='all')
Create a new SkyCoord from pixel coordinates using a World Coordinate System.
- Parameters:
xp (
floatorndarray) – The coordinates to convert.yp (
floatorndarray) – The coordinates to convert.wcs (
WCS) – The WCS to use for convertorigin (
int) – Whether to return 0 or 1-based pixel coordinates.mode (
'all'or'wcs') – Whether to do the transformation including distortions ('all') or only including only the core WCS transformation ('wcs').
- Returns:
coord – A new object with sky coordinates corresponding to the input
xpandyp.- Return type:
See also
to_pixelto do the inverse operation
astropy.wcs.utils.pixel_to_skycoordthe implementation of this method
get_constellation
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="get_constellation",
params={},
)
- SkyCoord.get_constellation(short_name=False, constellation_list='iau')
Determines the constellation(s) of the coordinates this SkyCoord contains.
- Parameters:
short_name (
bool) – If True, the returned names are the IAU-sanctioned abbreviated names. Otherwise, full names for the constellations are used.constellation_list (
str) – The set of constellations to use. Currently only'iau'is supported, meaning the 88 “modern” constellations endorsed by the IAU.
- Returns:
constellation – If this is a scalar coordinate, returns the name of the constellation. If it is an array |SkyCoord|, it returns an array of names.
- Return type:
strorstring array
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.
get_mask
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="get_mask",
params={},
)
- SkyCoord.get_mask(*attrs)
Get the mask associated with these coordinates.
- Parameters:
*attrs (
str) – Attributes from which to get the masks to combine. Items can be dotted, like"data.lon", "data.lat". By default, get the combined mask of all components (including from differentials), ignoring possible masks of attributes.- Returns:
mask – The combined, read-only mask. If the instance is not masked, it is an array of
Falsewith the correct shape.- Return type:
- Raises:
ValueError – If the coordinate frame has no associated data.
guess_from_table
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="guess_from_table",
params={"table": "<table>"},
)
- classmethod SkyCoord.guess_from_table(table, **coord_kwargs)
A convenience method to create and return a new SkyCoord from the data 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 asraattributes forICRSframes, but'RAJ2000'or'radius'are not. Similarly, the second rule applied to theGalacticframe means that a column named'gal_l'will be used as thelcomponent, butgallor'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:
table (
Tableorsubclass) – The table to load data from.**coord_kwargs – Any additional keyword arguments are passed directly to this class’s constructor.
- Returns:
newsc – The new instance.
- Return type:
SkyCoordorsubclass- 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
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="search_around_3d",
params={"searcharoundcoords": "<searcharoundcoords>", "distlimit": "<distlimit>"},
)
- SkyCoord.search_around_3d(searcharoundcoords, distlimit)
Searches for all coordinates in this object around a supplied set of points within a given 3D radius.
This is intended for use on
SkyCoordobjects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to useseparation_3d().For more on how to use this (and related) functionality, see the examples in Separations, Offsets, Catalog Matching, and Related Functionality.
- Parameters:
searcharoundcoords (
SkyCoordorBaseCoordinateFrame) – The coordinates to search around to try to find matching points in this |SkyCoord|. This must be a one-dimensional coordinate array.distlimit (
Quantity['length']) – The physical radius to search within. It should be broadcastable to the same shape assearcharoundcoords.
- Returns:
A
NamedTuplewith 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.- Return type:
CoordinateSearchResult
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(soidxsearcharoundis 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
Call via MCP
astroquery_execute(
module_name="coordinates",
function_name="search_around_sky",
params={"searcharoundcoords": "<searcharoundcoords>", "seplimit": "<seplimit>"},
)
- SkyCoord.search_around_sky(searcharoundcoords, seplimit)
Searches for all coordinates in this object around a supplied set of points within a given on-sky separation.
This is intended for use on
SkyCoordobjects with coordinate arrays, rather than a scalar coordinate. For a scalar coordinate, it is better to useseparation().For more on how to use this (and related) functionality, see the examples in Separations, Offsets, Catalog Matching, and Related Functionality.
- Parameters:
searcharoundcoords (
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 (
Quantity['angle']) – The on-sky separation to search within. It should be broadcastable to the same shape assearcharoundcoords.
- Returns:
A
NamedTuplewith 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.- Return type:
CoordinateSearchResult
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(soidxsearcharoundis 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