Space Telescope Science Institute
2010 WFPC2 Data Handbook
Table of Contents Previous Next Index Print

WFPC2 Data Handbook > Chapter 3: WFPC2 Calibration > 3.3 Standard Pipeline Calibration

3.3 Standard Pipeline Calibration
Each calibration step, and the keyword switch used to turn that step on or off, is described in detail in Section 3.3.2. These steps are performed in the following order:
Calculate photometry keywords and update the calibrated science image header accordingly (this does not affect image pixel values).
 Generate the final science data quality file.
Table 3.2 lists the types and related suffixes of the GEIS format WFPC2 reference files used in calwp2. Most suffixes have the form “rNh, rNd” where N is a number that, most of the time, identifies the calibration step order for which the file is used. Its associated data quality file, if it exists, has the suffix bNh, bNd.” The rootname of a reference file is based on the date and time that the file was generated.
Table 3.2: WFPC2 Calibration Reference Files
GEIS Header and Data Files Suffix
or x0m.fits
Bias level reference file, which is actually part of the raw image dataset. It should be in the same format as the other raw data files being processed by calwp2.

The suffix for calibration files are numbered to reflect their steps in the calibration process. However, the WF4 anomaly was discovered fairly late in WFPC2’s operational life; even though the correction is performed as the third step in calwp2 (for data taken on and after March 1, 2002), the suffix is r7h,r7d.

