Basics

Dark, Bias and Flat Frames: Calibrating Astrophotos

An even grey field of fine noise with faint vertical banding, the stretched signal of a dark frame
A dark frame from a Nikon D300, stretched to show the dark signal that calibration subtracts.Image: Rawastrodata, CC BY-SA 3.0

Every image straight off a camera carries more than light from the sky. The sensor adds its own signal, the electronics add an offset, and dust and vignetting in the telescope darken parts of the frame. Calibration removes these with three kinds of reference frames: darks, bias frames and flats. Every astrophotographer who stacks images should know all three, whether the camera is a cooled CMOS astro camera, a DSLR or a planetary camera.

The theory below dates from the CCD era and still holds. The last sections cover what has changed with modern CMOS cameras and software.

Dark frames

Every camera produces some signal even in total darkness. It builds up with exposure time and with temperature (thermal signal, or dark current), and some pixels, the hot pixels, produce much more than others. In a long exposure they show up as bright dots. To remove them you take a dark frame: an exposure of the same length, at the same temperature and settings, with the shutter closed or the telescope capped. The dark frame is subtracted from each image during calibration.

A single dark frame is noisy itself, so you take many and combine them into a master dark. The more frames, the more accurate the master. Noise follows counting statistics: for a signal of 100 electrons the uncertainty is about 10%, for 10,000 electrons about 1%. The Handbook of Astronomical Image Processing gives the "Image-Times-Five" rule of thumb: the total exposure of all your darks should be at least five times that of the image you are calibrating. For a 2-minute image, that is five 2-minute darks or ten 1-minute darks.

Why bias frames make darks scalable

A dark frame contains two things: the thermal signal, which grows with exposure time, and the readout offset and readout noise, which do not. Because of that mix, a dark frame on its own is not scalable: a 2-minute dark only fits 2-minute images. That is a nuisance if you shoot several exposure lengths in one night, since each one needs its own set of darks.

Remove the readout part and what is left is thermal signal only, which does scale with time. So subtract the master bias from each dark frame. The result can be scaled to fit images of other lengths. This is the classic approach, and software still uses it under the name dark scaling or dark optimization.

Bias frames

A bias frame is the shortest exposure the camera can take, in the dark. It contains only the camera's offset (the zero level it adds to every pixel) and readout noise, plus any interference from the electronics. Subtracting a master bias sets every pixel to the same zero point, so later steps such as dividing by the flat work on true signal values.

Flat frames

A flat frame corrects problems in the light path: everything between the front of the telescope and the sensor. Dust on filters or the sensor window, reflections from baffles, poorly aligned optics and vignetting (darker corners) all leave their mark on every image. Flats are essential for accurate photometry and for any image that will be stretched hard.

Shooting flats

The goal is an image of an evenly lit, featureless light source: the "flat field". Finding that light source is the hardest part. Once you have one that works, you can keep using it. Twilight sky, a white screen and a light panel over the front of the telescope are all used; which suits you depends on your location, your skill with tools and your patience.

  1. Expose to about half of the pixels' full well. Siril's documentation advises keeping the histogram peak below about 80% so the flat stays in the linear range.
  2. Take at least 16 flats; fewer adds noise to your calibrated images. For photometry with 0.01 magnitude accuracy, aim for a signal-to-noise ratio of 500:1 or better.
  3. Shoot flats for each filter. Exposure times differ by filter, since each passes a different share of the light.
  4. Take flat darks (also called dark flats): darks with the same exposure time as the flats, not as your images. They are kept separate from the darks for your images.

Every change to the light path calls for new flats. If you take V-filter flats and then swap the V filter for an R, the V flats no longer match. With a good filter wheel each filter returns to the same position, so you can shoot all the flats in one go. Rotating the camera or refocusing far also changes the dust shadows.

Making and applying a master flat

  1. Combine all your flats.
  2. Combine the flat darks.
  3. Subtract the combined flat dark from the combined flat.

The result is your master flat. It stays good as long as nothing in the optical setup changes. To calibrate an image, subtract the dark from it, then divide it by the master flat. Stacking software does all of this automatically once you load the frames.

Diagram of the calibration formula: light frame minus master dark, divided by master flat, equals the calibrated frame. The light frame shows stars on a background that darkens toward the corners, with dust donuts, hot pixels and an orange amp glow in one corner. The master dark is black except for the same hot pixels and amp glow; it removes thermal signal, hot pixels and amp glow. The master flat is bright in the center and darker at the edges, with the same dust donuts; it corrects vignetting and dust donuts. The calibrated frame shows the stars on an even background, ready to stack. Below: the master dark is many darks combined with matching exposure, gain and temperature; the master flat is the combined flats minus flat darks or bias.

Calibration in one line: subtract the master dark, then divide by the master flat.

Calibration with modern CMOS cameras

Set-point cooling and dark libraries

Many deep-sky astro cameras are now cooled CMOS cameras that hold the sensor at a chosen temperature. ZWO, for example, says the ASI2600 cools to more than 35 °C below ambient. A fixed temperature makes a dark library practical: shoot a set of darks once for each combination of exposure, gain and temperature you use, and reuse them for months instead of taking darks every night.

Siril's documentation lists what must match: the darks need the same exposure, gain (or ISO) and temperature as the images, and the offset setting must stay identical between darks and lights and between bias frames and flats. It also points out that calibration removes patterns but does not reduce noise, which is why many calibration frames are better than a few.

Bias, dark flats or a synthetic offset

There are two current approaches to calibrating flats and darks, and the two leading programs lean different ways:

  • PixInsight follows the bias-plus-scaling approach. Its master-frames tutorial asks for at least 10 darks and 10 bias frames, never fewer bias frames than darks, and relies on dark optimization, which rescales the master dark even for temperature-regulated cameras. It says dark flats are not needed.
  • Siril also does automatic dark scaling (since version 1.4), but offers a synthetic bias: instead of a master bias you enter a single offset value. Its tutorial uses this mainly to set the flats' zero level without adding noise, and recommends shooting dark flats if dark current in the flats matters.

Either way works. Pick the method your software's own documentation describes and follow it consistently.

Amp glow

Some sensors show amp glow: a brighter patch, often at an edge or corner, in long exposures. On cameras that have it, a glowing patch in the master dark is normal and not a light leak. Because it repeats in every frame at the same settings, matched darks remove it. Some newer cameras are sold as free of it; ZWO, for example, advertises zero amp glow for the ASI2600.

Hot pixels without darks

When no darks are available, cosmetic correction in Siril and other programs can fix hot and cold pixels from a bad-pixel map. Dithering helps too: moving the mount slightly between exposures puts hot pixels on different parts of the sky in each frame, so stacking with outlier rejection removes them. See drift integration for how dithering works.

Color cameras, DSLRs and smart telescopes

  • One-shot color cameras have a color filter grid on the sensor, which can tint the flats. Siril's CFA equalization option corrects this.
  • DSLRs and mirrorless cameras are not cooled, so their sensor temperature drifts during the night and darks shot later may not match. Many camera users rely on dithering and cosmetic correction instead of, or as well as, darks.
  • Smart telescopes calibrate automatically. Celestron's Origin, for example, takes its own dark-frame library. See how smart telescopes work.

Where to go next

The programs that do calibration and stacking are on the image processing page. Planetary imaging with very short exposures works differently (AutoStakkert! can apply flats); see lucky imaging software. For the overview, start at webcam astronomy basics.

Sources