imSim icon indicating copy to clipboard operation
imSim copied to clipboard

Explore the possibility to store or encode the ability to recreate the PSF for each object

Open cwwalter opened this issue 8 years ago • 10 comments

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.

cwwalter avatar May 16 '17 00:05 cwwalter

@jchiang87 Can we close this one too with your merger of #117?

cwwalter avatar Aug 28 '18 03:08 cwwalter

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.

jchiang87 avatar Aug 28 '18 03:08 jchiang87

OK I will leave this open.

cwwalter avatar Aug 28 '18 03:08 cwwalter

@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?

cwwalter avatar Feb 04 '19 03:02 cwwalter

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.

jchiang87 avatar Feb 04 '19 04:02 jchiang87

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?

cwwalter avatar Feb 04 '19 16:02 cwwalter

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.

jchiang87 avatar Feb 04 '19 16:02 jchiang87

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.

cwwalter avatar Feb 04 '19 18:02 cwwalter

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?

jchiang87 avatar Feb 04 '19 18:02 jchiang87

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.

cwwalter avatar Feb 04 '19 18:02 cwwalter