Process the Calibration Frames

[Initial Reductions (ccdproc)]
[Bias Generation]
[Dark Frame Generation]
[Dome Flat Generation]

Initial Reductions

One of the IRAF tasks that you will use frequently is ccdproc, which is a superscript that calls numerous other IRAF tasks. A possible first step in your data reductions is to use ccdproc to correct for the "cross-talk" between amplifiers. This needs to be done as the first reduction step for ALL images taken with MOSAIC. In this case epar ccdproc and turn off all corrections other than the cross-talk, trim, and over-scan corrections and run it on all of your images. Your parameter file would look like this:

PACKAGE = mscred
   TASK = ccdproc

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

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

(saturat=                INDEF) Saturation (+val=e-, -val=ADU)
(xtalkfi=            !xtalkfil) Crosstalk file
(biassec=             !biassec) Overscan strip image section
(trimsec=             !trimsec) Trim data section
(fixfile=                  BPM) List of bad pixel masks
(zero   =                 Zero) List of zero level calibration images
(dark   =                 Dark) List of dark count calibration images
(flat   =                Flat*) 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)


Alternatively, you can just move ahead and use zerocombine, darkcombine, and flatcombine to process, respectively, your zero, dark, and dflat exposures. Note that you will need to have set the parameters for ccdproc as shown above before running these combine tasks and you will need in each of these tasks to set process=yes.

[Initial Reductions (ccdproc)]
[Bias Generation]
[Dark Frame Generation]
[Dome Flat Generation]

Bias Frame Generation

In order to correct for any spatial variation in the bias structure of each of the MOSAIC CCDs you need to construct a reference bias or Zero frame that will be subtracted from all of your images. I use zerocombine to generate this file and usually name the file as ZeroUTDATE.fits with UTDATE equal to the date of the observations. If the individual zero.fits files have not been processed, zerocombine will automatically call ccdproc to perform the basic processing (correction for cross-talk, trim, overscan) provided you have the parameter process=yes. Below is a copy of the parameter file for zerocombine. The asci file "zero.list" would include a list, one image per line, of the input files. If the directory only contained one set of zero frames (7-11 images for one night) you could replace @zero.list with *.fits or zero*.fits and zerocombine would find the correct images. Note that we have had success using crreject as the rejection algorithm, but you might need to choose a different option for your own data.

 
PACKAGE = mscred
TASK = zerocombine

input   =          @zero.list   List of zero level images to combine
(output =           Zero990327) Output zero level name
(combine=              average) Type of combine operation
(reject =             crreject) Type of rejection
(ccdtype=                 zero) CCD image type to combine
(process=                  yes) Process images before combining?
(delete =                   no) Delete input images after combining?
(scale  =                 none) Image scaling
(statsec=                     ) Image section for computing statistics
(nlow   =                    1) minmax: Number of low pixels to reject
(nhigh  =                    1) minmax: Number of high pixels to reject
(nkeep  =                    1) Minimum to keep (pos) or maximum to reject (neg)
(mclip  =                  yes) Use median in sigma clipping algorithms?
(lsigma =                   3.) Lower sigma clipping factor
(hsigma =                   3.) Upper sigma clipping factor
(rdnoise=              RDNOISE) ccdclip: CCD readout noise (electrons)
(gain   =                 GAIN) ccdclip: CCD gain (electrons/DN)
(snoise =                   0.) ccdclip: Sensitivity noise (fraction)
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(blank  =                   0.) Value if there are no pixels
(mode   =                   ql)

This completes the generation of the bias frame. You should have a file with which to use in further passes of ccdproc on calibration and object frames.

[Initial Reductions (ccdproc)]
[Bias Generation]
[Dark Frame Generation]
[Dome Flat Generation]

Dark Frame Generation

We do not see a significant dark currnet with the science grade CCD's of MOSAIC-1 or MOSAIC-2, but the earlier edition of MOSAIC-1 with its engineering grade CCD's did have a measurable dark current that some researchers might wish to remove. The task darkcombine can be used to produce your Dark.fits frame, which can then be applied to other calibration and object frames.

PACKAGE = mscred
   TASK = darkcombine

