Cleaning of images


boxflat.pro

Raw images read out from a CCD has the following features.
   
   Raw image = bias + (dark) + real raw signal + possible fringe + ?

   Bias Level : Offset level used for electronics to be subtracted
      (for most CCD, dark current is assumed to be negligible)

   Real Raw Signal : The scientific data we are after. Not normalize between
      pixel-to-pixel QE fluctuation.

   Gain : Ratio of count/electrons used in CCD readout.

   Fringe : Interference pattern of Night sky spectral line bouncing back and
      forth inside the CCD. (Only for I-band images of Thinned CCD)

   ? : Unexpected junk like light leak or reflection off any surface.

   Data Section : real ccd region to get data
   
   Overscan(or underscan) : extra readout of CCD to get information of bias

   Quantum Efficiency Fluctuation : Not all bins of a ccd are identical.
      Some are more sensitive than others. Also different sections of a
      CCD have different optical effects like dusts.

   Welldepth : Each bin of a CCD can only hold a finite number of electrons.
      This number is usally match to 2^16 through appropriate gain factor.
      (Sometime it is 2^15 by not setting BZERO keyword in the fits header
      or by human error)

The purpose of cleaning is to :
   1 : subtract bias
   2 : normalize out Quantum Efficiency Fluctuation

And for Supernova Cosmology Project, we need to do the extra steps of :
   3 : Possible Fringe subtraction.
   4 : GAIN multiplied
   5 : Subtract Sky Background. Either as a constant or a fitted surface.
      For deep SN images, surface subtraction is recommended and for
      short standard fields, a constant.
   6 : Rotate to our standard orientation of North down, East left.
   7 : Record crucial numbers to the header
      (Sky level, Sky Noise, Welldepth, ...)

1 : Bias subtraction
   Most of the CCD readouts include overscans. Mean(or median) value of
   overscan region will be the bias level to subtract.
   I have not yet seen the need for bias frame since bias are "featureless"

2 : Quantum Efficiency Frame (also called "flatfield")
   One has to generate a flatfield for each filter or find existing one.
   QE frame are generated by selective averaging of many images.
   Images can be domeflats, skyflats, or regular SN images but not
   short exposure standardfields (not enough signal-to-noise).
   I will call this process of averaging "SUPERFLAT"
   For I-band images, mixing domeflats (or skyflats) with regular SN images
   are not recommended since the latter suffer the fringe effect.
   For our software QE frame has to be the cutout of data section only and
   normalized to 10000.
   Use boxflat.pro to make a "SUPERFLAT"

3 : Fringe correction (For I-band data from Thinned CCD)
   Typical way to generate fringe pattern is to make two seperate superflats,
   one from regular images and the other from domeflats.
   Then use makefringe.pro
   IDL> makefringe,'mar997wiynIfringe.fts','mar997wiynIsuper.fts','mar997wiynIdome.fts'
   This divide the regular flat by the domeflat and do a smoothing.
   For our software, fringe pattern has to be normalize for sky background of
   10000 and have mean of (roughly) zero.

Extra : If the domeflat is not similar to regular images in large scales,
   (i.e. center is brighter than the corners or one side is darker than others,)
   One can use domecorrect.pro to correct the domeflat simmilar to regular
   superflat. If boxsize of 200 is to be used :
   IDL> domecorrect,200,'mar997wiynIdome.fts','mar997wiynIsuper.fts'

All the rest are included in boxflat.pro

If there is any problem, let me know.  -Matthew Kim (Feb. 1995)