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_include()

Get the path to astropy.wcs’s C header files.

validate(source)

Prints a WCS validation report for the given FITS file.

Classes

Auxprm()

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.

InconsistentAxisTypesError()

The WCS header inconsistent or unrecognized coordinate axis type(s).

InvalidCoordinateError()

One or more of the world coordinates is invalid.

InvalidSubimageSpecificationError()

The subimage specification is invalid.

InvalidTabularParametersError()

The given tabular parameters are invalid.

InvalidTransformError()

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.

NoSolutionError()

No solution can be found in the given interval.

NoWcsKeywordsFoundError()

No WCS keywords were found in the given header.

NonseparableSubimageCoordinateSystemError()

Non-separable subimage coordinate system.

SingularMatrixError()

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.

Tabprm()

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.

Wtbarr()

Classes to construct coordinate lookup tables from a binary table extension (BINTABLE).

Class Inheritance Diagram

digraph inheritancec0043a22c8 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "AstropyWarning" [URL="../../api/astropy.utils.exceptions.AstropyWarning.html#astropy.utils.exceptions.AstropyWarning",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The base warning class from which all Astropy warnings should inherit."]; "Auxprm" [URL="../../api/astropy.wcs.Auxprm.html#astropy.wcs.Auxprm",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class that contains auxiliary coordinate system information of a specialist"]; "BaseHighLevelWCS" [URL="../../api/astropy.wcs.wcsapi.BaseHighLevelWCS.html#astropy.wcs.wcsapi.BaseHighLevelWCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for the high-level WCS interface."]; "BaseLowLevelWCS" [URL="../../api/astropy.wcs.wcsapi.BaseLowLevelWCS.html#astropy.wcs.wcsapi.BaseLowLevelWCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for the low-level WCS interface."]; "DistortionLookupTable" [URL="../../api/astropy.wcs.DistortionLookupTable.html#astropy.wcs.DistortionLookupTable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="DistortionLookupTable(*table*, *crpix*, *crval*, *cdelt*)"]; "FITSFixedWarning" [URL="../../api/astropy.wcs.FITSFixedWarning.html#astropy.wcs.FITSFixedWarning",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="The warning raised when the contents of the FITS header have been"]; "AstropyWarning" -> "FITSFixedWarning" [arrowsize=0.5,style="setlinewidth(0.5)"]; "FITSWCSAPIMixin" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="A mix-in class that is intended to be inherited by the"]; "BaseLowLevelWCS" -> "FITSWCSAPIMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HighLevelWCSMixin" -> "FITSWCSAPIMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HighLevelWCSMixin" [URL="../../api/astropy.wcs.wcsapi.HighLevelWCSMixin.html#astropy.wcs.wcsapi.HighLevelWCSMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mix-in class that automatically provides the high-level WCS API for the"]; "BaseHighLevelWCS" -> "HighLevelWCSMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InconsistentAxisTypesError" [URL="../../api/astropy.wcs.InconsistentAxisTypesError.html#astropy.wcs.InconsistentAxisTypesError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="InconsistentAxisTypesError()"]; "WcsError" -> "InconsistentAxisTypesError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InvalidCoordinateError" [URL="../../api/astropy.wcs.InvalidCoordinateError.html#astropy.wcs.InvalidCoordinateError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="InvalidCoordinateError()"]; "WcsError" -> "InvalidCoordinateError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InvalidSubimageSpecificationError" [URL="../../api/astropy.wcs.InvalidSubimageSpecificationError.html#astropy.wcs.InvalidSubimageSpecificationError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="InvalidSubimageSpecificationError()"]; "WcsError" -> "InvalidSubimageSpecificationError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InvalidTabularParametersError" [URL="../../api/astropy.wcs.InvalidTabularParametersError.html#astropy.wcs.InvalidTabularParametersError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="InvalidTabularParametersError()"]; "WcsError" -> "InvalidTabularParametersError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "InvalidTransformError" [URL="../../api/astropy.wcs.InvalidTransformError.html#astropy.wcs.InvalidTransformError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="InvalidTransformError()"]; "WcsError" -> "InvalidTransformError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NoConvergence" [URL="../../api/astropy.wcs.NoConvergence.html#astropy.wcs.NoConvergence",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="An error class used to report non-convergence and/or divergence"]; "NoSolutionError" [URL="../../api/astropy.wcs.NoSolutionError.html#astropy.wcs.NoSolutionError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="NoSolutionError()"]; "WcsError" -> "NoSolutionError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NoWcsKeywordsFoundError" [URL="../../api/astropy.wcs.NoWcsKeywordsFoundError.html#astropy.wcs.NoWcsKeywordsFoundError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="NoWcsKeywordsFoundError()"]; "WcsError" -> "NoWcsKeywordsFoundError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "NonseparableSubimageCoordinateSystemError" [URL="../../api/astropy.wcs.NonseparableSubimageCoordinateSystemError.html#astropy.wcs.NonseparableSubimageCoordinateSystemError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="NonseparableSubimageCoordinateSystemError()"]; "WcsError" -> "NonseparableSubimageCoordinateSystemError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SingularMatrixError" [URL="../../api/astropy.wcs.SingularMatrixError.html#astropy.wcs.SingularMatrixError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="SingularMatrixError()"]; "WcsError" -> "SingularMatrixError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Sip" [URL="../../api/astropy.wcs.Sip.html#astropy.wcs.Sip",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Sip(*a, b, ap, bp, crpix*)"]; "Tabprm" [URL="../../api/astropy.wcs.Tabprm.html#astropy.wcs.Tabprm",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A class to store the information related to tabular coordinates,"]; "WCS" [URL="../../api/astropy.wcs.WCS.html#astropy.wcs.WCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="WCS objects perform standard WCS transformations, and correct for"]; "FITSWCSAPIMixin" -> "WCS" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WCSBase" -> "WCS" [arrowsize=0.5,style="setlinewidth(0.5)"]; "WCSBase" [URL="../../api/astropy.wcs.WCSBase.html#astropy.wcs.WCSBase",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wcs(*sip, cpdis, wcsprm, det2im*)"]; "WcsError" [URL="../../api/astropy.wcs.WcsError.html#astropy.wcs.WcsError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base class of all invalid WCS errors."]; "Wcsprm" [URL="../../api/astropy.wcs.Wcsprm.html#astropy.wcs.Wcsprm",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wcsprm(header=None, key=' ', relax=False, naxis=2, keysel=0, colsel=None)"]; "Wtbarr" [URL="../../api/astropy.wcs.Wtbarr.html#astropy.wcs.Wtbarr",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Classes to construct coordinate lookup tables from a binary table"]; }

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.

wcs_to_celestial_frame(wcs)

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

proj_plane_pixel_scales(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.

proj_plane_pixel_area(wcs)

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.

non_celestial_pixel_scales(inwcs)

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.

Class Inheritance Diagram

digraph inheritance849780ade3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "custom_frame_to_wcs_mappings" [URL="../../api/astropy.wcs.utils.custom_frame_to_wcs_mappings.html#astropy.wcs.utils.custom_frame_to_wcs_mappings",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "custom_wcs_to_frame_mappings" [URL="../../api/astropy.wcs.utils.custom_wcs_to_frame_mappings.html#astropy.wcs.utils.custom_wcs_to_frame_mappings",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; }

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

wcs_info_str(wcs)

Classes

BaseHighLevelWCS()

Abstract base class for the high-level WCS interface.

BaseLowLevelWCS()

Abstract base class for the low-level WCS interface.

BaseWCSWrapper(wcs, *args, **kwargs)

A base wrapper class for things that modify Low Level WCSes.

HighLevelWCSMixin()

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.

Class Inheritance Diagram

digraph inheritance5e7a04931a { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "BaseHighLevelWCS" [URL="../../api/astropy.wcs.wcsapi.BaseHighLevelWCS.html#astropy.wcs.wcsapi.BaseHighLevelWCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for the high-level WCS interface."]; "BaseLowLevelWCS" [URL="../../api/astropy.wcs.wcsapi.BaseLowLevelWCS.html#astropy.wcs.wcsapi.BaseLowLevelWCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for the low-level WCS interface."]; "BaseWCSWrapper" [URL="../../api/astropy.wcs.wcsapi.BaseWCSWrapper.html#astropy.wcs.wcsapi.BaseWCSWrapper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A base wrapper class for things that modify Low Level WCSes."]; "BaseLowLevelWCS" -> "BaseWCSWrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HighLevelWCSMixin" [URL="../../api/astropy.wcs.wcsapi.HighLevelWCSMixin.html#astropy.wcs.wcsapi.HighLevelWCSMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mix-in class that automatically provides the high-level WCS API for the"]; "BaseHighLevelWCS" -> "HighLevelWCSMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "HighLevelWCSWrapper" [URL="../../api/astropy.wcs.wcsapi.HighLevelWCSWrapper.html#astropy.wcs.wcsapi.HighLevelWCSWrapper",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Wrapper class that can take any :class:`~astropy.wcs.wcsapi.BaseLowLevelWCS`"]; "HighLevelWCSMixin" -> "HighLevelWCSWrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; "SlicedLowLevelWCS" [URL="../../api/astropy.wcs.wcsapi.SlicedLowLevelWCS.html#astropy.wcs.wcsapi.SlicedLowLevelWCS",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A Low Level WCS wrapper which applies an array slice to a WCS."]; "BaseWCSWrapper" -> "SlicedLowLevelWCS" [arrowsize=0.5,style="setlinewidth(0.5)"]; }