multicolorfits.crop_image_sky#

multicolorfits.crop_image_sky(datain, hdrin, centerRADEC, radius_asec, newref=None, savenew=False, overwrite=False, return_cropcenterpix=False, coords_in='dec', checksys=False, incoordsys='fk5', incoordequinox='J2000.0', forceimagesys=None)[source]#

Function to crop a 2D fits image based on sky coordinates and specified width.

Parameters:
  • datain (array) – Input fits image array

  • hdrin (astropy.io.fits.header) – Input header

  • centerRADEC (list) – List of RA,DEC coords. e.g. [12.345678,-10.98765]

  • radius_asec (float) – Radius (box half-width) of new image, in arcseconds

  • newref (str) – None, ‘center’, or ‘origin’. None keeps the reference pixel sky coordinate the same. ‘center’ forces the reference pixel to be the new center, ‘origin’ forces it to the new origin.

  • savenew (bool or str) – False (default) does not save, otherwise specify a save path (e.g. savenew=’./mynewfits.fits’) to save the crop to disk

  • overwrite (bool) – Input option to astropy.io.fits.writeto(…, overwrite=False)

  • return_cropcenterpix (bool) – True will return the cropped image center pixel location.

  • coords_in (str) – ‘dec’ for decimal (default) or ‘sex’ for sexagesimal.

  • checksys (bool) – Passes to sky_to_pixel(). When True, checks that the input coordinate frame is the same as the header frame (e.g., fk5, icrs, etc.)

  • incoordsys (str) – Passes to sky_to_pixel(). SkyCoord frame system, default = ‘fk5’

  • incoordequinox (str) – Passes to sky_to_pixel(). equinox, default = ‘J2000.0’

  • forceimagesys (str) – Passes to sky_to_pixel(). SkyCoord frame system. User can specify a frame forceimagesys to use (in case no RADESYS in the header, or if it’s known to be wrong…)

Returns:

array, astropy.io.fits.header – cropdata, crophdr