Pixel-Based CTE Correction of ACS/WFC images
IntroductionThe Charge Transfer Efficiency (CTE) of a CCD is its capability to move the charge contained in one of its pixels to an adjacent one without varying the amount of charge. Charge is commonly lost because during transfer operations, defects in the silicon lattice, can remove some amount of charge from the transiting packet and retain it. These charge losses happen multiple times during the journey of the packet from its original location to the serial register.
CTE losses are created during the CCD readout process and it is an issue found in several instruments on board the Hubble Space Telescope, such as the Wide Field and Planetary Camera 2, Wide Field Camera 3 UVIS, Space Telescope Imaging Spectrograph, and the Advanced Camera for Survey's Wide Field Channel (ACS/WFC) and HRC.CTE losses create telltale deferred-charge trails (Figure 1) and can have a significant impact on science: The most obvious manifestation of the CTE problem is that the same target will be brighter if it is located near the readout register, than if it is located at the opposite end of the chip. These losses give rise to errors in aperture photometry and PSF fitting for both point sources and extended sources, and they also blur the profiles of objects shifting their centroids and therefore impacting on astrometric projections. Furthermore, image stacking with moderate to long exposure times is prone to patchy background noise, worsening with distance from the readouts. This arises because cosmic-ray (CR) events are CTE-trailed smoothly into the sky noise. Current CR-rejection logic, such as that in Multidrizzle, can only reject the cores of these CR events, passing the low-level trails through to the final image stack.
Figure 1: A detail of the WFC2 chip of image ja9bw2ykq_flt.fits, a 30 s exposure of the 47 Tuc calibration field. The vertical trails extending upward from the stars are indicative of imperfect CTE.
Much effort, both internal and external to the ACS Team, has gone into mitigating the science impact of ACS/WFC charge transfer inefficiency. Most of the work from the ACS Team on the CTE problem can be found in the ACS Performance CTE website.Such efforts focused upon post-facto corrections for point-source photometry performed on CTE-trailed images (e.g., Chiaberge 2009, ACS ISR 2009-01). More recently, there has been progress in correcting the images by undoing the charge-trailing at the pixel level before any science is undertaken (Massey et al., ACS ISR 2010-01 ; Anderson & Bedin 2010, ACS ISR 2010-03; Massey, 2010, MNRAS, 409, L109). The ACS Team is working on further development of the Anderson & Bedin 2010 code and its incorporation into CALACS. As part of this large effort, we are investigating the time-dependency of the CTE trails, and CTE trails at very low background levels. We are also extensively testing the code for point and extended sources to understand its limitations. We will also study the noise characteristics of the correction algorithm. Currently we have no quantitative assessment or model of the noise. While this work will take some time, we are aware that there is a lot of interest in the user community to access this code. We are therefore releasing a stand-alone beta version of the present code which can be downloaded from this page (see below). This code has been written in Python Programming Language as a PyRAF task and it is due to be released as part of the next STSDAS/STScI_Python release in January 2011.
Installation and warnings
What you need to run the codeThe pixel-based CTE correction task, PixCteCorr, has been written in Python as part of the acstools package within PyRAF. The latest available version of this code can be found here.
Besides the main code, you will also use a reference file that contains the coefficients needed for the pixel-based CTE correction. Download the FITS file pctefile_101109.fits and place it in your working directory.
CaveatsPlease bear in mind the following caveats if you are planning to use this code:
- This code only works for ACS/WFC images obtained in full-frame mode and with GAIN=2. It has not been fully tested with any other image formats.
- Noise is slightly enhanced in the output of the code, and the impact of the noise will depend on what kind of science is being done on the images. If you are also correcting bias striping noise in post-SM4 WFC images, remove the striping before correcting the CTE.
- This code assumes a linear time dependence for a given set of coefficients.
- The relative number of oversubtracted cosmic rays will be greater in short exposures than in long exposures.
Feedback and suggestions
We explicitly request that the community provide us with feedback and input on the performance of the algorithm, its applicability, and any suggestions that might be beneficial. To do this, please send a message to the STScI Help Desk and it will be forwarded to the ACS Team.
TutorialThe present tutorial will guide you in getting your ACS/WFC images corrected for imperfect CTE using the publicly available Anderson & Bedin 2010 algorithm. The task, PixCteCorr, has been written in Python as part of the acstools package. This task should be run under PyRAF.
General example of the procedure to obtain Pixel-Based CTE corrected images
Step 1: Preparing the input image
Case of a fully calibrated FLT image
The input image for the CTE code must be a fully calibrated FLT image in units of electrons. You should retrieve your file(s) from the HST Archive and request file extension FLT for this purpose. Let us assume that we have an FLT file (j12345678_flt.fits) downloaded from the HST Archive. First, open a UNIX terminal and define an environment variable testdir pointing to your working directory. This can be done by editing your $HOME/.setenv file or simply typing
> setenv testdir ~/workdirTo verify that it is pointing in the right direction, use
> echo $testdir ~/workdir/Now you are ready to start PyRAF:
> iraf > pyraf PyRAF 1.9.1.dev (r1290) Copyright (c) 2002 AURA Python 2.5.4 Copyright (c) 2001-2008 Python Software Foundation. Python/CL command line wrapper .help describes executive commands -->Change directory to the working directory where you have your FLT image and the previously downloaded reference file.
--> cd workdir --> ls j12345678_flt.fits pctefile_101109.fitsAdd the keyword PCTEFILE to your FLT image header using task hedit.
--> hedit j12345678_flt.fits PCTEFILE testdir$pctefile_101109.fitswhere testdir has already been defined as the environment variable. To verify that the new keyword PCTEFILE has been added correctly, use
--> imhead j12345678_flt.fits long+the last line should read:
PCTEFILE= 'testdir$pctefile_101109.fits'Now your FLT file is ready to be used as input for the pixel-based CTE correction task, and you may move to Step 2 in this tutorial.
Case of a not fully calibrated FLT imageIf, for some reason, you are not using a fully calibrated FLT image, you will need to comply with the following before running the code.
Convert image to units of electrons for all SCI and ERR extensions. (If unsure of image units,
check BUNIT in those extensions. Conversion using ATODGNA/ATODGNB/ATODGNC/ATODGND values in primary header
For combined images (e.g., superdark), set noise=0
in the CTE correction task.
-- OR execute the PyRAF command--
--> hedit pctefile_101109.fits RN2_NIT X, where X is an integer (0 to 8, inclusive, electrons upper limit for noise mitigation). Primary FITS header (EXT 0) must have these keywords populated:
INSTRUME (must be ACS)
DETECTOR (must be WFC)
CCDAMP (ABCD, AD, BC, A, B, C, or D)
ATODGNA, ATODGNB, ATODGNC, ATODGND
EXTNAME (must be SCI)
EXTVER (1 or 2)
EXTNAME (must be ERR)
EXTVER (1 or 2)
EXTNAME (must be DQ)
EXTVER (1 or 2)
Step 2: Running the task PixCteCorrWithin PyRAF, the task PixCteCorr is located in the acstools package, so we first need to import it:
--> import acstools The following tasks in the acstools package can be run with TEAL: PixCteCorr acs_destripe csc_kill updatenpolThe code is run from the TEAL (Task Editor And Launcher) GUI, by typing
--> epar PixCteCorrThis will open a window that allows the user to modify parameters and run the code. In our case, we will input the name of the file to correct:
inFits = j12345678_flt.fitsYou can also right click on inFits and browse for the input file. If you have several files, the usual wildcards (e.g. @list, j*_flt.fits, etc.) are available in inFits. Bear in mind that if you are using wildcards, you must leave the field outFits blank.
To run the code we click on the Execute button. A short output is written on the screen as the code progresses through the images:
Task PixCteCorr is running... Performing pixel-based CTE correction on j12345678 AMP A , GAIN 2.02 AMP B , GAIN 1.886 AMP C , GAIN 2.017 AMP D , GAIN 2.0109999 ~/workdir/j12345678_cte.fits written Run time: 84.740293026 secsThe default output file name (outFits) is j12345678_cte.fits. This can be changed using the outFits parameter in the TEAL GUI.
Additional help is available: simply click Help on the upper right corner of the TEAL window and select PixCteCorr Help.
Real-World Example:The following example describes the correction of a single ACS/WFC image of the globular cluster NGC104 (Program 11397, PI Mack) which was obtained with the F606W filter. We retrieved the image ja9bw2ykq_flt.fits from the HST Archive. This 30 second observation was performed on July 09, 2009, right after ACS/WFC was repaired. We start by defining the environment variable testdir
> setenv testdir ~/workdirWe work within the Pyraf environment:
> pyrafChange directory to the working directory
--> cd workdir --> ls ja9bw2ykq_flt.fits pctefile_101109.fitsAdd the keyword PCTEFILE to your FLT image header using task hedit.
--> hedit ja9bw2ykq_flt.fits PCTEFILE testdir$pctefile_101109.fitsInvoke the task and edit the parameter inFits with 'ja9bw2ykq_flt.fits'
--> import acstools --> epar PixCteCorrWe click the Execute button and the code starts to run.
Task PixCteCorr is running... Performing pixel-based CTE correction on ja9bw2ykq AMP A , GAIN 2.02 AMP B , GAIN 1.886 AMP C , GAIN 2.017 AMP D , GAIN 2.0109999 ~/workdir/ja9bw2ykq_cte.fits written Run time: 39.2190480232 secsThe corrected image is created in the working directory and it is called 'ja9bw2ykq_cte.fits'. In order to show the effect of the correction, we can compare the original FLT file with the corrected output CTE file. Figure 2 (Left) shows a 300 x 300 pixel region centered on (1550,1550) of the extension 1 chip in image 'ja9bw2ykq_flt.fits' . Figure 2 (Right) shows the same region in the CTE corrected image. These two images are blinked together in Figure 3 (Left). Figure 3 (Right) represents the difference between the original (FLT) and the corrected (CTE) image.
Figure 2: (Left) A 300 x 300 pixel region centered on (1550,1550) of the extension 1 chip in image ja9bw2ykq_flt.fits. The CTE vertical trails are clearly visible. (Right) The reconstructed image after the execution of PixCteCorr.
Figure 3: (Left) An animation of the two images in Figure 2, blinking at a one second interval. (Right) The difference between the reconstructed image and the original, showing the location of the CTE trails.