There are several different approaches to correct image calibration - and some that are incorrect.
It is helpful to understand the purpose of image calibration. We do image calibration to correct 4 primary image aberrations*:
1) Bias noise: When a sensor is read, there will be slight differences in gain for each row or column read and from one part of the sensor to another. This type of noise is "fixed pattern" meaning that it is essentially the same every time the sensor is read. As a result, it can be corrected by subtraction of a suitable calibration frame (bias).
2) Thermal fixed pattern noise: This is what we typically think of as hot/warm pixels. The brightness of these pixels is directly proportional to the exposure time and sensor temperature. Since this is a fixed pattern aberration, it can also be corrected by subtraction of a suitable calibration frame of the same duration and temperature as the light frames (dark).
3) Pixel response non-uniformity (PRNU): This aberration is often ignored when discussing image calibration. PRNU, as the name implies, describes the variation in which individuals vary in response when exposed to the same level of light. This effect is not additive - i.e. it does not increase as exposure increases - so it can be corrected by division by a suitable calibration frame (flat).
4) Vignetting: This is an optical falloff in field illumination that typically results in darkened corners of the image. Since it is also time-independent, it can also be corrected by division by a suitable calibration frame (flat).
It is also helpful to understand which of these aberrations are contained (and thus need to be corrected) in calibration frames.
Bias frames are essentially zero-duration frames. Because they have essentially zero duration and the sensor is not exposed to light, they contain only the bias noise and no thermal fixed pattern noise, PRNU or vignetting.
Dark frames are exposures of the same duration and temperature as the lights. As a result they contain bias noise and thermal fixed pattern noise, but no PRNU or vignetting.
Flats are typically close to zero duration light frames. They contain bias noise and thermal fixed pattern noise as well as PRNU and vignetting. However, as the exposures are typically very short, the amount of thermal fixed pattern noise (which is time-dependent) is usually considered negligible. There is one caveat to that - in some circumstances, flat frames have longer durations. There are typically two reasons for this. The first is due to limitation of the sensor itself. Some CMOS sensors have response characteristics that are different at very short exposures as compared to longer exposures. For this reason, some manufacturers recommend that flats be exposed for a minimum time - typically no less than 0.3 - 1 second. While that does not sound like a long exposure, it is long enough for the thermal fixed pattern noise to begin to manifest. Additionally, taking flats with narrowband filters often requires longer exposures with the same issue of thermal fixed pattern noise accumulation. For this reason, we often take "dark flats", or as I prefer to call them "flat darks".
Flat darks are dark exposures of the same duration as the flats. As a result, they contain bias noise and thermal fixed pattern noise.
Now let's put everything together. The intent is to correct all 4 aberrations in our light frames. Bias and thermal fixed pattern noise are corrected by subtraction and PRNU and vignetting are corrected by division. Here's the catch - we want to correct each aberration only once. Let's start with bias noise. We can correct that two ways. Both bias frames and dark frames contain the bias noise. So subtracting either will subtract the bias noise from the light frame. If we subtract the bias from the light, that takes care of the bias calibration. But that leaves us in a quandary for the thermal fixed pattern noise. We can't just subtract the dark frame, because it also contains the bias noise - which has already been corrected. So, we would need to calibrate the dark frame first by subtracting the bias frame. So the calibration scheme for bias noise and thermal fixed pattern noise would be:
(Light - Bias) - (Dark - Bias)
A simpler approach is to just subtract the dark from the light since the dark contains both the thermal fixed pattern noise and the bias noise:
Light - Dark
So, why not always do this? The reason is that we sometimes want to scale or optimize the darks. The idea is to match the thermal fixed pattern noise as closely as possible, and since the thermal fixed pattern noise scales with time and temperature, we can use darks that don't perfectly match the lights either in duration or acquisition temperature by simply applying a scaling factor to the darks. When we do dark scaling or optimization, though, we don't want to apply the scaling to the bias noise in the dark. That would throw off the bias calibration. So if dark scaling is used, the darks must first be calibrated with bias frames. That, of course, means that the lights must also be calibrated with bias frames since the dark calibration frame will no longer contain the bias noise.
It is worth nothing that things can be a little bit different in CMOS cameras. First, many of them have amp glow that does not behave like thermal fixed pattern noise. As a result, scaling or optimization of the darks can interfere with the amp glow correction. Additionally, as mentioned above, some CMOS cameras behave differently for short exposures versus long exposures. For this reason, the bias noise in a short duration bias frame may not be the same as the bias noise in a long duration dark or light frame. For these reasons, it of often recommended that bias frames not be used for light calibration for CMOS cameras. Instead, the lights should be calibrated with uncalibrated darks. Additionally, if is typically recommended that no dark scaling or optimization be used. So, in summary, calibration of bias noise and thermal fixed pattern noise is accomplished in one of two ways. If dark scaling or optimization is used, lights and darks are both calibrated with bias frames and the lights are then calibrated with the calibrated dark frames.
To correct PRNU and vignetting, we use flats. However, the flats must first be calibrated at least for bias noise and if they are of any significant duration, they must also be calibrated for thermal fixed pattern noise. If the flats are of short duration, they can be calibrated with bias frames, but if they are longer in duration, they should be calibrated with flat darks.
The resulting calibrated flat frame is used to calibrate the light frame by division. First the flat frame is normalized, and then divided into the light frame. In summary, the common approaches to image calibration are:
(Light - Dark)/(Flat - Bias) Used when dark scaling is not used and when flats are very short duration. Also used for most CMOS cameras.
(Light - Dark)/(Flat - Flat Dark) Used when dark scaling is not used and when flats are longer duration. Also used for most CMOS cameras.
[(Light - Bias) - (Dark - Bias)]/(Flat - Bias) Used when dark scaling is used and when flats are very short duration. Not used for most CMOS cameras.
[(Light - Bias) - (Dark - Bias)]/(Flat - Flat Dark) Used when dark scaling is used and when flats are longer duration. Not used for most CMOS cameras.
*For the purists, this discussion ignores Poisson noise. It is present in all light and calibration frames but is not discussed.