read_FITS_image

class read_FITS_image.FITSInformation(fitsfile)[source]

This class reads in data and metadata from a FITS image file, and stores it for use in generating relevant coord systems and data when fitting shapelets. Expects an CLEANed image, testing against WSClean outputs. See attributes for futher functionality, and variables for what can be accessed.

Parameters:

fitsfile (str) – name of a FITS image file to gather relevant data and metadata from

Variables:
  • fitsfile (str) – the given fitsfile parameter
  • header – an astropy header instance of the FITS file
  • data (array) – a 2D numpy array of the image data
  • read_data (bool) – True if successful in reading data
  • ra_reso (float) – RA resolution (deg)
  • dec_reso (float) – Dec resolution (deg)
  • pix_area_rad (float) – pixel area (ster radian)
  • len1 (int) – number of pixels in NAXIS1
  • len2 (int) – number of pixels in NAXIS2
  • wcs – an astropy WCS instance based on self.header
  • flat_data (array) – self.data.flatten()
  • bmaj (float) – restoring beam major axis - if keyword BMAJ not in header, set to None
  • bmin (float) – restoring beam minor axis - if keyword BMIN not in header, set to None
  • solid_beam (float) – solid beam angle: (pi*self.bmaj*self.bmin) / (4*log(2))
  • convert2pixel (float) – conversion factor need to convert Jy/beam to Jy/pixel
  • got_convert2pixel (bool) – True if all metadata to create self.convert2pixel was available
covert_to_jansky_per_pix()[source]

Coverts data in Jy/beam to Jy/pixel as stored in self.data and self.flat_data

create_restoring_kernel()[source]

Use the FITS header metadata to create 2D restoring Gaussian beam kernel with the height and width of the kernel set to 8 times larger than BMAJ

Returns:2D array of the restoring beam at the same resolution of the image. Also stored as self.rest_gauss_kern
Return type:array
get_radec_edgepad(edge_pad=False)[source]

Use FITS information to form values of RA, DEC for all pixels in this image If specified, edge pad the data with zeros, and add extra RA and DEC range accordingly.

Parameters:

edge_pad (int) – If True, edge pad the data with the specified number of pixels

Variables:
  • ras (array) – RA values of all pixels in image, flattened into a 1D array (radians)
  • decs (array) – DEC values of all pixels in image, flattened into a 1D array (radians)