Calibration Frames: Darks / Flats / Bias
A single deep-sky exposure (a light frame) records not only photons from the target, but also a number of systematic error signals generated by the camera itself: dark current that the sensor continuously accumulates at its operating temperature, fixed bright points on individual pixels (hot pixels), a fixed offset level added by the readout circuitry on every pixel, and — from the optical path — vignetting, dark spots cast by dust, and pixel-to-pixel sensitivity differences. Calibration frames are images shot specifically under controlled conditions to measure these systematic errors. By subtracting or dividing the calibration frames out of the light frames according to specific mathematical relationships, the fixed-pattern interference can be removed before stacking, raising the overall signal-to-noise ratio (see Signal-to-Noise Ratio).
The core premise of calibration frames is that what they measure must be a repeatable, fixed-pattern error. Random noise (such as photon shot noise and the random component of read noise) cannot be subtracted out; it can only be suppressed by increasing the number of light frames and stacking.
Overview of the Four Calibration-Frame Types
Section titled “Overview of the Four Calibration-Frame Types”| Calibration frame | Errors corrected | Shooting conditions | Recommended count |
|---|---|---|---|
| Dark | Dark current, fixed component of thermal noise, hot pixels / dead pixels | Total darkness (lens cap on / light blocked); temperature, gain, and exposure time all matched to the lights | 20–50 frames |
| Flat | Vignetting, dust dark spots, pixel sensitivity differences, optical-path non-uniformity | Shot against a uniform light source; focus / filter / camera angle matched to the lights; histogram peak at roughly 1/3–1/2 of full well | 25–50 frames |
| Bias | Read offset level, fixed read pattern | Total darkness, shortest exposure the camera supports, gain matched to the lights | 50–100 frames |
| Dark-flat | Read offset and dark current at the flat’s exposure time | Total darkness, exposure time = flat exposure, gain matched to the lights | 20–40 frames |
Detailed Look at Each Calibration-Frame Type
Section titled “Detailed Look at Each Calibration-Frame Type”Dark frame
Section titled “Dark frame”Once a sensor is powered, it heats up, and thermal excitation in the semiconductor causes every pixel to continuously accumulate dark current — the “signal output by the detector when no light is present.” Dark current grows roughly exponentially as temperature rises (a typical rule of thumb: it doubles for every ~6–8 °C increase in temperature) and appears on certain defective pixels as fixed bright points (hot pixels).
A dark frame is an image shot under complete darkness with the same exposure parameters as the lights, used to record dark current and hot pixels — fixed signals that depend only on temperature, gain, and exposure time.
- Three-way match — temperature, gain (gain / ISO), and exposure time must match the lights. The amount of dark current accumulated is proportional to exposure time and strongly dependent on temperature; a mismatch in any one of these leads to over- or under-subtraction. Cooled cameras should be locked to the same sensor temperature as the lights; uncooled DSLR / mirrorless cameras should be shot during periods with similar ambient temperatures as far as possible.
- Block light thoroughly: beyond the lens cap, leak paths such as the eyepiece end and the viewfinder must also be blocked to avoid stray-light contamination of the darks.
- Some CMOS cameras exhibit amp glow — fixed bright regions in the corners of the frame caused by heat from the readout amplifier. This is a fixed pattern and can be correctly subtracted by darks shot under the same conditions.
- A count of 20–50 frames is a common range; the more frames, the smoother the master dark and the less additional noise introduced during subtraction.
Flat frame
Section titled “Flat frame”Flats correct the multiplicative non-uniformity of the optical path and sensor — the phenomenon where uniform light of the same intensity produces different output on different pixels. The main sources include:
- Vignetting: the edges of the frame appear darker than the center, caused by aperture vignetting in the optical system.
- Dust dark spots: ring-shaped or point-like dark shadows cast onto the imaging plane by dust particles on the sensor cover glass or filter surfaces (commonly called “dust donuts”).
- Pixel-to-pixel sensitivity variation: the inherent difference in how adjacent pixels respond to the same amount of light.
- Keep the focus, filter, camera angle, and position relative to the lens exactly the same as when shooting the target. Once the dust positions or vignetting pattern change, the old flats become invalid.
- Aim at a uniform light source: a flat panel (LED light panel), a white cloth over the lens aperture against the dawn/dusk sky (sky flats), or a diffused screen.
- Adjust the exposure so the histogram peak falls at roughly 1/3–1/2 of full well (full well being the upper limit of the sensor’s linear range, corresponding to about 25,000–33,000 ADU for 16-bit data), ensuring it sits in the sensor’s linear response region — neither overexposed nor too dark.
- Flat exposures should not be too short (a few hundred milliseconds or more is recommended) to avoid uneven mechanical-shutter shading or readout banding; shoot 25–50 frames and take the mean.
Bias and Dark-Flats
Section titled “Bias and Dark-Flats”Even when the exposure time approaches zero and there is no light at all, the readout circuitry still adds a fixed offset / bias level to every pixel, along with a fixed read-pattern noise. This baseline must be subtracted from the darks and flats beforehand; otherwise it breaks the linear relationship of the subsequent division.
- Bias frame: shot at the shortest exposure the camera supports, in total darkness and at the same gain, recording only the read offset with virtually no dark current. A larger number of frames is needed (50–100), because a single bias frame’s own random read noise is relatively large and must be averaged down.
- Dark-flat: shot in total darkness with the exposure time set equal to the flat exposure; it serves the same purpose as bias but is better matched to the flat-processing workflow, and additionally covers the small amount of dark current accumulated over the flat’s exposure time.
Master-Frame Integration
Section titled “Master-Frame Integration”A single calibration frame carries random noise of its own, and using a single frame directly to calibrate the lights would instead introduce that frame’s noise into the result. The correct approach is to integrate calibration frames of the same type into one low-noise master frame: a master dark, master flat, and master bias / master dark-flat.
- Integration algorithm: the average is commonly used to maximize noise reduction, or the median together with kappa-sigma / sigma-clipping (rejecting outliers that deviate from the mean by several standard deviations) to simultaneously suppress outlier pixels from cosmic-ray hits, satellite/aircraft trails, and the like.
- Integrating N frames reduces the calibration frame’s own random noise by about √N, which is why frame counts matter for every type of calibration frame.
- Bias/dark-flat counts are usually larger than those for darks and flats, because a single frame’s read noise is large relative to the faint baseline it is meant to measure, so more frames are needed to average it down.
Calibration Mathematics
Section titled “Calibration Mathematics”The standard calibration (including flat normalization) performs, per pixel, the following operation on each light frame:
C = (R − D) / (F − Df) × mean(F − Df)The meaning of each term:
| Symbol | Meaning |
|---|---|
C | The calibrated light frame (corrected) |
R | The raw light frame (raw light) |
D | The master dark (already including the read offset) |
F | The master flat |
Df | The master dark-flat or master bias (the flat’s baseline) |
mean(F − Df) | The full-frame mean of the baseline-subtracted flat, used as the normalization scalar |
This formula can be understood as follows:
R − Dperforms the subtraction first, removing the dark current, hot pixels, and read offset from the light frame to obtain a clean additive signal.F − Dflikewise removes the flat’s baseline, yielding a gain map that reflects only the optical-path transmittance and pixel gain.- Dividing
R − DbyF − Dfflattens out the multiplicative non-uniformities such as vignetting, dust spots, and sensitivity differences; multiplying bymean(F − Df)then renormalizes the overall brightness back to the original magnitude (otherwise the whole image would be scaled).
In practice, the master dark usually already includes the bias (the darks themselves contain the read offset when shot), so the light side only needs the master dark subtracted, while the flat side has the bias or dark-flat subtracted separately. The equivalent step-by-step form is:
- Subtract the master dark: remove dark current, hot pixels, and read offset (additive errors).
- Divide by the baseline-subtracted master flat: flatten vignetting, dust spots, and pixel sensitivity differences (multiplicative errors).
Where It Fits in the Stacking Workflow
Section titled “Where It Fits in the Stacking Workflow”Calibration happens before stacking. Software such as Siril, PixInsight, and DeepSkyStacker (DSS) first integrates calibration frames of the same type into master frames, then performs dark subtraction and flat division on each light frame in turn, and only then proceeds to alignment and stacking:
- Integrate the master dark, master flat, and master bias/master dark-flat separately.
- Calibrate the master flat with the master bias/master dark-flat (
F − Df). - Perform
(R − D) / (F − Df) × mean(F − Df)on each light frame. - The calibrated light frames then undergo registration alignment and stacking.
For the full stacking steps and software operations, see Stacking.
References
Section titled “References”- The Ultimate Guide to Calibration Frames for Astrophotography — Celestron — An overview of the definitions, shooting conditions, and processing workflow for the four types of calibration frames.
- A Brief Guide to Calibration Frames — Practical Astrophotography — Shooting counts and temperature-matching requirements for bias/darks/flats/dark-flats.
- Flat-field correction — Wikipedia — The flat-field correction formula
C = (R−D)·m/(F−D), the gain map, and definitions of dark current, vignetting, and pixel sensitivity differences. - Guide to Calibration Frames — NightSkyPix — The target of a 1/3–1/2 full-well flat histogram, frame counts for each type, and dark-library reuse recommendations.
- Dark-frame subtraction — Wikipedia — The principles of dark current, thermal noise, and dark-frame subtraction.