Explore the possibility to store or encode the ability to recreate the PSF for each object
During the Weak Lensing meeting today it was mentioned it would be good to know the actual true PSF for each object drawn on the focal plane when we were measuring and interpolating the PSFs.
By making sure we keep the random # seeds, or even storing the PSFs themselves it would be possible to do this either on the fly or by lookup.
@jchiang87 Can we close this one too with your merger of #117?
Ok with me, but it's not entirely clear to me how to connect the PSF with the object drawn. The psf as a function of focalplane location is arrived at indirectly via the ._getPSF function which takes the pupil coordinates, so the psf at the focalplane position is in principle recoverable from one of the pickle files, but there's still some amount of code that would need to be written to make that connection.
OK I will leave this open.
@jchiang87 I think you were recreating PSFs for some objects for some of the validation examples. Is that right? Or was it for something else? If yes, does that mean we have code to do this now we could put in a utility area?
I think there may be some confusion as to what "the PSF for each object" means. For any given visit, we have a particular AtmosphericPSF object. For a given star or galaxy, that PSF gets evaluated at the position in pupil coordinates of the star or galaxy and convolved with its shape. So if you want an image of the PSF at the object location we could just render a star at its location and output as a FITS file or pass as around as a galsim Image. OTOH, it may be more convenient to pass around the AtmosphericPSF object and evaluate at each object's location as needed. In any case, the code would essentially be what I show here, but instead of psf.applyPSF(0, 0) we'd use the object location.
Thanks. For this code, we are only talking about the atmospheric PSF correct? Do we have the random #s stored that we would need if we also wanted to include (say) recreate and apply the optical perturbation?
The optical wavefront component is included in the AtmosphericPSF implementation: https://github.com/LSSTDESC/imSim/blob/master/python/desc/imsim/atmPSF.py#L107
A single rng is used for both.
A single rng is used for both.
OK great.
I wonder if we could put a generalized version of your snippet above (with input at a particular position) somewhere in the repo? We could make a utils subdirectory or, alternatively, we could keep it your separate sims util repo.
I think we should flesh out the specific use cases. My preference would be to just add some functions to this repo so that whatever functionality could just be imported through the desc.imsim module. What exactly do people want to do?
I think there are several interesting use cases if we could know the PSF model before the sensor for a given object. This way we could do things like compare the output of the PSF interpolator against the truth information at a galaxy position, or understand with a star how the input PSF model was modified by the sensor effects.