#!/usr/bin/env python # coding: utf-8 # # More about flat corrections # ## Overview of taking images for flat corrections # # There are a few ways of taking "flat" images: # # + Twilight flats are images of the sky near zenith taken around sunrise or # sunset. # + Dome flats are images of the inside of the dome (typically of a smooth # surface, not of the dome itself), illuminated by some light source in the dome. # For smaller telescopes an electroluminescent or LED illuminated panel can be # used as the light source. # + Sky flats are composed of several science images. # # Ideally the flat images have fairly high counts (roughly half the maximum counts # of the detector) so that the *only* important source of error is Poisson error # due to the light in the flat images, and so that the signal-to-noise ratio in # those images is essentially zero. # ## Calibrating and combining flat images # # The process of calibrating and combining flat frames is largely the same # regardless of the light source being used. # # It is useful to think of flat frames as just like science images of stars or # galaxies. The telescope is taking a picture of a light source, so bias and dark # need to be removed from the individual images. # # When combining the images there is a new step we have not discussed yet: # normalizing (also called rescaling) the calibrated flat frames to a common mean # or median before combining them. In both sky and twilight flats the illumination # varies naturally from frame-to-frame. If the images are not scaled to a common # value before combining, then the ones taken while the sky is brighter will # inappropriately dominate the result. Dome flats ought to be, in principle, # perfectly stable with no time variation in their illumination. In practice, # every light source varies at some level; if you are trying to correct 1% # differences in illumination, then 1% fluctuations in the light source matter. # # Typically the mean or median is scaled to 1.0 before combining so that when the # science images are divided by the calibrated, combined flats, the science image # values do not change too much.