I am photographing a scene with white and black elements in it. Starting at the f/22 stop, I widen the aperture one stop and decrease the exposure time by a factor of 2, take a picture, and keep doing this for all the f-stops on the lens. My expectation is that raw counts should stay the same inside a white region or a black region since halving the exposure time compensates for widening the aperture. But when I select a white region and average its pixel raw counts for each image, there is variability between the images (the standard deviation of the raw counts is ~5% of the mean). Same thing if I select and average a black region. I am not knowingly changing anything else (illumination, camera position), and the camera is a scientific CMOS. What could be causing this variation: noise, or something more systematic?
This is normal behavior, caused by:
- Imperfections of aperture. Usually there are variations from technology process which cause not to have exact size of the hole. On 50mm lens f4 you should have 12.5mm opening, but it can be 12.4mm or 12.6mm
- Imperfections in shutter speed. The shutter is also mechanical unit and based on some factors as temperature, how precise are the blades and other elements inside, speed will be not 1/100s but can be 1/110s or 1/90s.
- The same is true about the sensor itself (from electronic point of view)
At the end even two consecutive photos can have different (slightly) exposure.
And add fluctuation of your illumination source...
In theory, yes — stops are interchangeable. In practice, they do not perfectly cancel to complete precision.
the standard deviation of the raw counts is ~5% of the mean
In photographic terms, this is basically nothing. It is far below human perception, and even when the difference is noticeable, the generally-expected workflow involves working with each image individually, so the photographer can compensate either in the field or in post-production.
Cameras meant for photography are not measuring devices; using them as such is setting yourself up for disappointment. Making the devices much more precise would be a lot more expensive and provide no benefit for the target market. Even if you have a camera made for scientific purposes, these particular tolerances might not be within the relevant area of concern.
If you're trying to get perfection for something like a time-lapse or another series of photos, post-processing to even out the fluctuations is your best bet.
The short answer is yes... they cancel. But there are some nuances.
Each time the diameter of a circle increases (or decreases) by a factor equal to the square root of 2 (approximately 1.4) the area of that circle is exactly doubled (or halved if decreased). The f-stop numbers are all based on powers of the square root of 2 (e.g. f/1 = √2^0; f/1.4 = √2^1; f/2 = √2^2; f/2.8 = √2^3; etc.)
Shutter exposures are more intuitive. 1/500th sec is obviously half as long as 1/250th sec, etc.
Cameras do a bit of rounding. E.g. if you have a 100mm lens it's probably not precisely 100mm (but it's probably not far off) and as you refocus, the lens may do a bit of focus breathing (for a good lens that stays with 5% of the stated focal length ... but some lenses have rather strong focus-breathing issues ... e.g. 30%. When this happens, it means the f-stop isn't strictly accurate.
F-stops aren't strictly accurate as it is. But they are "close enough" that the margin of error wont impact the exposure in a noticeable way.
There are other issues. When you shoot heavily stopped down (e.g. f/22), all light comes from a very small area near the center of the lens axis and is distributed across the sensor more evenly. When you shoot wide-open, light comes from a wide range of angles. Areas of the sensor near the center can collect light from many angles, but areas of the sensor near an edge or corner are more limited on the number of paths light can take through the lens to reach that particular spot. This results in vignetting. So while you can take two photos using "equivalent exposures" (trading a stop of aperture for a stop of shutter duration), changes in vignetting patterns can cause pixels to have a different amount of collected light depending on the pixel you choose to inspect.
I think it wasn't mentioned: with increase in exposure time comes increase in thermal Dark Shot noise. You can read more here, for example
With regard to systematic problems: you are taking into account that with opening up the aperture depth of focus decreases and thus the borders of out-of-focus scene parts blur? Also with small apertures you might get some blurring due to diffraction.
If you have a mechanical shutter, you actually can get diffraction with large apertures from the resulting short shutter times when a significant amount of the exposure time is spent near at least one of the shutter curtains moving across.