GalSim-developers/GalSim — pull request #357 by msimet (2013-02-12 19:44:19+00:00)
Title: #349

This is a pull request for issue #349, implementing an AddNoiseSNR method for the Image classes. It does essentially what e.g. demo5.py does, adding sky level and CCD noise to get a Great08-like signal to noise ratio. It takes a signal-to-noise ratio and (optionally) sky_level or an RNG as inputs; if sky_level is passed it rescales the flux of the input image, otherwise it figures out a sky_level that gives the appropriate SNR. sky_level must be per pixel.

A couple of issues/questions:

1. There's already a signal_to_noise option for config that does this work--I didn't switch it over to using this method directly, but we could do that if we wanted to only have to change things in one place.

2. I left the demos as-is, even when they do a calculation like this, but could replace them.

3. Unlike other methods that have a possible rng input, this one doesn't have the rng option first (so you could just do Image.addNoiseSNR(20) without having to use a keyword). If this will be confusing, I can easily change the order of the arguments to match those other methods.