Reference/API#

astropy.wcs Package#

World Coordinate System (WCS) transformations in FITS files.

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.

Celprm

Class that contains information required to transform celestial coordinates.

DistortionLookupTable(table, crpix, crval, cdelt)

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.

InvalidPrjParametersError()

The given projection parameters are 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.

Prjprm

Class that contains information needed to project or deproject native spherical coordinates.

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#

Inheritance diagram of astropy.wcs.Auxprm, astropy.wcs.Celprm, astropy.wcs.DistortionLookupTable, astropy.wcs.wcs.FITSFixedWarning, astropy.wcs._wcs.InconsistentAxisTypesError, astropy.wcs._wcs.InvalidCoordinateError, astropy.wcs._wcs.InvalidPrjParametersError, astropy.wcs._wcs.InvalidSubimageSpecificationError, astropy.wcs._wcs.InvalidTabularParametersError, astropy.wcs._wcs.InvalidTransformError, astropy.wcs.wcs.NoConvergence, astropy.wcs._wcs.NoSolutionError, astropy.wcs._wcs.NoWcsKeywordsFoundError, astropy.wcs._wcs.NonseparableSubimageCoordinateSystemError, astropy.wcs.Prjprm, astropy.wcs._wcs.SingularMatrixError, astropy.wcs.Sip, astropy.wcs.Tabprm, astropy.wcs.wcs.WCS, astropy.wcs.WCSBase, astropy.wcs._wcs.WcsError, astropy.wcs.Wcsprm, astropy.wcs.Wtbarr

astropy.wcs.utils Module#

Functions#

obsgeo_to_frame(obsgeo, obstime)

Convert a WCS obsgeo property into an ITRS coordinate frame.

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)

is_proj_plane_distorted(wcs[, maxerr])

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.

Classes#

Class Inheritance Diagram#

Inheritance diagram of astropy.wcs.utils.custom_wcs_to_frame_mappings, astropy.wcs.utils.custom_frame_to_wcs_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.

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#

Inheritance diagram of astropy.wcs.wcsapi.high_level_api.BaseHighLevelWCS, astropy.wcs.wcsapi.low_level_api.BaseLowLevelWCS, astropy.wcs.wcsapi.wrappers.base.BaseWCSWrapper, astropy.wcs.wcsapi.high_level_api.HighLevelWCSMixin, astropy.wcs.wcsapi.high_level_wcs_wrapper.HighLevelWCSWrapper, astropy.wcs.wcsapi.wrappers.sliced_wcs.SlicedLowLevelWCS