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. These transformations can work both forward (from pixel to sky) and backward (from sky to pixel). This example loads a FITS file (supplied on the commandline) and uses the WCS cards in its primary header to transform. This example, rather than starting from a FITS header, sets WCS values programmatically, uses those settings to transform some points, and then saves those settings to a new FITS header. Bounds checking is enabled by default, and any computed world coordinates outside of [-180°, 180°] for longitude and [-90°, 90°] in latitude are marked as invalid. To disable this behavior, use astropy.wcs.Wcsprm.bounds_check. As astropy.wcs is based on wcslib, it supports the standard projections defined in the FITS WCS standard. These projection codes are specified in the second part of the CTYPEn keywords (accessible through Wcsprm.ctype), for example, RA—TAN-SIP. The supported projection codes are: WCS objects can be broken apart into their constituent axes using the sub function. There is also a celestial convenience function that will return a WCS object with only the celestial axes included. The pixel scales of a celestial image or the pixel dimensions of a non-celestial image can be extracted with the utility functions proj_plane_pixel_scales and non_celestial_pixel_scales. Likewise, celestial pixel area can be extracted with the utility function proj_plane_pixel_area. The WCSAxes affiliated package adds the ability to use the WCS to define projections in Matplotlib. More information on installing and using WCSAxes can be found here. 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. Source.