“This is something new!” – one can say. Well, not really. Both gain and offset settings are common parameters also for CCD cameras. Difference is, that in most CCD cameras they are not adjustable (sometimes they are in some limited range, like in QHY CCD). They are just set by manufacturer at some optimal value for (usually) 16 bit converter.
For CMOS that is another story – we can set both gain and offset in the wide range. Basically gain is the same as ISO setting in consumer camera. When we set gain higher, we amplify more analog signal from sensor before it reaches AD converter. We can benefit then lowering read noise (when scaled to electrons) and improving resolution (till we reach unity gain – see Is dozen of bits good enough? ). But since AD resolution range remains the same, we loose saturation level (pixel depth). That’s the compromise. That’s why for long exposures (like 1-2 minutes or more) we should rather stick to low gain values. For shorter subexposures (like a few s or more – applicable for unguided setups) we can raise gain to reach unity gain or more. Higher gain values are reserved to planetary imaging with exposure times in a range of miliseconds. How would I know what is unity gain in my camera? It is usually stated by manufacturer. For ASI cameras there are also some predefined values in the driver. For QHY163M camera unity gain value is for setting gain=12.
Ok, and what about offset? Offset is the constant signal added to the value read from the pixel. Offset purpose is to raise bias level of signal, so it will eliminate possible fluctuations and there will be no negative values read from the pixel (usually AD converter cannot handle negative values). That also is a hint to proper offset setting – it needs to be set at the value, that gives a bias frame that contains no pixels with values zero or close to zero. So for given gain setting we need to make bias frame (covered camera and as short exposure time as possible) and then check histogram. Histogram should not touch left side of the plot – there should not be pixels with zero value. So for example in QHY163M when we set gain to 0 and offset to 40 we have bias histogram like this:
and that is perfectly ok. Histogram stars at value about 400. But then if we raise gain to 20 and leave offset at 40 we can have bias frame like this:
and that is not good. Histogram starts at zero, and also there is pretty many pixels with this value. We need to raise offset value.
That may seem complicated, but in real life we will not change gain value for every session. We can have two or three predefined gains (like for long exposures, short exposures and planetary exposures) and determine proper offset for them and note this values. We need to do it separately for different binnings if we will use them. Also we need calibration dark and bias frames made separately for each gain and offset combination – they will differ much, so we need them.