REQUIREMENT: Before proceeding, install or update your stenv distribution. stenv is the replacement for AstroConda, which is unsupported as of February 2023.

Obtaining Pixel Area Maps for ACS Data#

Introduction#


The optical design of ACS introduces larger geometric distortion than in other HST instruments. In the event a user wishes to perform photometry on data that have not been processed by AstroDrizzle, a correction must be applied to account for the different sizes of the pixels on the sky 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. The distortion corrections applied by both AstroDrizzle and the PAMs include observation-specific corrections (e.g., velocity distortion). For the best results, users are advised to create a PAM for each observation individually.

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 image has units of electrons/second. After this transformation, the information on the ACS Zeropoints page can be used to convert flux measurements into physical units.

This tutorial will show you how to…#

1. Construct the Pixel Area Map#

  • Use AstroDrizzle with ASN files to combine images.

2. Apply the Pixel Area Map#

  • Identify which dark images to use for your data.

  • Use AstroDrizzle to combine dark images.

Imports#


Here we list the Python packages used in this notebook. Links to the documentation for each module is provided for convenience.

Package Name

module

docs

used for

os

system

link

command line input

os

environ

link

setting environments

shutil

rmtree

link

remove directory tree

astroquery.mast

Observations

link

download data from MAST

astropy.io

fits

link

access and update fits files

stsci.skypac

pamutils

link

construct pixel area map

import os
import shutil

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

from p_module import plot
The following task in the stsci.skypac package can be run with TEAL:
                                    skymatch                                    

Download the Data#


Here we download all of the data required for this notebook. This is an important step! Some of the image processing steps require all relevant files to be in the working directory. We recommend working with a brand new directory for every new set of data.

GO Proposal 9438: “The Origin of the Intergalactic Globular Cluster Population in Abell 1185”#

For this example, we will only retreive data associated with the Observation ID J6ME13QHQ. Using the python package astroquery, we can retreive files from the MAST archive.

MAY CHANGE: The argument "mrp_only" stands for "minimum recommended products only". It currently needs to be set to False, although in the future, False is intended to be set as the default and can be left out.
obs_table = Observations.query_criteria(proposal_id=9438, obs_id='J6ME13QHQ')

dl_table = Observations.download_products(obs_table['obsid'], 
                                          mrp_only=False, 
                                          productSubGroupDescription=['FLT'])
Downloading URL https://mast.stsci.edu/api/v0.1/Download/file?uri=mast:HST/product/j6me13qhq_flt.fits to ./mastDownload/HST/j6me13qhq/j6me13qhq_flt.fits ...
 [Done]

We’ll use the packages os and shutil to put all of these files in our working directory for convenience and do a little housekeeping.

for row in dl_table:
    oldfname = row['Local Path']
    newfname = os.path.basename(oldfname)
    os.rename(oldfname, newfname)
    
shutil.rmtree('mastDownload')

File Information#


The structure of the fits files from ACS may be different depending on what kind of observation was made. For more information, refer to Section 2.2 of the ACS Data Handbook.

FLT Files (WFC-Specific)#

Ext

Name

Type

Contains

0

PRIMARY

(PrimaryHDU)

Meta-data related to the entire file.

1

SCI (Image)

(ImageHDU)

WFC2 raw image data.

2

ERR (Error)

(ImageHDU)

WFC2 error array.

3

DQ (Data Quality)

(ImageHDU)

WFC2 data quality array.

4

SCI (Image)

(ImageHDU)

WFC1 raw image data.

5

ERR (Error)

(ImageHDU)

WFC1 error array.

6

DQ (Data Quality)

(ImageHDU)

WFC1 data quality array.

7-10

D2IMARR

(ImageHDU)

Filter-independent CCD pixel-grid distortion corrections.

11-14

WCSDVARR

(ImageHDU)

Filter-dependent non-polynomial distortion corrections.

15

WCSCORR

(ImageHDU)

History of changes to the WCS solution.

Here, we set our files to variable names below for convenience.

flt_file = 'j6me13qhq_flt.fits'

You can always use .info() on an HDUlist for an overview of the structure

with fits.open(flt_file) as hdulist:
    hdulist.info()
Filename: j6me13qhq_flt.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     260   ()      
  1  SCI           1 ImageHDU       244   (4096, 2048)   float32   
  2  ERR           1 ImageHDU        53   (4096, 2048)   float32   
  3  DQ            1 ImageHDU        45   (4096, 2048)   int16   
  4  SCI           2 ImageHDU       242   (4096, 2048)   float32   
  5  ERR           2 ImageHDU        53   (4096, 2048)   float32   
  6  DQ            2 ImageHDU        45   (4096, 2048)   int16   
  7  HDRLET        1 HeaderletHDU     18   ()      
  8  HDRLET        2 HeaderletHDU     26   ()      
  9  WCSCORR       1 BinTableHDU     59   14R x 24C   [40A, I, A, 24A, 24A, 24A, 24A, D, D, D, D, D, D, D, D, 24A, 24A, D, D, D, D, J, 40A, 128A]   
 10  HDRLET       18 HeaderletHDU     26   ()      
 11  WCSDVARR      1 ImageHDU        15   (64, 32)   float32   
 12  WCSDVARR      2 ImageHDU        15   (64, 32)   float32   
 13  D2IMARR       1 ImageHDU        15   (64, 32)   float32   
 14  D2IMARR       2 ImageHDU        15   (64, 32)   float32   
 15  WCSDVARR      3 ImageHDU        15   (64, 32)   float32   
 16  WCSDVARR      4 ImageHDU        15   (64, 32)   float32   
 17  D2IMARR       3 ImageHDU        15   (64, 32)   float32   
 18  D2IMARR       4 ImageHDU        15   (64, 32)   float32   
 19  HDRLET        4 HeaderletHDU     26   ()      
 20  HDRLET        5 HeaderletHDU     26   ()      

Construct Pixel Area Map #


Function input for pamutils.pam_from_file is (input_file, extension, output_file). To create a PAM for the first science extension (WFC2) of this observation, we need to specify HDU Extension 1.

pamutils.pam_from_file(flt_file, ext=1, output_pam='j6me13qhq_wfc2_pam.fits')

For full-frame WFC observations, a second PAM for the WFC1 science array (extension 4) can be created as follows:

pamutils.pam_from_file(flt_file, ext=4, output_pam='j6me13qhq_wfc1_pam.fits')

Apply the Pixel Area Map #


Because the pixel area map is an array of flux corrections based on 2d image distortion, you can multiply it by your data element-by-element to produce the corrected image. Here, we present the results.

plot.triple_pam_plot(flt_file, 'j6me13qhq_wfc2_pam.fits', 'WFC2 PAM Correction Results')
../../../_images/b03779aef3bc054a03039b023501d2f27bfa0110d74da5d2a5d3f12dac4c954c.png
plot.triple_pam_plot(flt_file, 'j6me13qhq_wfc1_pam.fits', 'WFC1 PAM Correction Results')
../../../_images/36c2d7964942bfdb468cb95ccaf3ab9409d70d6699888caa4d0ee640631c6473.png

For more help:#

More details may be found on the ACS website and in the ACS Instrument and Data Handbooks. Geometric Distortion information can be found in Section 5.6.4 and Section 10.4 of the ACS Instrument Handbook.

Please visit the HST Help Desk. Through the help desk portal, you can explore the HST Knowledge Base and request additional help from experts.


Top of Page Space Telescope Logo