STScI Logo

Hubble Space Telescope
ACS Distortion


ACS/WFC images suffer from extreme geometric distortions due to the optical assembly of the telescope. A new geometric distortion solution for the ACS/WFC has been derived employing a 5th order polynomial least squares solution combined with a new representation of the ACS/WFC X and Y time dependency. The new model also includes additional distortions on the top of the ACS/WFC geometric distortion, such as the pixel grid distortion and non-polynomial filter dependent component of the distortion. The ACS/WFC geometric distortion and its time dependent corrections are corrected through the application of 3 reference files (IDCTAB, D2IMFILE and NPOLFILE) which are not applied by the normal CALACS processes. Distortion related corrections are instead applied in the DrizzlePac/STSDAS software that uses the reference files to remove distortions, populate the image header WCS keywords (linear terms) and populate SIP coefficients (high order terms). However, the new time dependent distortion can only be applied using a new version of the DrizzlePac software (version 2.0.0)

More details on the updated distortion correction can be found in ISR 15-06.

The New Reference Files

The new reference files include:

The reference files are available for download from the HST Calibration Reference Data System (CRDS).

How To Use The New Reference Files

Basic steps

  1. Get the resources: To use these reference files you must download the propper files (D2IMFILE, and the correct IDCTAB and NPOLFILE for your data). Make sure you have the new DrizzlePac software (version 2.0.0 or greater)
  2. Update the global header: Set the global header keywords IDCTAB, NPOLFILE, and D2IMFILE to the path and filenames of the corresponding updated reference file.
  3. Update the WCS: Run updatewcs to get the correct, geometricly accurate header coordinates in the header.
  4. Run the software: Run TweakReg or AstroDrizzle with the "UPDATE WCS" option set to True. You only need to Update WCS once in either TweakReg or AstroDrizzle to apply the new solutions to the header. Doing so more than once will overwrite the current WCS information in the header.

Using Python

To update the header, change the IDCTAB keyword in the header to be the location (including full file name) of the new IDC reference file. Since the IDC file contains information for all filters in one file, the same file will be used for all images.

--> from import fits
--> fits.setval(image_filename, 'IDCTAB', value='/location/of/IDCfile/IDCFILEname.fits')

Change the NPOLFILE keyword to be the full path of the new NPOL reference file:

--> fits.setval(image_filename, 'NPOLFILE', value='/location/of/NPOLfile/NPOLFILEname.fits')

And change the D2IMFILE keyword to be the full path of the D2IM reference file. Since the D2IM file is independent of filter, the same file will be used for all images:

--> fits.setval(image_filename, 'D2IMFILE', value='/location/of/D2IMfile/D2IMFILEname.fits')

Keep in mind that if you update one of the reference files, you should update them all. These files are built on one another and mixing reference files will create issues.

Once the headers are changed, update the WCS information to use the new distortion information by running:

--> from stwcs import updatewcs
--> updatewcs.updatewcs('*flc.fits') # update the WCS in the header.

Then the DrizzlePac programs (AstroDrizzle, TweakReg, etc.) can be run normally. If aligning then combining images, you will want to run TweakReg first, use:

--> import drizzlepac
--> drizzlepac.__version__ #make sure it is 2.0.0 or greater
--> from drizzlepac import tweakreg
--> tweakreg.TweakReg('*flt.fits',threshold=500)

Note: If updating the WCS in this way, do not use the updatewcs keyword in TweakReg or AstroDrizzle. If updateWCS is used more than once, any WCS information in the header, including all updates saved to the header from TweakReg will be overwritten and lost when re-running.

When you have a solution that you are satisfied with from TweakReg, make sure to update your header using the updatehdr keyword before continuing to AstroDrizzle. This writes the alignment solution to the header to be used later.

Then drizzle the images using the new solution and alignment by using:

--> from drizzlepac import astrodrizzle
--> astrodrizzle.AstroDrizzle('*flc.fits')

More information

IDC file creation:

For more information about AstroDrizzle, please consult the DrizzlePac webpage.

A detailed description of CALACS is available at

Created by: Dave Borncamp. Last updated: February 07, 2017