input   =                dark*  List of dark images to combine
(output =           Dark980404) Output dark image root name
(combine=              average) Type of combine operation
(reject =               ccdclip) Type of rejection
(ccdtype=                 dark) CCD image type to combine
(process=                  yes) Process images before combining?
(delete =                   no) Delete input images after combining?
(scale  =             exposure) Image scaling
(statsec=                     ) Image section for computing statistics
(nlow   =                    0) minmax: Number of low pixels to reject
(nhigh  =                    1) minmax: Number of high pixels to reject
(nkeep  =                    1) Minimum to keep (pos) or maximum to reject (neg)
(mclip  =                  yes) Use median in sigma clipping algorithms?
(lsigma =                   3.) Lower sigma clipping factor
(hsigma =                   3.) Upper sigma clipping factor
(rdnoise=              rdnoise) ccdclip: CCD readout noise (electrons)
(gain   =                 gain) ccdclip: CCD gain (electrons/DN)
(snoise =                   0.) ccdclip: Sensitivity noise (fraction)
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(blank  =                   0.) Value if there are no pixels
(mode   =                    q)

[Top of Page]
[Initial Reductions (ccdproc)]
[Bias Generation]
[Dark Frame Generation]
[Dome Flat Generation]

Dome Flat Generation

While the MOSAIC CCDs are very sensitive, the are significant pixel to pixel variations in their response and these variation must be corrected using "flat field" exposures. Perfect correction is not possible and what is proper for your program will depend on your science goals. For the NDWFS we are interested in photometric accuracy to about 5 percent and to remove artifacts or image defects that might be misidentified as objects. Most of the objects we are trying to study are at or below the brightness of the night-sky. We therefore use a series of two flats to correct our images. We start with a dome-flat, which is constructed from a series of exposures (one set per filter) taken with the telescope pointed at the white-spot and the flat-field lamps turned on. We usually are working with 7 to 11 "dflat???.fits" images. After the dome-flat has been made using flatcombine, it might have to be further corrected for any pupil-ghost image that might be present. This step is currently only necessary for the KP4m plus MOSAIC-1 and is detailed further below.

Remember that before you construct your dome-flat with flatcombine, you need to update the parameters of ccdproc with the name of your Zero???.fits bias frame. Also note that in the example below there is no input list for ccdproc. This is because flatcombine will automatically pass the correct images on to ccdproc.


PACKAGE = mscred
TASK = ccdproc

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

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

(saturat=                INDEF) Saturation (+val=e-, -val=ADU)
(xtalkfi= mscdb$noao/CCDMosaThin1/xtalk.dat) Crosstalk file
(biassec=             !biassec) Overscan strip image section
(trimsec=             !trimsec) Trim data section
(fixfile=                  BPM) List of bad pixel masks
(zero   =      Zero990327.fits) List of zero level calibration images
(dark   =                 Dark) List of dark count calibration images
(flat   =                Flat*) 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)

Here is an example of flatcombine setup to generate initial R and I-band dome-flats. The input list contains all the R and I-band dflat???.fits images. The output rootname has been specified to indicate the UT date of the observations. The task flatcombine will automatically append the value of the image keyword filter to the end of the combined dome-flat, and the task will properly handle the mixed input filter list, combining only the R-band images to produce Dflat990327R.fits and only the I-band images to produce Dflat990327I.fits.


PACKAGE = mscred
TASK = flatcombine

input   =          dflat*.fits  List of flat field images to combine
(output =          Dflat990327) Output flat field root name
(combine=              average) Type of combine operation
(reject =              ccdclip) Type of rejection
(ccdtype=                 flat) CCD image type to combine
(process=                  yes) Process images before combining?
(subsets=                  yes) Combine images by subset parameter?
(delete =                   no) Delete input images after combining?
(scale  =                 mode) Image scaling
(statsec=                     ) Image section for computing statistics
(nlow   =                    1) minmax: Number of low pixels to reject
(nhigh  =                    1) minmax: Number of high pixels to reject
(nkeep  =                    1) Minimum to keep (pos) or maximum to reject (neg)
(mclip  =                   no) Use median in sigma clipping algorithms?
(lsigma =                   3.) Lower sigma clipping factor
(hsigma =                   3.) Upper sigma clipping factor
(rdnoise=              rdnoise) ccdclip: CCD readout noise (electrons)
(gain   =                 gain) ccdclip: CCD gain (electrons/DN)
(snoise =                   0.) ccdclip: Sensitivity noise (fraction)
(pclip  =                 -0.5) pclip: Percentile clipping parameter
(blank  =                   1.) Value if there are no pixels
(mode   =                   ql)

