cwitools.reduction.crop¶
-
cwitools.reduction.crop(inputfits, xcrop=None, ycrop=None, wcrop=None, auto=False, autopad=1, plot=False)¶ Crops an input data cube (FITS).
- Args:
- inputfits (astropy.io.fits.HDUList): FITS file to be trimmed. xcrop (int tuple): Indices of range to crop x-axis to. Default: None. ycrop (int tuple): Indices of range to crop y-axis to. Default: None. wcrop (int tuple): Wavelength range (A) to crop cube to. Default: None. auto (boolean): Set to True to automatically determine all crop params.
- Returns:
- astropy.io.fits.HDUList: Trimmed FITS object with updated header.
Examples:
The parameter wcrop (wavelength crop) is in Angstrom, so to crop a data cube to the wavelength range 4200-4400A ,the usage would be:
>>> from astropy.io import fits >>> from cwitools.reduction import crop >>> myfits = fits.open("mydata.fits") >>> myfits_cropped = crop(myfits,wcrop=(4200,4400))
Crop ranges for the x/y axes are given in image coordinates (px). They can be given either as straight-forward indices:
>>> crop(myfits, xcrop=(10,60))
Or using negative numbers to count backwards from the last index:
>>> crop(myfits, ycrop=(10,-10))