GalSim-developers / GalSim

The modular galaxy image simulation toolkit. Documentation:
http://galsim-developers.github.io/GalSim/
Other
228 stars 107 forks source link

Variance for CCDNoise #1318

Closed HenningJ99 closed 1 week ago

HenningJ99 commented 1 week ago

Hi all,

a very minor thing, but is the _get_variance() function of galsim.CCDNoise correct? It is defined as the following:

def _getVariance(self):
        if self.gain > 0.:
            return self.sky_level/self.gain + (self.read_noise / self.gain)**2
        else:
            return self.read_noise**2

Now according to the documentation if the gain is >0, the sky_level should be in ADU per pixel and the read noise in electrons. So it never makes sense to divide both of them by the gain, no? If we want to return the variance in ADU then only the read noise needs to be divided by the gain and if we want to return the variance in electrons then the sky level should actually be multiplied by the gain. Am I missing something here?

HenningJ99 commented 1 week ago

I'll close this, because I found my answer in #712. Sorry about the confusion, I rushed too much with the issue.