Skip to main content
`Ctrl`+`K`

# wcs_to_celestial_frame

astropy.wcs.utils.wcs_to_celestial_frame(wcs)

  For a given WCS, return the coordinate frame that matches the celestial component of the WCS.

  Parameters:
    wcs `WCS` instance

      The WCS to find the frame for

  Returns:
    frame `BaseCoordinateFrame` subclass instance

      An instance of a `BaseCoordinateFrame` subclass instance that best matches the specified WCS.

  Notes

  To extend this function to frames not defined in astropy.coordinates, you can write your own function which should take a `WCS` instance and should return either an instance of a frame, or `None` if no matching frame was found. You can register this function temporarily with:

      >>> from astropy.wcs.utils import wcs_to_celestial_frame, custom_wcs_to_frame_mappings
      >>> with custom_wcs_to_frame_mappings(my_function):
      ...     wcs_to_celestial_frame(...)