Converting to Single-Extension FITS Format


For i' and z' data, it can be helpful to redo the cosmic-ray rejection again at this stage, now that the illumination correction has been applied successfully, and the images are relatively fringe-free. This greatly reduces the RMS used in the calculations by craverage to identify pixels affected by cosmic ray hits. I found that in my 500 second 2007 November z' exposures, iterating the cosmic ray rejection identified 1-2 additional CR hits per 100x100 pixel area, and eliminating them had a measureable effect (5% improvement) in the quality of the final coadd. This modest level of improvement may not be worthwhile given your science goals, but it's worth considering.

Before you can convert the science exposures to single-extension FITS, you have to fix the header parameters so they accurately reflect that the WCS is a ZPN projection and not a TAN projection. In principle you could just type "zpn EGS*.fits" to make that work, however I have found that something about the memory management causes this process to crash after processsing only a few files. To process a large number of files without having to worry about crashes, do the following:

me> ls EGS*.zpcor.fits > run_zpn.macro
me> vi run_zpn.macro # vi commands follow
:1,$ s/E/zpn E/
:1,$ s/fits/fits; flpr
:wq
me> cl < run_zpn.macro

Anyway, the idea is to have a file full of commands like this:

zpn EGS25.2345.zpcor.fits; flpr
zpn EGS25.2346.zpcor.fits; flpr
zpn EGS25.2347.zpcor.fits; flpr
.
.
.

WARNING: If you decide to do any further image manipulation before projecting the images into signle-extension FITS format, you'll have to run the "tan" task first, or IRAF will complain that it doesn't understand the coordinates. Be advised that going back and forth this way, at least as of 2006 June 9, is a bit fraught because the "tan" task doesn't clean up all the image header parameters modified by "zpn", and this can get you into trouble. It's best to delay running zpn until you're sure you're done with the image manipulations.

Next step: run SWARP, to turn the multi-extension FITS files into single-extension FITS. You specify a common tangent-plane projection for your output in a configuration file called, in this example, swarp.f1.default. From the Linux prompt:

swarp [input file list] -c swarp.f1.default

Such a configuration file can be obtained by typing "swarp -d" at the Linux prompt to get a dump of the standard (default) file. IMPORTANT: You will need to set the

FSCALASTRO_TYPE FIXED # "NONE" or "FIXED"

in that file, to compensate for the fact that you have applied an illumination correction already. If you did NOT apply such a correction use "NONE" instead of "FIXED". Also, by trial and error I've found that the following settings are reasonable. They are not perfect in the sense that although they avoid the worst effects of bowl-shaped depressions surrounding bright objects there are still, in the coadds, perceptible variations in the shape of the backgrounds. Subsequent source extraction will have to cope with that.

BACK_SIZE 128 # Background mesh size (pixels)
BACK_FILTERSIZE 3 # Background map filter range (meshes)
BACK_FILTTHRESH 5

Last updated December 3, 2007.