Initial Processing of Object Frames

After you have constructed your bias frame (Zero???.fits) and corrected dome-flats (Dflat???.fits, "without-pupil-ghost" if necessary), it is time to do the initial processing of the MOSAIC object frames using ccdproc. For those of you experienced with the non-Mosaic version of ccdproc and or the older versions of mscred.ccdproc, the new version is very similar, with a few additional options.

Below is the listing of the parameters for ccdproc set up to do the initial processing of some I-band data taken with the Kitt Peak Mosaic-1 with science grade CCDs (with only 8 amp readout). We will go through the parameters and some of the alternative choices of parameter values in the sub-sections below. In this example we show how ccdproc can be used to do the initial processing of a set of I-band images, the names of which are included in a file, one image per line, named "objects_I.list". Note that you could process all the frames in a directory at once, even if different images will require different flat field frames (i.e. there are data taken with different filters all in the same directory), as long as you are careful in specifying the the calibration and object images properly, ccdproc can use the image headers to match science and calibration files by filter and/or time. We will give an example like this at the end of this section. For now, look at the parameters chosen below and the description of the choices that follows the parameter listing (as it would appear after the command at the cl prompt, epar ccdproc.

 
PACKAGE = mscred 
TASK = ccdproc

images  =      @objects_I.list  List of Mosaic CCD images to process
(output =                     ) List of output processed images
(bpmasks=          @masks.list) List of output bad pixel masks
(ccdtype=               object) CCD image type to process
(noproc =                   no) List processing steps only?

(xtalkco=                  yes) Apply crosstalk correction?
(fixpix =                  yes) Apply bad pixel mask correction?
(oversca=                  yes) Apply overscan strip correction?
(trim   =                  yes) Trim the image?
(zerocor=                  yes) Apply zero level correction?
(darkcor=                   no) Apply dark count correction?
(flatcor=                  yes) Apply flat field correction?
(sflatco=                   no) Apply sky flat field correction?
(split  =                   no) Use split images during processing?
(merge  =                   no) Merge amplifiers from same CCD?

(xtalkfi=            !xtalkfil) Crosstalk file
(fixfile=                  BPM) List of bad pixel masks
(saturat=            !saturate) Saturated pixel threshold
(sgrow  =                    1) Saturated pixel grow radius
(bleed  =               20000.) Bleed pixel threshold
(btrail =                   15) Bleed trail minimum
(bgrow  =                    1) Bleed pixel grow radius
(biassec=             !biassec) Overscan strip image section
(trimsec=             !trimsec) Trim data section
(zero   =      Zero990327.fits) List of zero level calibration images
(dark   =                Dark*) List of dark count calibration images
(flat   = Dflat990327Iwop.fits) List of flat field images
(sflat  =               Sflat*) List of secondary flat field images
(minrepl=                   1.) Minimum flat field value

(interac=                   no) Fit overscan interactively?
(functio=             legendre) Fitting function
(order  =                    1) Number of polynomial terms or spline pieces
(sample =                    *) Sample points to fit
(naverag=                    1) Number of sample points to combine
(niterat=                    1) Number of rejection iterations
(low_rej=                   3.) Low sigma rejection factor
(high_re=                   3.) High sigma rejection factor
(grow   =                   0.) Rejection growing radius
(fd     =                     )
(fd2    =                     )
(mode   =                   ql)

output: Optional New Output Files

Since we do not specify a value for the parameter output, the input files will be modified in place (if the mscred back-up option has been selected, the Raw or intermediate reduction steps might be copied to the chosen directory -- see set-up section of this guide or do help mscred at the cl prompt). Alternatively you could make a file with the desired output names and give this parameter the name of that file as its value.

bpmask: Getting Individualized Bad Pixel Masks

You can now use mscred.ccdproc to create individualized bad pixel masks for each of your images. Into these masks can be placed the location of identified "bad" pixels, including saturated pixels (from bright stars, bleed trails, etc.) or other problem pixels. These masks can inherit the common bad pixel mask provided in the IRAF database, or other mask files, by listing such mask files in the fixfile parameter. Setting fixfile to "BPM" will point to that image header keyword for the name of the additional mask, and by default has been populated with the name of a mask designed to include known bad columns, hot pixels, etc.. These masks should be used only as a starting point. You should add any new defects you identify. In theory you could create individualized masks at a later step in the reduction process -- but we recommend that you generate them during your first pass through the images with ccdproc. This is because it is during this first pass that adding the saturated pixels to the bad pixel masks should be the most straightforward. At this time, before you have corrected the images with a flat field or other calibration product, all of the images taken with a particular CCD share the same saturation value. This is independent of the filter used, etc.. For the NOAO Mosaics we try to have current saturation levels (actually a bit below the saturation values) in the image headers using the keyword SATURATE. If you specify a list of output names (I usually use something like bpm002 for the image obj002), subdirectories will be created with these names, each containing eight bad pixel masks (one for each CCD), named bpm_im*.pl, where *=1-8. As set up in our example, these masks would have the common mask plus all saturated pixels and bleed trails. This use of ccdproc replaces our old home-grown, slow, mkbleed task (see version 6.2 of the notes for description). Note that the parameters that fine tune the behavior of the identification of the saturated pixels and the bleed trails are discussed further below.

Selecting Processing Steps

By setting xtalkco, fixpix, oversca, trim, and zerocor to "yes" we are telling ccdproc to perform the cross-talk correction (necessary for the KPNO and CTIO Mosaic cameras), the bias correction, and to trim the images. Fixpix could be postponed to later stage (and will have to be done again). If you are reducing older data taken with the engineering grade CCDs you might want to include a dark count correction (darkcor=yes). Note that we will apply the dome flat to the images (flatcor=yes), but that sflatco=no, as we have not yet constructed a darksky or twilight flat. Setting xtalkco=yes and specifying a file for cross talk coeeficients (in this case pointing toward the header keyword that has the file name, by setting xtalkfi=!xtalkfil, enables the cross-talk correction to be made. If you measure your own cross-talk coefficients and want to use them instead you could use that file by either editing the individual image headers or, more easily, setting the parameter to the new file (e.g., xtalkfi= /data1/newxtalk.dat ). Similarly, the settings of biassectrimsec above were chosen to point to the image keywords that identify the appropriate regions of each CCD. These could alternatively be specified explictly. Use help ccdproc for further discussion. The parameters zero, dark, flat, and sflat are used to list the images suitable for use in the bias correction, flat fielding, etc.. If you have only one combined dome flat per filter in the directory being processed, you could use a wild card (e.g., Dflat*.fits) and rely on ccdproc to match the correct flat to the image being processed. The task uses the filter keywords to match the flats to the correct images, so if the filter keywords are not correct or populated this option would not work. Note that by setting ccdtype= object you have told ccdproc only to process images of type "object" during this pass.

Flagging Saturated Pixels

NOAO Mosaic images will have a keyword, saturate, in each extention of the MEF file (one for each CCD) that gives the counts in ADU of a saturated pixel. It is advisable that you check the values in your image headers by inspection of your own images. Check several images so that you can examine several saturated stars for each CCD. The tasks implot or mscexamine can be used to plot or check the count level at which the stars are saturating. If you use mscexamin, remember to epar rimexam and turn off the "fit and subtract sky" option. You will want to set the value for the header keyword saturate (in each extention) to a value a bit below what you measure (although the CCDs in Mosaic-1 are quite linear up to saturation, it is conservative to set the value a bit low).

Once you've determined the saturation value for each chip, (take the lowest value at which a star obviously saturates), you can use hedit to change the value of the header keywords for each group extention (CCD) in each MEF header.

For example:


hedit *.fits[1] saturate 34000 verify-
hedit *.fits[2] saturate 25000 verify-
hedit *.fits[3] saturate 37000 verify-
hedit *.fits[4] saturate 26000 verify-
hedit *.fits[5] saturate 31000 verify-
hedit *.fits[6] saturate 26000 verify-
hedit *.fits[7] saturate 25000 verify-
hedit *.fits[8] saturate 24000 verify-
Note that in our example ccdproc, the parameter saturat has been set to !saturate in order to point to the image header keyword that will have the proper saturation level you have just set (or was set at the telescope). When ccdproc is run, all pixels with values above the saturation level(s) will be flagged in the bad pixel masks. The parameter sgrow allows you to enlarge the number of pixels that will be flagged to include pixels within the requested distance (in units of pixels) from a saturated pixel.

Flagging Bleed Trails

The parameters bleed and btrail are used to help identify charge bleed trails associated with strongly saturated pixels, like those found in the cores of bright stellar images. Unfortunately, some of the bleed trails are at ADU levels below the saturation level of the CCD and would be missed with the simple threshold technique used to identify saturated pixels. This is particularly true of the bleed trails on CCD5 of Mosaic-1. To identify these unsaturated, but still corrupted pixels, we make use of the fact that they are generally of significant length along columns. You should check your own data and adjust the btrail parameter to tune the performance of this feature of ccdproc, but we have found btrail= 15 to work well for us. The bleed parameter is analogous to the saturat parameter, but in this case we are using a single value for the entire Mosaic (note there is not currently an image key-word that would correspond, so we pick the lowest value at which bleeds were found in any of the CCDs, counting on the minimum length of contiguous bad pixels cut-off, set by btrail, to avoid flagging valid pixels at the lower count level. bgrow functions in a manner analogous to the sgrow parameter.

After the above ccdproc has completed you can perform a quick check that your images were actually processed through all the steps you wanted by inspecting a few of the image headers and by running ccdlist. This useful task can be used to generate a file recording the current reduction status: msc> ccdlist @object.list > RunCode_Reduction.Status using the parameter file:


PACKAGE = mscred
TASK = ccdlist

images  =        @object.list   CCD images to listed
(ccdtype=                     ) CCD image type to be listed
(extname=                  im1) Extension name pattern
(names  =                   no) List image names only?
(long   =                   no) Long format listing?
(mode   =                   ql)
This output file will be a summary of the reduction status of the images. It provides a convienent place to make notes about the individual images during the data reduction steps. We generally update/annotate this listing to keep track of additional processing steps as we move toward our final combined image stacks.

The next step to consider in your reductions is whether or not to try to improve on the correction provided by your dome-flat. This is covered in section III. C..