# Reference/API¶

## astropy.wcs Package¶

astropy.wcs contains utilities for managing World Coordinate System (WCS) transformations in FITS files. These transformations map the pixel locations in an image to their real-world units, such as their position on the sky sphere.

It performs three separate classes of WCS transformations:

Each of these transformations can be used independently or together in a standard pipeline.

### Functions¶

 find_all_wcs(header[, relax, keysel, fix, …]) Find all the WCS transformations in the given header. Get the path to astropy.wcs’s C header files. validate(source) Prints a WCS validation report for the given FITS file.

### Classes¶

 Class that contains auxiliary coordinate system information of a specialist nature. DistortionLookupTable(*table*, *crpix*, …) Represents a single lookup table for a distortion paper transformation. FITSFixedWarning The warning raised when the contents of the FITS header have been modified to be standards compliant. The WCS header inconsistent or unrecognized coordinate axis type(s). One or more of the world coordinates is invalid. The subimage specification is invalid. The given tabular parameters are invalid. The WCS transformation is invalid, or the transformation parameters are invalid. NoConvergence(*args[, best_solution, …]) An error class used to report non-convergence and/or divergence of numerical methods. No solution can be found in the given interval. No WCS keywords were found in the given header. Non-separable subimage coordinate system. The linear transformation matrix is singular. Sip(*a, b, ap, bp, crpix*) The Sip class performs polynomial distortion correction using the SIP convention in both directions. A class to store the information related to tabular coordinates, i.e., coordinates that are defined via a lookup table. WCS([header, fobj, key, minerr, relax, …]) WCS objects perform standard WCS transformations, and correct for SIP and distortion paper table-lookup transformations, based on the WCS keywords and supplementary data read from a FITS file. WCSBase(*sip, cpdis, wcsprm, det2im*) Wcs objects amalgamate basic WCS (as provided by wcslib), with SIP and distortion paper operations. WcsError Base class of all invalid WCS errors. Wcsprm([header, key, relax, naxis, keysel, …]) Wcsprm performs the core WCS transformations. Classes to construct coordinate lookup tables from a binary table extension (BINTABLE).

## astropy.wcs.utils Module¶

### Functions¶

 add_stokes_axis_to_wcs(wcs, add_before_ind) Add a new Stokes axis that is uncorrelated with any other axes. celestial_frame_to_wcs(frame[, projection]) For a given coordinate frame, return the corresponding WCS object. For a given WCS, return the coordinate frame that matches the celestial component of the WCS. For a WCS returns pixel scales along each axis of the image pixel at the CRPIX location once it is projected onto the “plane of intermediate world coordinates” as defined in Greisen & Calabretta 2002, A&A, 395, 1061. For a celestial WCS (see astropy.wcs.WCS.celestial) returns pixel area of the image pixel at the CRPIX location once it is projected onto the “plane of intermediate world coordinates” as defined in Greisen & Calabretta 2002, A&A, 395, 1061. is_proj_plane_distorted(wcs[, maxerr]) For a WCS returns False if square image (detector) pixels stay square when projected onto the “plane of intermediate world coordinates” as defined in Greisen & Calabretta 2002, A&A, 395, 1061. Calculate the pixel scale along each axis of a non-celestial WCS, for example one with mixed spectral and spatial axes. skycoord_to_pixel(coords, wcs[, origin, mode]) Convert a set of SkyCoord coordinates into pixels. pixel_to_skycoord(xp, yp, wcs[, origin, …]) Convert a set of pixel coordinates into a SkyCoord coordinate. pixel_to_pixel(wcs_in, wcs_out, *inputs) Transform pixel coordinates in a dataset with a WCS to pixel coordinates in another dataset with a different WCS. local_partial_pixel_derivatives(wcs, *pixel) Return a matrix of shape (world_n_dim, pixel_n_dim) where each entry [i, j] is the partial derivative d(world_i)/d(pixel_j) at the requested pixel position. fit_wcs_from_points(xy, world_coords[, …]) Given two matching sets of coordinates on detector and sky, compute the WCS.

### Classes¶

 custom_wcs_to_frame_mappings([mappings]) custom_frame_to_wcs_mappings([mappings])

## astropy.wcs.wcsapi Package¶

### Functions¶

 deserialize_class(tpl[, construct]) Deserialize classes recursively. sanitize_slices(slices, ndim) Given a slice as input sanitise it to an easier to parse format.format validate_physical_types(physical_types) Validate a list of physical types against the UCD1+ standard

### Classes¶

 Abstract base class for the high-level WCS interface. Abstract base class for the low-level WCS interface. BaseWCSWrapper(wcs, *args, **kwargs) A base wrapper class for things that modify Low Level WCSes. Mix-in class that automatically provides the high-level WCS API for the low-level WCS object given by the low_level_wcs property. HighLevelWCSWrapper(low_level_wcs) Wrapper class that can take any BaseLowLevelWCS object and expose the high-level WCS API. SlicedLowLevelWCS(wcs, slices) A Low Level WCS wrapper which applies an array slice to a WCS.