Making a Bias Image


The mean count levels in bias frames are quite low (a few counts) for Megacam. However, there is also structure clearly present in the bias frames, especially in small regions (such as the portions of the arrays close to the readout leads, i.e., small row numbers). The count levels in these regions can be very significant in the bias frames and if left uncorrected these effects will propagate through to the final coadds. In my opinion it's best to create the best bias frame you possibly can. It takes almost no effort anyway.

Begin by copying the raw data over from the archive into a working directory. The archive is organized into directories that each correspond to a single night of observing, and thus far I've found it very convenient to copy that directory structure for the initial steps of the data reduction at least. Here's an example for June 30, 2005, which reflects the Megacam archive directory structure at the CfA:

cl> mkdir 2005.0630
cl> cd 2005.0630
cl> cp /data/mega1/Archive/rawdata/data/ARCHMEGACAM/2005.0630/zero*.fits .
cl> cp /data/mega1/Archive/rawdata/data/ARCHMEGACAM/2005.0630/commlog.ps .

Load the necessary IRAF software, initialize the parameters to a known state, and carry out the preliminary processing -- consisting of the application of an overscan correction and a trimming. Note that the overscan region chosen depends on the readout mode. If readout was done in such a way that the raw data have only 36 extensions, then one must use ccdproc.biassec="[1060:1090,*]"; otherwise, one uses ccdproc.biassec="[550:580,*]". This item is a hidden argument in the ccdproc command below:

cl> mscred
ms> megacam
me> cl < megacam$ccdproc.par
me> cl < megacam$flatcombine.par
me> ccdproc.biassec="[1060:1090]"
me> ccdproc zero*.fits overscan+ trim+

Important: Ensure there are no bad zero frames in the dataset. Often (but by no means always) the first bias frame taken on a given night is bad (very high counts) and it will corrupt the output if not eliminated. This can be checked by running, say, IRAF/imstat systematically on the same extensions of all the zero frames:

cl> imstat zero*.fits[1] > zero.stats; cat zero.stats
cl> del zero.stats; imstat zero*.fits[36] > zero.stats; cat zero.stats

...repeat as desired on more extensions until you're convinced all the bad bias frames have been found and deleted. Then make the bias frame, and finally check to ensure the counts in the output frame extensions are all close to zero:

me> zerocombine zero*.fits combine="average" output="Zero" reject="sigclip" hsigma=3.0 lsigma=3.0
me> addbpm Zero.fits bpmaskdir = "megacam$Badpix/"
me> mscstat Zero.fits

Note that the name of the bias frame begins with a CAPITAL Z.

Once you're satisfied that the master bias frame is acceptable, clean up by deleting all the now-useless files from your disk:

me> del zero*.fits; del Raw/zero*.fits; del zero.stats

...and now move to the next step: making a twilight flat.

Last updated November 2, 2007.