Gain and binning gain & e-/adu

I find many of the descriptions of gain and offset in this forum and in Cloudy Nights a little confusing. The software configures the hardware so I have analysed the hardware in an attempt to work out from first principles what the settings do for us and how it affects the quality of our image. I apologise for this being long, but there is a lot to describe.

Each time a photon hits the imaging chip there is a chance (the quantum efficiency) it will be captured and generate a free electron that will then become trapped in the insulated gate of the CMOS image cell (pixel). The pixel is one plate of a capacitor that is charging up one electron at a time as the light is received. When the image is read, the voltage on each gate is amplified via the programmable gain amplifier (PGA) that sits between the cell and the digitizer (analog to digital converter). The resulting voltage is converted to a 12 bit digital signal (our ADU’s).

              Image cell (capacitor)  ->  PGA  ->  12 bit Analog to Digital Converter -> the image

The voltage on a capacitor is proportional to the number of electrons and the size of the capacitor plate. In this chip the voltage generated by 20k electrons is the voltage Panasonic calibrated the internal reference voltage so that the digitiser output is a full reading of 4095 (65535 in SGP as it scales it). Since the PGA can be set to any value from 0 to 300 where each value corresponds to a 0.1dB step in the gain, we have 300 different gains available to us that correspond to a scaling of the voltage from 1 to 25.5 (you can set the Gain value to more that 300, but the chip itself is configured so that 300 is the highest value). So, if we are scaling up the voltage by 25.5, then full voltage out of the PGA is achieved with 1/25.5 of the voltage going into it from the image cell. This is the voltage that would be achieved by 20,000/25.5 = 785 electrons (you can see this on the graph published by ZWO). Similarly, a gain of 139 corresponds to a voltage gain of 5.002 and therefore full digital signal is achieved with a well containing 4,000 electrons. If we change the starting point from a nominally advertised 20k electrons to exactly 20,485 electrons it will generate enough voltage to give full signal after the amplifier with 20,485/5.002=4095 electrons. Huh!, this is exactly 1 electron per digital count (ADU) just like they advertise.

If we set the gain to 85 then 8185 electrons are needed to read a full 12-bit signal of 4095. Every second electron makes no change to the signal we read (quantisation error or noise), but we can see a greater range of brightness because we can see from dark to twice as many photons and everything in between. Put another way, the noise has gone up because of the steps in signal and sometimes no step when we have more signal, but the dynamic range is greater because we can collect more electrons before we saturate the digitiser. Low brightness regions will have fewer steps in the brightness, so a stretched image could look banded rather than a smooth graduation in intensity, but the bright stars will look great.

If we set the gain to 215 then 2034 electrons will lead to a full 12-bit signal. This means that every half electron will lead to one more bit increase in the reading. It sounds great, but we can’t have half an electron, so the digitised signal is going to step up two counts each time an extra electron is captured by the sensor. This will show up as increased noise and lower dynamic range. We could have done this by stretching the resulting image.

In summary, any gain greater than 139 will lead you to a risk that the lower dynamic range will limit the quality of your image. A gain of less than 139 will give you higher quantisation noise, but the benefit of higher dynamic range, stars that aren’t blown, but any weak nebulous regions will have fewer steps in brightness available. In my opinion the electronics is geared up so that 139 is the correct setting and the only time it is worth using a different value is when you must have a higher dynamic range for an object without nebulosity, such as with a globular cluster. The Offset is an outcome of the amplifier gain on internal leakage currents that offset the voltage, so we should follow the manufacturers recommended value to do what they have measured is needed.
Please note that this is an analysis of the electronics, not of astrophotography. The electronics is easier.

1 Like

First of all thanks for that break down Generator, it is quite informative and helps me to understand just what is going on when we adjust these numbers. Helps to make sense of it all.

As to the ‘control’ it is my understanding as of right now to choose the ‘ZWO’ camera from the list of cameras and to set the gain and offset for the ‘default’ of 139 / 21.

Then the gain and offset can be controlled within the sequence per event level by clicking the gear icon next to each event. Not in front of the imaging computer right now so I don’t know the full names and specifics but within the ‘gear’ icon there is a dialog box than can be filled in with a gain and offset for each event of the target.

What I don’t fully understand is if the values placed in the per event fields are actually controlling the camera, or are just numbers that can be placed in the file name and the camera actually uses what you set as a default.

I have only had one chance to use this camera since I got it (excluding flats and darks) so I don’t have a full understanding of the ‘mechanics’ of control.