If You are Reducing KPNO 4m MOSAIC DATA: Both the CTIO and KPNO 4m prime-focus correctors produce pupil ghosts from light that reflects off of the filters, off the back surface of the corrector, and returns through the filters to your science detectors. In the case of the CTIO 4m this added light is diffuse over the entire field and at an unknown, but believed to be small, level. In the case of the KPNO 4m, the reflected light is evident in a frame as an image of the telescope pupil. The amplitude of this "ghost-image" is largest where the Sol-gel coating of the corrector is least effective (in the red and blue). For the NDWFS we correct for the pupil ghost in our I-band and Bw-band images. Most observers are likely to want to make this correction in the U,I, and z bands, as well as most narrow-band filters. We correct our image frames by subtracting off a template pupil image, interactively, using the task rmpupil. The template pupil image is made from an image produced by combining 30 to 40 object frames (of the same filter) and using the task mscpupil. These steps will be detailed further below. However, before the object frames can be combined to produce a high SNR image of the pupil, we must first apply a dome-flat that will not hide the pupil. This means correcting our dome-flats for the pupil-ghost present in the dome-flat. (If we do not make the correction at this point, the pupil-ghost appears to be corrected because it will be divided-out by the dome-flat, but this is not the correct way to fix what is an additive error). To correct the dome-flat we also use the task mscpupil. Note that while fitting the pupil-ghost and removing its effect from our dome-flat we do not want to remove real flat-field variations in the CCDS -- which we need to have the dome-flat correct! In the red the central chips have sensitivity variations near the edges of the CCDs that would be mistakenly fit as part of the pupil-ghost if care is not taken. The fix (for I-band and z-band images, as well as other filters in this wavelength range) is to set the parameter lmedian=yes. For data in the U-band or Bw-band this parameter should be set to no.

Here is a sample parameter file for mscpupil when the task is being used to correct our initial combined I-band dome-flat into an image suitable for use in correcting our object frames.

 
PACKAGE = mscred 
TASK = mscpupil

input   =    Dflat990327I.fits  List of input images
output  = Dflat990327Iwop.fits  List of output images
(masks  =                  BPM) List of masks
(type   =                ratio) Output type
(lmedian=                  yes) Subtract line-by-line median?
(xc     =                  27.) Pattern center offset (pixels)
(yc     =                   9.) Pattern center offset (pixels)
(rin    =                 300.) Radius of inner background ring (pixels)
(drin   =                  20.) Width of inner background ring (pixels)
(rout   =                1500.) Radius of outer background ring (pixels)
(drout  =                  20.) Width of outer background ring (pixels)
(funcin =            chebyshev) Inner azimuthal background fitting function
(orderin=                    2) Inner azimuthal background fitting order
(funcout=              spline3) Outer azimuthal background fitting function
(orderou=                    5) Outer azimuthal background fitting order
(rfuncti=              spline3) Radial profile fitting function
(rorder =                    5) Radial profile fitting order
(abin   =                  45.) Azimuthal bin (deg)
(astep  =                  10.) Azimuthal step (deg)
(niterat=                    3) Number of rejection iterations
(lreject=                   3.) Low rejection rms factor
(hreject=                   3.) High rejection rms factor
(datamin=                INDEF) Minimum good data value
(datamax=                INDEF) Maximum good data value
(verbose=                  yes) Print information?
(fd     =                     )
(mode   =                   ql)
For this example,Dflat990327Iwop.fits would be the image to use for ccdproc on object images.

Now you are ready to do the initial processing on the actual object frames. Please move to III.B..