GTN banner
Goddard Space Flight
													      Center Sonoma State University
													  Education and Public
Image Calibration

Image calibration refers to the process of removing artifacts from your data that are due strictly to the imaging system used, in this case assumed to be a telescope and CCD camera. Calibration must usually be completed before you can perform any science analysis with the images. There are three parts to image calibration:

  1. Obtain the calibration images
  2. Process the calibration images
  3. Apply the calibration corrections to the science images

Each of these steps is described in detail below.

Obtaining Your Calibration Images

You will generally need three different kids of calibration images. These are called flat fields, bias images and dark images, or often just flats, biases and darks for short.

There are additional calibrations that are sometimes needed, but they are generally not required with modern CCD cameras and will not be covered. If you have a cryogenically cooled CCD then you can probably skip the dark correction step. However, such systems require liquid nitrogen for cooling and are typically used only on professional grade telescopes.

Processing Your Calibration Images

You will be creating new images from the raw ones that came off the telescope. Here we describe the steps required to do this and how to keep the different images somewhat organized.

Getting Started

We assume that you have a set of calibration images and science images sitting on your computer in some directory. You might have acquired these images yourself at the telescope, or they might have been made for you. In any case, you will have to get a set of calibration images made at roughly the same time as your science images in order to reduce your data; using calibration images made much much before or much after your science data is not recommended. To begin with, put all your calibration images (flats, biases and darks) into a separate subdirectory called calibration. This is not absolutely necessary, but it helps you keep track of what files are where.

You must first combine your calibration images into a set of master images (master bias, master darks, master flats). You do this for two reasons. The first is that combining images reduces the noise in your data (The noise is inversely proportional to the square root of the total number of counts, and combining images results in more counts). The second reason, as described below, is that combining helps remove cosmic ray hits that might be contaminating some of your images. The master set of calibration images will be applied to your science images. We describe how to produce these images below. Farther down we describe what to do with the master calibration images once you have created them.

Flat Fields

You should have a set of flat fields for each filter used for your science data. As with your other calibration images, the flat fields should ideally have been taken during the same observing session as the science images, though in a pinch you can probably get away with using calibration files from an adjacent night. Dust spots, chip sensitivity and dark counts can change over time, so using the wrong calibration images can actually increase your errors rather than decreasing them. Depending on your project this may or may not matter.

The first thing to do with your flats is to collect them by filter and merge the flats from each filter into a single flat field image file for that filter. For instance, if you have 11 flats in each of BVRI, you should merge your eleven B flats into a single flat field for the B images. Merge the eleven V flats similarly into a single flat for the V images, and so on. Call your merged flat images something meaningful, perhaps Bflat.fits, Vflat.fits, Rflat.fits and Iflat.fits for images in BVR and I, respectively. Exactly how you accomplish this merging depends on what software package you are using. Consult the documentation for your package to learn how to use it to merge your images.

A Note About Combining Images

Many people median combine their images. That means that the images are compared, pixel by pixel, and the median of the pixel values from the images is used for the resulting combined image. Other ways to combine images use the average of the pixel values or simply the sum. You may use whichever method you like, it's just a matter of preference. However, median combining has the advantage that it is insensitive to large outliers from the mean (whereas both the sum and the mean are quite sensitive to large outliers). Therefore, median combining is better able to remove cosmic ray hits. Since cosmic rays can be a large source of noise for long exposures (and occasionally even for short ones), getting rid of them is a good idea.

Cosmic ray hits are easy to spot in your images because they create an area of only one or two pixels where the chip is saturated: astronomical objects will never do this. Fortunately, such features are easy to remove by median combining several images.

Median combining is simpler if you use an odd number of images, so we recommend that you always take an odd number of each type of image (for both your calibration and science images).

When you have created your master flat fields, move them into a directory with your science images. You are ready to move on to your other calibration images.

Bias Images

You should have acquired a set of bias images during your observing run. Note that some people (and software packages) call bias images "zero" images because they are taken for zero seconds and without opening the camera shutter. You must combine these biases (or zeroes) too. Again, using a median combine is recommended to remove outliers. When you have combined your biases into a single image, perhaps naming the result something like "bias.fits" you should move it into the directory where your science images reside.

Note that there are counts in these bias images. Even though the exposure time was zero seconds and the shutter was never open, you still see a non-zero count level. These counts are intrinsic to the chip. They are in all the images you take, including flats, darks and science images. You will use your master bias image to subtract these counts from your other images.

Dark Images

The last type of calibration image you will need is called a dark image. These are made by taking an "exposure" with the shutter left closed. In this case, counts will accumulate due to thermal motions of electrons in the detector even though no light hits the detector. These "dark counts" also accumulate when the shutter is open, so they add a background noise signal to your images. You will use your dark images to remove these thermal counts.

