def wipe(args): for im_name in args.input: im = astroim.Astroim(im_name) hdulist = im.HDUList if im.HDUList_mask: hdulist += im.HDUList_mask for hdu in hdulist: hdu.header = utilities.remove_WCS(hdu.header) if im.HDUList_mask: im.HDUList_mask.writeto(im.mask_name, clobber=True) im.write()
def build(im=None, output_file=None): # Read the image, separate the main header (if present) and the N chips im_HDUList = fits.open(im) main_hdr = find_primaryHDU(im_HDUList) chip_list = find_chips(im_HDUList) # Create images in the /tmp directory from the N chips temp_images = create_images(chip_list) # Do the mosaic arguments = temp_images + [output_file, "--cores", "1", "--no-reprojection", "--overwrite"] mosaic.main(arguments) # Remove WCS from main header and plug it into the image main_hdr = utilities.remove_WCS(main_hdr) output_image = fits.open(output_file, 'update') output_image[0].header += main_hdr output_image.flush() output_image.close()
def wipe(args): for im_name in args.input: with fits.open(im_name, 'update') as im: for hdu in im: hdu.header = utilities.remove_WCS(hdu.header) im.flush()