GalSim-developers / GalSim

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

Add obj.makePhot method #1078

Closed rmjarvis closed 4 years ago

rmjarvis commented 4 years ago

This PR adds a way to draw photons without actually accumulating them onto an image.

It is functionally equivalent to _, photons = obj.drawPhot(im, ...) but without requiring the image.

@cwwalter

rmjarvis commented 4 years ago

Just one question: would it be possible for drawPhot to use makePhot? Too tricky with the resume I'm guessing?

That was originally my plan, but with all the maxN and resume stuff, if seemed a little too much to untangle cleanly. This seemed simpler, and the unit tests make sure they are equivalent for their overlapping use cases.

rmjarvis commented 4 years ago

Also, just for my education/curiosity: Why all the changes to " rng=rng.duplicate()" in the tests? Was it not giving a reproducible sequence before?

These tests check that drawPhot and makePhot produce the same exact photons. So the first time, for drawPhot, I call rng.duplicate() to fork the RNG sequence. Then when I do it again with makePhot, the rng runs through the exact same sequence again, so should produce the same photons.