'Calculates the footprint of the image on the sky.
A footprint is defined as the positions of the corners of the
image on the sky after all available distortions have been
applied.
Parameters
header : `~astropy.io.fits.Header` object, optional
Used to get ``NAXIS1`` and ``NAXIS2``
header and axes are mutually exclusive, alternative ways
to provide the same information.
undistort : bool, optional
If `True`, take SIP and distortion lookup table into
account
axes : length 2 sequence ints, optional
If provided, use the given sequence as the shape of the
image.  Otherwise, use the ``NAXIS1`` and ``NAXIS2``
keywords from the header that was used to create this
`WCS` object.
center : bool, optional
If `True` use the center of the pixel, otherwise use the corner.
Returns
coord : (4, 2) array of (*x*, *y*) coordinates.
The order is clockwise starting with the bottom left corner.'

def calc_footprint(self, header=None, undistort=True, axes=None, center=True):

    if (axes is not None):
        (naxis1, naxis2) = axes
    elif (header is None):
        try:
            naxis1 = self._naxis1
            naxis2 = self._naxis2
        except AttributeError:
            warnings.warn(u'Need    a    valid    header    in    order    to    calculate    footprint\n', AstropyUserWarning)
            return None
    else:
        naxis1 = header.get(u'NAXIS1', None)
        naxis2 = header.get(u'NAXIS2', None)
    if ((naxis1 is None) or (naxis2 is None)):
        raise ValueError(u'Image    size    could    not    be    determined.')
    if center:
        corners = np.array([[1, 1], [1, naxis2], [naxis1, naxis2], [naxis1, 1]], dtype=np.float64)
    else:
        corners = np.array([[0.5, 0.5], [0.5, (naxis2 + 0.5)], [(naxis1 + 0.5), (naxis2 + 0.5)], [(naxis1 + 0.5), 0.5]], dtype=np.float64)
    if undistort:
        return self.all_pix2world(corners, 1)
    else:
        return self.wcs_pix2world(corners, 1)
