Author Topic: DSLR Noise Calculations using PixInsight: Part 2  (Read 1168 times)

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
DSLR Noise Calculations using PixInsight: Part 2
« on: 2018 October 27 14:38:13 »
In my last post there was a lot of discussion regarding whether Signal_to_Noise Ratio could be calculated using ADU counts or if it had to be calculated using e- (electrons). This is especially important for the Canon DSLR camera (and maybe other DSLRs) because Canon subtracts signal from the RAW data before outputting the "RAW" image. The amount subtracted appears to vary with the length of the exposure. This makes it difficult to measure the camera "Gain" expressed as e-/ADU. If the camera "Gain" isn't know, then, it isn't possible to do the noise calculations using electrons.

Although Canon alters the counts it doesn't appear to alter the noise (at least not larger noises). This means that noise measurements are still valid even though the absolute value of the signals isn't trustworthy (because of the variable offset).

In this analysis noise is measured as follows:
  • Using PixelMath subtract two similar images (Bias for example) to create a Difference image. I use the following expression in PixelMath {(Image1 + 0.1) - Image2} to prevent negative values that will be clipped.
  • Measure the statistics of the Difference image using the Statistics process with the range set to the bit level appropriate for you camera (14-bit for the Canon 1100D)
  • The StdDev is the noise measured in ADU units.
  • There is a StdDev value for each of the R/G/B channels.
Using this same technique for measuring noise, two images were taken at several different exposure settings while looking at a uniform (light box) target. The second attached image shows a plot of the noise at each exposure setting (Vertical axis) vs the SQRT[Exposure Time] (Horizontal axis). The result should be a straight line (for each color channel) if the noise is behaving as expected. The straight lines for all three channels shows the desired characteristic.

With this background, the second attached image presents a noise analysis showing that the SNR will be the same whether the calculations are done using e- or ADU.

BAD NEWS USING ONLY ADU: The calculated Read Noise, Dark Current, and, SkyGlow Current values will not be correct.

GOOD NEWS USING ONLY ADU:  The calculated SNR values are valid. This means that the optimum SubFrame exposure can be calculated without knowledge of the e-/adu value for your camera/ISO setting.

I've created an Excel spreadsheet that requires noise measurements from:
  • 2 Bias images
  • 2 Dark images
  • 2 light images (registered to each other)
It also includes the effect of the wasted "Download/Dither time" between images. The third attached image below shows the curve generated by this spreadsheet for my system using an IDAS LPS-V4 filter. It shows that my current SubFrame exposures of 180 sec are achieving only about 87% of the optimum achievable SNR. Of course, star saturation still needs to be taken into account when choosing the exposure.

If anyone is interested in the Excel Spreadsheet just contact me with a PM.

Hope this helps,

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline sharkmelley

  • PTeam Member
  • PixInsight Addict
  • ***
  • Posts: 241
    • Mark Shelley Astrophotography
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #1 on: 2018 October 27 16:24:45 »
I agree with you that if your starting point is a measurement of signal and a measurement of noise then we obtain the same SNR whether those measurements are in electrons or in ADU counts.

But in your previous thread you were calculating SNR from read noise, dark current and rate of sky glow.  Then it does matter whether your read noise, dark current and sky glow rate is in electrons or in ADU counts.

Mark
Takahashi Epsilon 180ED
H-alpha modified Sony A7S
http://www.markshelley.co.uk/Astronomy/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #2 on: 2018 October 27 18:11:16 »
I agree with you that if your starting point is a measurement of signal and a measurement of noise then we obtain the same SNR whether those measurements are in electrons or in ADU counts.

But in your previous thread you were calculating SNR from read noise, dark current and rate of sky glow.  Then it does matter whether your read noise, dark current and sky glow rate is in electrons or in ADU counts.

Mark

Hi Mark - Thanks for continuing to look into this discussion.

This is my last "defense".
  • I loaded two Bias frames into PI, subtracted them using PixelMath, and named the resulting image Diff. Using the Statistics process I measured the StdDev of Diff, multiplied by G (camera Gain, e-/ADU) to convert the noise value to e-, and divided the result by SQRT(2). This yields the Read Noise expressed in e-.
  • I loaded two Dark frames into PI, subtracted them using PixelMath, and named the resulting image Diff. Using the Statistics process I measured the StdDev of Diff, multiplied by G (e-/ADU) to convert the noise value to e-, and divided the result by SQRT(2). I then squared this value, subtracted (Read Noise)^2 = Dark Current in e-/sec.
  • I loaded two Light frames into PI, subtracted them using PixelMath, and named the resulting image Diff. Using the Statistics process I measured the StdDev of Diff, multiplied by G (e-/ADU) to convert the noise value to e-, and divided the result by SQRT(2). I then squared this value, subtracted (Read Noise)^2 and subtracted (Dark Current Noise)^2 = SkyGlow Current in e-/sec.
  • Having Read Noise, Dark Current and SkyGlow Current it is easy to calculate the SNR for any length exposure. By the way, for Signal I just use  t * G where t = SubFrame Exposure Time.
  • No matter what value I use for G, the SNR comes out the same. However, the calculated values of Read noise, Dark Current, and SkyGlow Current change when the value of G is changed.