Some people like to have one dark image for each exposure time in their science data, where the dark exposure matches the science exposure. Other people take a set of long darks, combine them into a single master dark, and then scale that to the exposure time needed for each science image during the dark correction step. Again, the "best practice" is a matter of preference. One thing that is not in question is that whatever dark image you use for a given science image, it should be of at least as long an exposure as the science image. You can scale the counts of a long exposure dark image down to match the exposure of a science image, but you should never scale the counts in a dark exposure up. (By scaling we mean that you multiply the dark image counts by the ratio of the exposure time in your science image to the exposure time in the dark image; this ratio should never be greater than one.).

Separate your darks by exposure time... hopefully they have names that make this easy, something like

  • dark_30_001.fits
  • dark_30_002.fits
  • dark_30_003.fits
  • ...
  • dark_60_001.fits
  • dark_60_002.fits
  • dark_60_003.fits
  • ...
  • dark_120_001.fits
  • dark_120_002.fits
  • dark_120_003.fits
  • ...

These would be for darks of length 30, 60 and 120 seconds, respectively. You should combine each of these so that you end up with a single file for each exposure length. Again, median combining is the recommended way to merge them. You then end up with dark30.fits, dark60.fits and dark120.fits. When you have created a dark for each exposure time, move them into the directory with your science images and your other master calibration images. You are ready to calibrate your CCD science images.

Calibrating Your Images

Image calibration consists of removing effects due to variations in pixel sensitivity, bias and dark counts from your images. This process has three steps, outlined below.

  1. Bias Subtraction - The chip bias is an innate background in your chip which shows up in all images. You want to remove this because it artificially elevates the counts in every pixel, whether exposed to light our not. This is what your zero-second dark exposure images are for... your bias images. The bias will vary from chip to chip, and even from night to night. Typically the bias level is around 1500 ADU. Subtract the master bias from each of the other calibration and science images in turn. After the bias is removed, most CCD detectors will require the dark counts to be subtracted. That is the next step.
  2. Dark Subtraction - Unless your camera is cryogenically cooled (typically such cameras sit in a dewar filled with liquid nitrogen) you will have to apply a dark subtraction. From your dark images you can see that even in zero light conditions, counts accumulate over time. This rate of count accumulation varies with time and temperature, and will vary from detector to detector. Usually the accumulation of dark counts is linear with time, though for very long exposures this ceases to be true. Usually you can scale a dark exposure downward (never upward) to match the exposure length of the science image you are correcting: Just multiply the master dark by the ratio of the science image exposure time to the exposure time of the dark. You will have to do this for each exposure time in your science images, making a scaled dark for each. If you are doing these operations manually, or with software you have written yourself, you should copy the dark to a temporary file, and then use that file for the scaling and subtraction. That way you will not lose your master dark file. Astronomical software packages all do this for you, so you will not have to worry about this step if you use one of those. Of course, you can also take a set of dark exposures for each set of science images, matching the exposures of each while at the telescope. In any case, once you have a dark image that matches the exposure of each science image, subtract the darks from the corresponding science images, thus removing the dark count contribution from your science images. Now all that is left are the flat corrections.
  3. Flat Correction - Each pixel in a CCD acts like a nearly independent light detector. As such, the chip can exhibit slight variations in sensitivity from one pixel to the next. This causes brightness variations across the image. In addition, defects or obstructions in the optical path can cause illumination fluctuations on the chip. This is the source of the infamous "dust donuts" seen on uncalibrated CCD images. Flat fielding corrects the image to a "flat" sensitivity... one that does not vary from pixel to pixel. To do this, take your bias and dark subtracted flat fields and compute the mode of the pixel values for each of them (some people prefer to use the median). Divide each flat field by its mode, creating a new normalized flat. Now divide your processed science images by this normalized flat. This procedure will lower artificially high pixels and raise artificially low ones, "correcting" them all to a uniform sensitivity level.

Until you have completed all the steps above you might want to work with copies of your raw science images. That way, if something goes wrong along the way you will have your original files to fall back on. Once you have successfully completed all the calibration steps you can discard your raw images to save space (they are presumably still available somewhere, but you will not need them for subsequent reductions). When you have completed all the calibration steps above, you must (typically) combine your science images... you should take multiple exposures of each target in whatever filters you will use so that cosmic rays can be easily removed, just as was done for your calibration images. If you do not have multiple images of each target you can skip the steps about stacking your science images.

If you have a question about the GTN, please contact one of the "Responsible SSU Personnel" below.

This page was last modified on Friday 01st September 2017 @ 09:15am

Science Mission Directorate Universe Division

Responsible SSU Personnel:

Dr. Kevin McLin (mclin at universe dot sonoma dot edu)

Privacy, Security, Notices