img_cut
- astrocut.img_cut(input_files, coordinates, cutout_size, stretch='asinh', minmax_percent=None, minmax_value=None, invert=False, img_format='jpg', colorize=False, cutout_prefix='cutout', output_dir='.', extension=None, 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 as a single color image or in individual image 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.- stretchstr
Optional, default ‘asinh’. The stretch to apply to the image array. Valid values are: asinh, sinh, sqrt, log, linear
- minmax_percentarray
Optional, default [0.5,99.5]. Interval based on a keeping a specified fraction of pixels (can be asymmetric) when scaling the image. The format is [lower percentile, upper percentile], where pixel values below the lower percentile and above the upper percentile are clipped. Only one of minmax_percent and minmax_value should be specified.
- minmax_valuearray
Optional. Interval based on user-specified pixel values when scaling the image. The format is [min value, max value], where pixel values below the min value and above the max value are clipped. Only one of minmax_percent and minmax_value should be specified.
- invertbool
Optional, default False. If True the image is inverted (light pixels become dark and vice versa).
- img_formatstr
Optional, default ‘jpg’. The output image file type. Valid values are “jpg” and “png”.
- colorizebool
Optional, default False. If True a single color image is produced as output, and it is expected that three files are given as input.
- cutout_prefixstr
Default value “cutout”. Only used when producing a color image. A prefix to prepend to the cutout filename.
- output_dirstr
Defaul value ‘.’. The directory to save the cutout file(s) to.
- extensionint, list of ints, None, or ‘all’
Optional, default None. Default is to cutout the first extension that has image data. The user can also supply one or more extensions to cutout from (integers), or “all”.
- verbosebool
Default False. If true intermediate information is printed.
- Returns
- responsestr or list
If colorize is True returns the single output filepath. Otherwise returns a list of all the output filepaths.