hcongrid¶
-
FITS_tools.hcongrid.
hcongrid
(image, header1, header2, preserve_bad_pixels=True, **kwargs)[source] [edit on github]¶ Interpolate an image from one FITS header onto another
kwargs will be passed to
map_coordinates
Parameters: image :
ndarray
A two-dimensional image
The header or WCS corresponding to the image
The header or WCS to interpolate onto
preserve_bad_pixels : bool
Try to set NAN pixels to NAN in the zoomed image. Otherwise, bad pixels will be set to zero
Returns: newimage :
ndarray
ndarray with shape defined by header2’s naxis1/naxis2
Raises: TypeError if either is not a Header or WCS instance
Exception if image1’s shape doesn’t match header1’s naxis1/naxis2
Examples
>>> fits1 = pyfits.open('test.fits') >>> target_header = pyfits.getheader('test2.fits') >>> new_image = hcongrid(fits1[0].data, fits1[0].header, target_header)