The file names and history of all WFPC2 reference files are listed in the CDBS WFPC2 Reference Files Web page,
Some older, alternative reference files generated by the WFPC2 IDT are listed in the IDT Reference File Memo, at:
These files can be downloaded from the “Non-pipeline Reference Files” table at the CDBS WFPC2 Reference Files Web page.
All reference files contain HISTORY keywords at the end of the header that can be viewed using the imhead task. These HISTORY keywords provide detailed information about how the reference file was generated and when it was installed in the database.
Static Mask Application
Header Switch: MASKCORR
Header Keywords Updated: MASKCORR
Reference File: MASKFILE (r0h, r0d)
The static mask reference file (r0h, r0d) contains a map of the known bad pixels and columns; the mask reference filename is recorded in the MASKFILE header keyword in the science header images (d0m.fits and c0m.fits). If this correction is requested (MASKCORR = PERFORM in the raw image file), the mask is included in the calibration output data quality file (c1m.fits); the science data are not changed in any way. The STSDAS task wfixup can be used to make cosmetic touch-ups on the final calibrated science image (c0m.fits) by interpolating across pixels flagged as bad in the final calibrated data quality file (c1m.fits).
A/D Correction
Header Switch: ATODCORR
Header Keywords Updated: ATODCORR
Reference File: ATODFILE (r1h, r1d)
The analog-to-digital (A/D) converter takes the observed charge in each pixel in the CCD and converts it to a digital number. Two settings, or gains, are used on WFPC2. The first converts a charge of approximately seven electrons to a single count (called a “Data Number” or “DN”), and the second converts a charge of approximately 14 electrons to a DN, also referred to as “gain 15” for historical reasons. The precise gain conversion values for each chip are listed in Table 4.2 in Section 4.4 of the WFPC2 Instrument Handbook.
Depending on the Bay 3 temperature and the gain setting (gain 7 or gain 15), the A/D converter compares the charge detected in each pixel with a reference number that translates the charge (in electrons) to a count value (DN). A/D converters work by comparing the observed charge with a reference and act mathematically as a “floor” function (i.e. rounding down to the next lower integer value). However, these devices are not perfect; some values are reported more (or less) frequently than they would from a theoretically perfect device. Although the “true” DN values can never be recovered, their known systematic errors allow for statistical adjustments to reflect more realistic DN values. Fortunately, the WFPC2 A/D converters are relatively well-behaved and the correction is small (the largest correction is about 1.8 to 2.0 DN for bit 12 [2048]).
The A/D fix-up is applied when the ATODCORR keyword is set to PERFORM in the raw image. The A-to-D calibration file (a lookup table) has four groups, one for each detector. Each group has 4096 columns (i.e., all possible DN values for a 12 bit detector, from 0 to 4095). The first row contains -1 in the first column, followed by Bay 3 temperature values in subsequent columns. The second row contains A/D conversion corrections for each DN value corresponding to the first temperature in row 1. The third row would have A/D conversion corrections for the second temperature in row 1, and so on. On-orbit tests have shown that the conversion values have remained constant in WFPC2; therefore, the A-to-D reference file contains only one temperature and one set of conversion values. The example below illustrates how to get the corrected DN value, in WF2, using the gain 7 A-to-D reference file (dbu1405iu.r1h), for an initial DN count of 450. Note that the corrected DN value in row 2 is found in the DN+1’th column because the correction value in the first column of row 2 is for DN=0.
WF4 Anomaly Correction
Header Switch: WF4TCORR
Header Keywords Updated: WF4TCORR
Group Header Keywords Updated: BIASEVNU, BIASODDU
Reference File: WF4TFILE (r7h, r7d)
Since 2002, a temperature-dependent reduction in the gain has plagued images obtained with the WF4 detector. Characterized by low or zero bias levels, faint horizontal streaks, and low photometry, the WF4 anomaly is thought to be caused by a failing amplifier in the WF4 signal-processing electronics.
The WF4 gain correction performs a number of tasks: first, it uses the contents of the x0m.fits file (overscan columns) to compute the bias levels of the uncorrected WF4 image, storing them in the new header keywords BIASEVNU and BIASODDU. (The computation of those keyword values is identical in method to the calculation of the BIASEVEN and BIASODD values described in the next subsection.) Next, it rescales the counts in each WF4 detector pixel by a correction factor from the WF4 anomaly correction reference file; this correction depends on both the BIASEVNU value and the observed counts in the image pixel. Then, it sets a data-quality flag (2048 or bit number 11) for all pixels in the image with bias values that are so low that they’re unlikely to be properly corrected.
The error contributed to the corrected photometry by the WF4 anomaly correction is 1% to 2%. As this is close to the size of all the other error sources, its effect on the total error is not large. Additional information about how this correction is implemented can be found in WFPC2 ISR 09-03, Pipeline Correction of Images Impacted by the WF4 Anomaly.
Bias Level Removal
Header Switch: BLEVCORR
Header Keywords Updated: BLEVCORR
Group Header Keywords Updated: DEZERO, BIASEVEN, BIASODD
(x0m.fits and q1m.fits,
which are part of the raw image dataset)
The charge in each pixel sits on an electronic pedestal, or “bias” which keeps the A/D levels consistently above zero. The mean level of the bias, or “global” bias, is determined empirically using the extended register (overscan) pixels which are not exposed to the sky. The values of these pixels are placed in the extracted engineering files (x0m.fits). For each group, a [9:14,10:790] subsection of the overscan image is used to calculate the mean bias levels; BIASODD is determined from columns 10, 12, and 14, and BIASEVEN from columns 9, 11, and 13. This counter-intuitive nomenclature is due to an offset in the x0m.fits file.
For images affected by the WF4 anomaly, the bias subtraction routine is modified as follows: if WF4TCORR = PERFORM, the WF4 gain correction, as computed in the previous subsection, is applied to the contents of the x0m.fits file. This modified overscan image is then used to compute the values for BIASEVEN and BIASODD, which are written to the image header.
If the BLEVCORR keyword is set to PERFORM in the raw image header, the BIASODD keyword value is subtracted from odd-numbered columns in the science image, and the BIASEVEN value is subtracted from the even columns.
Note: for PC1, WF2, and WF3, the BIASEVEN and BIASODD values are, as expected, identical to the BIASEVNU and BIASODDU values, respectively.
Bias Image Subtraction
Header Switch: BIASCORR
Header Keywords Updated: BIASCORR
Reference File: BIASFILE, BIASDFIL (r2h, r2d and b2h, b2d)
The value of the bias pedestal varies slightly with position across the CCD. After the mean bias level correction has been applied, the pipeline checks the keyword BIASCORR in the raw image. If it is set to PERFORM, then a bias image reference file is subtracted from the data to remove any position-dependent bias patterns.
The bias image reference file is generated by stacking a large set of good quality individual bias images (zero-length exposures) that were calibrated for A-to-D conversion and global bias removal. Bad pixels flagged in the bias reference image data quality file (b2h, b2d) are also flagged in the science image data quality file (c1m.fits).
Dark Image Subtraction
Header Switch: DARKCORR
Header Keywords Updated: DARKCORR
Reference File: DARKFILE, DARKDFIL (r3h, r3d and b3h, b3d)
There are two primary sources of dark current; a dominant component is strongly correlated with cosmic ray flux in the image, probably due to scintillation in the MgF2 CCD windows. There is also a smaller thermal dark current in the CCD itself. The dark reference file, used to remove the effects of dark current, is generated from two components: a superdark image (created from a stack of typically 120 good quality dark frames taken over one to two years1) and warm pixels identified from a smaller stack of individual dark frames, typically five individual darks taken during the week of the observation.
If a dark correction is requested (DARKCORR = PERFORM in the raw science image), the dark reference file, which was normalized to one second, is scaled by the image’s DARKTIME keyword value, and then subtracted from the observation. By default, DARKCORR is set to PERFORM for all exposures longer than 10 seconds, and set to OMIT for exposures less than 10 seconds (due to noise considerations).
Flat Field Multiplication
Header Switch: FLATCORR
Header Keywords Updated: FLATCORR
Reference File: FLATFILE, FLATDFIL (r4h, r4d and b4h, b4d)
The number of electrons generated in a pixel due to a star of a given magnitude depends upon the quantum efficiency of that individual pixel as well as any large scale vignetting of the field of view caused by the telescope and camera optics. To correct for these variations, the science image is multiplied by an inverse flat field file. WFPC2 flat fields are generated from a combination of on-orbit data (so-called “Earthflats” which are images of the bright Earth) and pre-launch ground data. The on-orbit data allow a determination of the large-scale illumination pattern while the pre-launch data are used to determine the pixel-to-pixel response function. The application of the flat field file is controlled by the keyword FLATCORR.
Shutter Shading Correction
Header Switch: SHADCORR
Header Keywords Updated: SHADCORR
Reference File: SHADFILE (r5h, r5d)
The finite velocity of the shutter produces uneven illumination across the field of view (thus the term “shutter shading”), resulting in a position-dependent exposure time. The shutter shading calibration is applied by default to all exposures less than ten seconds. It has the form of an additive correction, scaled to the appropriate exposure time, that varies spatially across the detectors. The keyword switch is SHADCORR, and the shutter shading file name is stored in the keyword, SHADFILE.
Creation of Photometry Keywords
Header Switch: DOPHOTOM
Header Keywords Updated: DOPHOTOM, PHOTTAB
Group Header Keywords Updated: PHOTMODE, PHOTFLAM,
Reference File: GRAPHTAB, COMPTAB (tmg.fits, tmc.fits)
Photometry keywords, which provide the conversion from calibrated counts (DN) to an astronomical magnitude, are computed by calwp2 using the STSDAS package synphot. (More information on SYNPHOT can be found in the Synphot User’s Guide) at:
The keyword switch for this step is DOPHOTOM, and the reference file keywords are GRAPHTAB and COMPTAB. Note that the science data (c0m.fits) pixel values are not changed as a result of performing the DOPHOTOM step; the data remain in units of DN (Data Number); calwp2 only computes the photometric parameters and populates the appropriate header keywords.
The photometric keywords that are computed are listed in Figure 3.3 below; the first two, DOPHOTOM and PHOTTAB, are global keywords in the raw and calibrated image headers (d0m.fits and c0m.fits). The last six keywords, PHOTMODE, PHOTFLAM, PHOTZPT, PHOTPLAM, PHOTBW, and ZP_CORR are group header keywords that are only populated in calibrated image headers. (Use the IRAF tasks imheader, hselect, or hedit to view group keywords.) PHOTZPT is not the photometric zeropoint (in the ST magnitude system) as normally understood, but rather the zeropoint in the ST magnitude system to be used after conversion to FLAM units (see Section 5.1).
Figure 3.3: Photometry keyword descriptions, taken from ub080101m_c0m.fits[1]
calwp2 constructs the PHOTMODE keyword value using the INSTRUMENT, DETECTOR, ATODGAIN, FILTNAM1, FILTNAM2, EXPSTART,and LRFWAVE header keyword values. A throughput table for that observing mode, as expressed by the PHOTMODE keyword value, is generated using individual SYNPHOT throughput tables for the instrument optics, detector, gain, time-dependent throughput changes, and filters. The mapping of the observation parameters to their respective SYNPHOT throughput files is done using throughput reference look-up tables specified by the GRAPHTAB and COMPTAB header keywords. calwp2 writes the total throughput for the observing mode to a table with extension c3m.fits, then uses that throughput table to calculate values for calibrated image header photometric keywords such as PHOTFLAM and PHOTZPT.
The individual SYNPHOT throughput files used to determine total throughput for an observing mode (as specified by PHOTMODE) can be obtained using the STSDAS showfiles task in the synphot package. Information about this and other tasks in the synphot package can be found in the Synphot Users Guide, at:
The most recent SYNPHOT tables can be downloaded from CDBS, at
What are the observing parameters for WF2 in calibrated dataset ua3f0603m?
-->hsel ua3f0603m_c0m.fits[2] $I,instrume,detector,atodgain,filtnam1,filtnam2 yes
What are the photometry keyword values for WF3 in calibrated image ua3f0603m?
-->hsel ua3f0603m_c0m.fits[3] $I,photmode,photflam,photplam,photbw,photzpt,zp_corr yes
Histogram Creation
Header Switch: DOHISTOS
Header Keywords Updated: DOHISTOS
Reference File: none
Note: this step is not performed in the standard pipeline, but users
may use this feature during recalibration of their data.
This step will create a multigroup image (c2h, c2d) with one group for each chip in the calibrated dataset. Each group contains a three-line image where the first row is a histogram of the raw data values, the second row is a histogram of the A/D corrected data, and the third row is a histogram of the final calibrated science data. This operation is controlled by setting the keyword DOHISTOS to PERFORM in the raw image; the default is to skip this step. Note: If you really need this histogram image, you have to recalibrate your data with GEIS raw science images because calwp2 does not work for the setting DOHISTOS=PERFORM with MEF raw science images.
Data Quality File Creation
By performing a “bitwise logical OR,” the calwp2 software combines the raw data quality file (q0m.fits) with the static pixel mask (r0h, r0d) and the data quality files for bias, dark, and flat field reference files (b2h, b2d; b3h, b3d; b4h, b4d) in order to generate the calibrated science data quality file (c1m.fits). This step is always performed, even when calibration switch keywords are set to OMIT. A c1m.fits file would still be generated, though it would not contain much useful information. The flag values used are defined in Table 3.3. By convention, DQF pixel values of zero (0) are designated as good pixels. The final calibrated data quality file (c1m.fits) may be examined, for example, using FITS image display software such as SAOimage and ximtool, and can be blinked with the calibrated science image to directly identify areas of bad and questionable pixels on the science image.
Table 3.3: Data Quality File Flags
Calibration file defect—set if the pixel is flagged in any of the reference data quality files. This includes charge transfer traps identified in the static pixel mask file (r0h,r0d).

Calibrated saturated pixels may have values significantly lower than 4095 due to bias subtraction and flat-fielding. In general, data values above 3500 DN are likely saturated.

There are history records at the bottom of calibrated image headers. For MEF files, the HISTORY keyword can be read using the STSDAS task imheader on the group zero header (i.e., c0m.fits[0]) where all global keywords are stored. For GEIS-calibrated images, the HISTORY keywords can be read by paging though the ASCII header file (.c0h) or using imheader with any of the groups (i.e., .c0h[3]). HISTORY records are also available in the GEIS calibration reference file headers; these history comments contain important information about the reference files used to calibrate the data.
Example of how to view the HISTORY values for calibrated image ua3f0603m.

A dark frame is a long exposure taken with the shutter closed; each individual dark has the standard calibration corrections applied (ATODCORR, BLEVCORR, and BIASCORR).

Table of Contents Previous Next Index Print