I recently used BasicCCDParameters (v0.3.1) to evaluate my CMOS monochrome camera (QHY163M) and I found suspicious results. I took a look at the source code and I found a portion of the code that is not sound to me. Let's start by saying that the sensor on my camera does black point correction, so the single dark frame method (first part of the <if> instruction - Line 421) does not apply.
In the <else> clause (lines 431-438) there is the following code:
var heat1_noise = Math.sqrt( dark1StdDev[c] * dark1StdDev[c] - bias1StdDev[c] * bias1StdDev[c] );
var heat2_noise = Math.sqrt( dark2StdDev[c] * dark2StdDev[c] - bias1StdDev[c] * bias1StdDev[c] );
// "n" units of additional read noise increase sigma(heat noise) by sqrt(n),
// so too measure the darkCurrent per second:
var sbq = heat2_noise / heat1_noise;
darkCurrent[c] = gain[c] * ( sbq * sbq ) / ( self.dark2ExposureTime - self.dark1ExposureTime );
Let's pretend that heat1_noise and heat2_noise actually represent the dark noise only (this is true as a first approximation only). The variable sbq is calculated as the ratio of dark noise in the two frames, so it's not "n units of additional read noise", whatever that remark means. Instead of sbq^2, the formula should use a value that corresponds to how much the dark signal (= Dark current * exposure time) has increased in dark2 with respect to dark1.
It is also easy to prove that, for negligible values of read noise, the formula for dark current only depends on gain and exposure time, which is clearly wrong.
Finally, let's do a dimensional analysis of the dark current equation. We expect to get a result in electrons per second, however sbq is a unitless number, so sbq^2 is also unitless; sbq^2 is multiplied by gain (e-/ADU) and divided by the dark2ExposureTime - dark1ExposureTime (seconds), so the result is measured in e-/(ADU*s) instead of e-/s.
That's why I'm currently using different methods for the measurement of dark current, which provide completely different results. BTW, I can't find the formula used for the dark current in the referenced HAIP book, let alone a formal demonstration. The other calculations of the script - FWC, gain, dynamic range, etc. - seem to be correct to me.
Can somebody please confirm that this portion of the script is actually flawed or explain to me where my line of reasoning is wrong?
Thanks in advance
Alessio