What do you think? I encourage you to try calculating SNR both ways. I'm open to any proof that this is not the correct way.

All the best,

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #3 on: 2018 October 27 23:19:39 »
OOPS!

Step (2) should read:
2) I loaded two Dark frames into PI, subtracted them using PixelMath, and named the resulting image Diff. Using the Statistics process I measured the StdDev of Diff, multiplied by G (e-/ADU) to convert the noise value to e-, and divided the result by SQRT(2). I then squared this value, subtracted (Read Noise)^2, and divided the result by SUBt (SubFrame Exposure time) = Dark Current in e-/sec.

Step (3) should read:
3) I loaded two Light frames into PI, subtracted them using PixelMath, and named the resulting image Diff. Using the Statistics process I measured the StdDev of Diff, multiplied by G (e-/ADU) to convert the noise value to e-, and divided the result by SQRT(2). I then squared this value, subtracted (Read Noise)^2 and subtracted (Dark Current)*SUBt, and, divided the result by SUBt = SkyGlow Current in e-/sec.

Sorry for the confusion and messy explanation.

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline sharkmelley

  • PTeam Member
  • PixInsight Addict
  • ***
  • Posts: 241
    • Mark Shelley Astrophotography
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #4 on: 2018 October 28 00:49:22 »

The parts of the methodology you have described here are fine.

But in step 4 you say you calculate SNR for any length exposure from Read Noise, Dark Current and SkyGlow current.  How are you doing this?  The formula you used last time needed the figures to be in electrons.

Here's a simple example of a Photon Shot Noise calculation.  Suppose your recorded light level is 10000 electrons.  Then the noise will be the square root of this i.e. 100 and SNR will be 100.

But if those 10000 electrons give you an ADU count of 20000 then its wrong to perform the same steps using ADU.  Taking its square root gives 141 and an incorrect SNR of 70.

Mark
Takahashi Epsilon 180ED
H-alpha modified Sony A7S
http://www.markshelley.co.uk/Astronomy/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #5 on: 2018 October 28 08:36:15 »
Hi Mark - I appreciate your continued involvement in this subject.

My wife has some medical treatments today so I won't be able to respond until later today. I think I'm starting to see our "disconnect".

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #6 on: 2018 October 28 11:31:51 »

The parts of the methodology you have described here are fine.

But in step 4 you say you calculate SNR for any length exposure from Read Noise, Dark Current and SkyGlow current.  How are you doing this?  The formula you used last time needed the figures to be in electrons.

Here's a simple example of a Photon Shot Noise calculation.  Suppose your recorded light level is 10000 electrons.  Then the noise will be the square root of this i.e. 100 and SNR will be 100.

But if those 10000 electrons give you an ADU count of 20000 then its wrong to perform the same steps using ADU.  Taking its square root gives 141 and an incorrect SNR of 70.

Mark

Hi Mark -

I'll use your example as the basis for this discussion.

Suppose the average recorded light level across the array is 10000 electrons and is caused by SkyGlow + Dark Current. 
The Noise will be SQRT(10000) = 100 electrons.
Suppose that the recorded Signal level (measured on one pixel) is 12000 electrons.
The SNR will be 12000/100 = 12 calculated using electrons.

Now calculate SNR using ADU. If the Gain (G) of the sensor is 0.5 electrons/ADU then:
The Signal will be 12000/G = 24000 ADU.
The Noise in ADU will be the noise in electrons/G = 100/G = 200 ADU [not SQRT(24000)].
The SNR = 24000/200 = 12 which is the same as the SNR calculated using electrons.

Hope this makes sense.

Steve

Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline sharkmelley

  • PTeam Member
  • PixInsight Addict
  • ***
  • Posts: 241
    • Mark Shelley Astrophotography
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #7 on: 2018 October 28 15:33:29 »
I agree with you.

However, for the benefit of other readers, a formula like the following is often used to calculate SNR of an exposure:
SNR = S*t/sqrt(S*t + DC*t + SG*t +RN^2)
where
t is the exposure length
S, DC, SG are signal, dark current and sky glow, all in electrons/sec
RN is read noise in electrons

Plugging in some example numbers:
SNR = 1*100/sqrt(1*100 + .1*100 + .2*100 + 5^2) =8.03

If the gain is a factor of 2 and we mistakenly feed in ADU counts instead of electrons we get:
SNR = 2*100/sqrt(2*100 + .2*100 + .4*100 + 10^2) =10.54 which is the incorrect answer

If the gain is a factor of 4 and we mistakenly use ADU counts we get:
SNR = 4*100/sqrt(4*100 + .4*100 + .8*100 + 20^2) =13.19 which is a different incorrect answer

So when using formulae similar to this always make sure you have converted all the input parameters to electrons.

Mark
« Last Edit: 2018 October 28 16:26:23 by sharkmelley »
Takahashi Epsilon 180ED
H-alpha modified Sony A7S
http://www.markshelley.co.uk/Astronomy/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #8 on: 2018 October 28 17:54:11 »
I agree with you.

