DP0 Zeropoints: Adding Poisson Noise

I am currently trying to inject simulated strong lens images into DP0 images (similar to this post). Due to the volume of images I will need to make (they will be used to train a CNN), I intend to inject these into the coadd images, rather than injecting into the single exposures and then restacking. I am currently trying to estimate the correct poisson noise that I should include in my injected simulations. To do this I have been looking into the zeropoints of the DP0 images.
Using the getPhotoCalib().instFluxToMagnitude(1) method on the DP0 coadds and single exposures, it appears the single exposures have a zeropoint (in the i-band) of ~31.8, and the coadds have a zeropoint of 27. According to this documentation, the zeropoint of the i-band detector is 27.85 (with gain=1). Converting this to gain=2.3 would give a zeropoint 27.85+2.5log(2.3)=28.75. My questions are:

  1. Which of these zeropoints should I use to estimate the (poisson) noise?
  2. If I can use the 28.75 value from the detector, can I simply then scale the noise to the coadd ZP of 27?
  3. What is the physical meaning of the DP0 zeropoint values of 31.8 and 27 (assuming they are not the magnitudes which will produce 1 count/s)?

Hi Phil, thanks for this question.

This doesn’t answer your zeropoint questions but: a source injection package was recently added to the LSST Science Pipelines. A DP0 tutorial demonstrating its use is currently in development, but not ready yet. In the meantime, here is the documentation for the new source injection package (I appreciate that this is not yet discoverable from the main landing page at pipelines.lsst.io). There’s a CoaddInjectTask that looks relevant to your goal, but at first glance I don’t immediately see what kind of noise is added during the injection process. I’ll bring this topic to the attention of the Rubin source injection (and photometric calibration) experts.

Melissa is correct that the CoaddInjectTask is the correct tool for the job here.

Currently the source_injection package does not add noise when injecting sources. I’ve created a pull request to fix this. It estimates the needed noise by comparing, pixel by pixel, the original variance plane to the original image. Broadly speaking, the amount of variance needed in each pixel is a simple straight-line function of the amount of image light, as you would expect from Poisson statistics. This is most straightforwardly true in calexps.

Coadds have some interesting deviations from this trend in the bright inner cores of galaxies, that I currently don’t have a solid understanding of. But for the most part a straight-line fit between brightness and variance still works for most pixels, as long as you reject outliers appropriately.

This is what the code in the PR tries to do. It’s currently in the middle of code review and I’ve got some homework to do on that before it becomes an official part of the Pipelines, but you can take a look at it now if you’re interested.

1 Like

Hi @jjbuchanan , we have done this in SLSim (strong lensing simulation pipeline) by constructing an exposure map of a coadd image. Once we have an exposure map, we can draw an image from the poisson distribution with coadd image mean photon count. For this we have used zeropoint = 27 for all coadd images.

Can you link me the code for that @nkhadka ?

Thank you very much all for your help and suggestions! I will take a look at the CoaddInjectTask tool. I am also using the SLSim package (here) developed by @nkhadka and others. Following your method @jjbuchanan I will verify that scaling the variance map from DP0 from the single exposure ZP of ~31.8 to the coadd ZP of 27 produces similar noise maps to currently implemented in SLSim. I wasn’t sure that I could do this previously but I have just found the variance maps in DP0 so this should be possible. Thanks for all your help!

1 Like

Hi @jjbuchanan , here is a link for the code:https://github.com/LSST-strong-lensing/slsim/blob/main/slsim/lsst_science_pipeline.py . Please look at the lens_injection_fast() function. Thank you.

1 Like

HI @PhilHolloway , regarding the meaning of the zero points, @jchiang pointed out that the gain of the DP0 simulations is 0.7 e-/ADU, and that the exposures also have an exposure time of 30 seconds. For the single band exposures in the i band , this would result in 27.85 + 2.5*log10(30/0.7) = 31.9. I’m not sure exactly at this moment why it is not closer to 31.8, but it indeed represents the magnitude that will produce 1 count / exptime where exptime=30s.

Hi @plazas Thanks so much for your reply - I hadn’t realised the gain was different in the DP0 sims and it is very useful to know the zeropoint used here is per exposure rather than per second. The discrepancy now makes much more sense - I’ll mark this as the solution. Thanks again!

1 Like