I am not sure 100% but I don’t think you can control gain and offset yet via SGP directly like that. I believe that as I said before you must set those via the driver. I know that the team has been working to support that inside SGP but I have not seen a “yes/no” on it working or not yet.

Gen that’s one of the best hardware breakdowns I’ve read so far. Excellent stuff

rottielover, you can control both gain and offset if you use the native ZWO driver (not ascom driver). As UlteriorModem describes, those settings are found by clicking the gear icon in each event (“Event Settings”).

Excellent. Thank you, I will try this out as soon as the clouds clear again :wink:

I just ran a quick test cause I am bored and it is raining out.

With the camera on the bench I made a brief test sequence with two events, a uni gain and a hi gain.

Using the ZWO driver I set the gain and offset per event, event 1= 139 - 20 event 2= 200 - 60

I can report that indeed the camera gain and offset is indeed controlled via the per event setting. This is good news!

1 Like

Thank you very much Generator, excellent explanation.

Thanks SdA. It was interesting trying to get the information from Panasonic. They seem to have a business model that includes only releasing technical data sheets to manufacturers like ZWO. It was made more difficult by the fact that ZWO ordered the chips with some customisation to suit the use in an astrophotography camera. It also helped that I have had clouds and rain for five weeks straight.

Thank’s for the info .I will have a go.

I’m trying this out tonight. I found the settings, but when I create a new event by clicking the arrow and clicking “copy event 1”, the Gain and Offset settings are not copied over to the new even and I have to set them for each event… ? Or will that just carry over when they are left at “not set”?

I just tried to copy an event, and as you say the gain and offset settings are not carried over. So you definitely need to change those settings manually. Do NOT leave it as “not set”.

I ‘think’ that if it is left as “not set” the camera will use the same gain and offset as the previous event.

I have not actually tried this but that is what I understand.

This is not correct. If the settings are left “not set” then it will use whatever gain and offset are defined in the driver itself.

Oh no. Should I make a thread on the Bug section for this?

Post it in the feature request category. Only devs can post in the bugs category.

Actually, my experience is that it does indeed use the gain last used by an event. I would love to have it behave such that if not set it uses the setting defined in the driver. That way, for instance, I would leave all the RGBL settings unset so it would use the driver settings. Then for NB it could set it.

It really should be a column on the Event line so it is trivial, quick and obvious that it has been set and what its value is.

1 Like

Hmm, if that’s the case then I’m guessing there’s a difference between how this is handled with a QHY163M vs. how ZWO cameras are handled. With my QHY163M if the gain parameter is “not set” it will revert back to the driver setting. But that’s with the QHY ASCOM driver.

So it must be that the ZWO native driver just uses the last settings and not what is configured in the driver settings.

Just ran a quick test on my setup.

First event uni gain
Second event “hi gain”
Third event, not set.

When it got to the third event it reverted to the driver default settings of uni gain (139/21)

1 Like

Same as ulterior here. It reverts to whatever was set at the driver level for me as well. Though for my test I just randomly picked a number of 27 gain since it’s not one of the presets for the driver level.

Side note: anyone willing to share personal experience what has worked for your ZWO camera vs what has not? I’ll go : with my 1600mm-cool I’ve tried so many different things that my brain hurts when I think about it. In general I usually see two methods recommended. A lot of short exposure high gain subs vs a small number of long exposure low gain subs. Each has been argued to death on other forums.

My experience has been this: I tried a series on Bode’s Galaxy of 360 x 10 sec Lum at “lowest read noise” (300 gain) and then again I did 30 subs of 60 sec Lum at Unity Gain (139) [note did not try HDR zero gain]

I processed it all in PixInsight. After image integration I thought the 360 sub version had more artifacts and noise than the 30 sub version and it took a lot longer to process that many subs. I should have kept the data for further testing but I deleted because of how much space that was eating.

I was wondering if others had the same experiences? I have read everything from “don’t use gain zero use 75” to “the camera is unstable under 0.2 sec exposure” (which I fail to see how that can Be the case, as something to try I used it to shoot some planetary video and managed 70-90fps out of it).

Sorry for the digression, I guess I’m just swimming in opinions and I have yet to feel like I have things completely “dialed in”.

1 Like

As per my knowledge SGP is not yet controlling those at the camera level. I had seen some discussion about them going to or trying to support this but as far as I am away you have to control those via the driver software. And if you are using the ASCOM connection you have to control via the driver only.

complete pcb