However, for the benefit of other readers, a formula like the following is often used to calculate SNR of an exposure:
SNR = S*t/sqrt(S*t + DC*t + SG*t +RN^2)
where
t is the exposure length
S, DC, SG are signal, dark current and sky glow, all in electrons/sec
RN is read noise in electrons

Plugging in some example numbers:
SNR = 1*100/sqrt(1*100 + .1*100 + .2*100 + 5^2) =8.03

If the gain is a factor of 2 and we mistakenly feed in ADU counts instead of electrons we get:
SNR = 2*100/sqrt(2*100 + .2*100 + .4*100 + 10^2) =10.54 which is the incorrect answer

If the gain is a factor of 4 and we mistakenly use ADU counts we get:
SNR = 4*100/sqrt(4*100 + .4*100 + .8*100 + 20^2) =13.19 which is a different incorrect answer

So when using formulae similar to this always make sure you have converted all the input parameters to electrons.

Mark

Thanks Mark for following this through to the end. You clearly understand this area very well.

Because of the results of this analysis I'm purchasing an OPT Triad filter to help with the bad LP from my driveway (the only place I get to capture data). Compared to the IDAS LPS-V4 filter I'm using now, this analysis indicates that the improvement in SNR for R/G/B channels with the Triad filter will be 2.46/1.96/1.95 which would be significant because it would make each hour of data with the Triad filter equivalent to almost 4 hours with the LPS-V4 filter!

Unfortunately I'm on a wait list with an anticipated delivery of 2-4 weeks.  Arrrrrrrrrgh! I hate waiting.

Do you post your images somewhere Mark where I might be able to view them? I post on the Astronomy Forum with the screen name STEVE333 if you are interested.

Again, many thanks -

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #9 on: 2018 October 29 15:56:13 »
I agree with you.

However, for the benefit of other readers, a formula like the following is often used to calculate SNR of an exposure:
SNR = S*t/sqrt(S*t + DC*t + SG*t +RN^2)
where
t is the exposure length
S, DC, SG are signal, dark current and sky glow, all in electrons/sec
RN is read noise in electrons

Plugging in some example numbers:
SNR = 1*100/sqrt(1*100 + .1*100 + .2*100 + 5^2) =8.03

If the gain is a factor of 2 and we mistakenly feed in ADU counts instead of electrons we get:
SNR = 2*100/sqrt(2*100 + .2*100 + .4*100 + 10^2) =10.54 which is the incorrect answer

If the gain is a factor of 4 and we mistakenly use ADU counts we get:
SNR = 4*100/sqrt(4*100 + .4*100 + .8*100 + 20^2) =13.19 which is a different incorrect answer

So when using formulae similar to this always make sure you have converted all the input parameters to electrons.

Mark

I completely agree Mark. Really like the SNR equation you use which includes the shot noise in the signal itself.

Even if the DC, SG and RN noises were calculated in ADU space it still wouldn't give the correct answer using ADU counts because of the S*t term in the sqrt argument. Your warning is well founded.

My approach only works because I haven't correctly accounted for the shot noise in the signal itself (not a problem for small signals, but, causes more and more problems as the Signal level increases). My approach would only be correct for Signal fluxes << (DC + SG ). However, fortunately it will work well for determining the correct Sub Frame Exposure.

You have given me a much better understanding of the requirements for correctly calculating the SNR.

I guess even an "old dog" can learn some new tricks. At least, if they have someone as patient as you to teach them.

Cheers -

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #10 on: 2019 January 30 13:35:33 »
This response is just to finish up this post.

I purchased the Triad Tri-Band filter and have taken several images with it. I've been able to capture the Rosette, California, and Jellyfish nebula along with others. The results have been great. The Triad filter has indeed reduced the noise in the captured images. Because of the lower noise I'm able to bring out more details than ever before. The Jellyfish nebula has an apparent magnitude of 12, but, with only 2 1/2 hours of data I was able to produce a very nice image with many details, and, with low background noise. This would not have been possible with my previous filters. This filter has opened up a whole new group of high-magnitude targets that previously were not within my "reach".

These excellent new images that were produced with relatively short total exposures show me that this analysis (performed with the help of PixInsight) definitely pointed me in the right direction.

Thanks to all for your comments/criticisms/suggestions along the way.

Steve
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/

Offline STEVE333

  • PixInsight Addict
  • ***
  • Posts: 231
    • sk-images
Re: DSLR Noise Calculations using PixInsight: Part 2
« Reply #11 on: 2019 January 30 13:51:49 »
This image of the Rosette was taken with the Triad filter, with just over three hours worth of 9 min exposures. I live in a Bortle 5 location where the Milky Way is never visible.

Processing all done with PI.

Hope you like it.
Telescopes:  WO Star71 ii, ES ED102 CF
Camera:  Canon T3 (modified)
Filters:  IDAS LPS-D1, Triad Tri-Band, STC Duo-Narrowband
Mount:  CEM40 EC
Software:  BYEOS, PHD2, PixInsight

http://www.SteveKing.Pictures/