fits_cut¶
- astrocut.fits_cut(input_files, coordinates, cutout_size, correct_wcs=False, drop_after=None, single_outfile=True, cutout_prefix='cutout', output_dir='.', verbose=False)[source]¶
Takes one or more fits files with the same WCS/pointing, makes the same cutout in each file, and returns the result either in a single fitsfile with one cutout per extension or in individual fits files.
Note: No checking is done on either the WCS pointing or pixel scale. If images don’t line up the cutouts will also not line up.
- Parameters
- input_fileslist
List of fits image files to cutout from. The image is assumed to be in the first extension.
- coordinatesstr or
SkyCoord
object The position around which to cutout. It may be specified as a string (“ra dec” in degrees) or as the appropriate
SkyCoord
object.- cutout_sizeint, array-like,
Quantity
The size of the cutout array. If
cutout_size
is a scalar number or a scalarQuantity
, then a square cutout ofcutout_size
will be created. Ifcutout_size
has two elements, they should be in(ny, nx)
order. Scalar numbers incutout_size
are assumed to be in units of pixels.Quantity
objects must be in pixel or angular units.- correct_wcsbool
Default False. If true a new WCS will be created for the cutout that is tangent projected and does not include distortions.
- single_outfilebool
Default True. If true return all cutouts in a single fits file with one cutout per extension, if False return cutouts in individual fits files. If returing a single file the filename will have the form: <cutout_prefix>_<ra>_<dec>_<size x>_<size y>.fits. If returning multiple files each will be named: <original filemame base>_<ra>_<dec>_<size x>_<size y>.fits.
- cutout_prefixstr
Default value “cutout”. Only used if single_outfile is True. A prefix to prepend to the cutout filename.
- output_dirstr
Defaul value ‘.’. The directory to save the cutout file(s) to.
- verbosebool
Default False. If true intermediate information is printed.
- Returns
- responsestr or list
If single_outfile is True returns the single output filepath. Otherwise returns a list of all the output filepaths.