## Introduction

The optical design of ACS is characterized by a large amount of geometric distortion. From the ACS Instrument Handbook Section 5.6.4: "The distortions render the pixels, as projected on the sky, trapezoidal in shape and their area varies over the field by about 19% and 3.5% in the WFC and HRC/SBC, respectively."

The AstroDrizzle software package transforms ACS images into a distortion-free frame  However, when photometry needs to be obtained on data that have not been processed by AstroDrizzle, a correction must be applied to account for the different on-sky pixel size across the field of view. A pixel area map (PAM), which is an image where each pixel value describes that pixel's area on the sky relative to the native plate scale, is used for this correction. For the ACS/WFC, the plate scale is 0.05 arcseconds/pixel, while for HRC and SBC it is set to 0.025 arcseconds/pixel.

To transform a distorted FLT/FLC image so that it is suitable for photometry, users must multiply the image by the PAM and divide the result by the exposure time so that the pixel values in the image are in units of electrons/second. After this transformation, the information on the ACS Zeropoints page can be used to convert flux measurements into physical units.

## Changes to PAMs in 2018

Previously, the ACS PAMs were provided as static FITS files available for download. However, these files were never updated since their creation in early 2004, and they did not keep track of subsequent improvements in the distortion model. Since the distortion model has become more complex a one-size-fits-all PAM is no longer viable. To remedy this, we now provide Python code that can be used to make updated PAMs and FLT/FLC users are strongly encouraged to make use of this code. It supports all three of the ACS detectors, and it can generate PAMs valid for all dates since the ACS installation in March 2002. Additionally, rather than being an image of the entire detector, the new PAMs have the same shape and position in detector space as the input data, therefore no adjustments to the PAMs need to be made for subarray apertures.

Testing has shown that the new PAMs are within ~0.2% of the 2004 PAMs for images taken in 2018.

## Creating a PAM

The code used to make PAMs is packaged with stsci.skypac in AstroConda and the documenation for this package is available here. In this example, we will create a PAM from observations of the galaxy cluster ABELL 1185 taken on February 3rd, 2004. We will use astroquery to download the required data and then use stsci.skypac module to create the PAM for the first science extension (chip 2 on the detector):

from astroquery.mast import Observations
from astropy.io import fits
from stsci.skypac import pamutils

import os
import glob
import shutil

# Query MAST for the data
obs_table = Observations.query_criteria(obs_id='J6ME13QHQ')

# Move the FLT to the top level directory
for f in files:
try:
shutil.move(f, '.')
except:
os.remove(f.split('/')[-1])
shutil.move(f, '.')

pamutils.pam_from_file('j6me13qhq_flt.fits', ('sci', 1), 'j6me13qhq_wfc2_pam.fits')