rmjarvis / Piff

PSFs In the Full FOV. A software package for modeling the point-spread function (PSF) across the full field of view (FOV). Documentation:
http://rmjarvis.github.io/Piff/
Other
58 stars 13 forks source link

Add the first composite type: Sum #157

Closed rmjarvis closed 5 months ago

rmjarvis commented 1 year ago

This is finally the first composite type that I've been working up to. Sum is probably a little simpler than Convolve, so I wanted to start with that. But the other two I have in mind are Convolve and Transform, similar to the corresponding GalSIm object types.

A Sum PSF is a model made from adding together multiple other PSF types. Each component can have its own model and interpolation. The parameters are stored in a list, so each component has its own numpy.array of parameters in the star.fit objects, each of which can be whatever length is required.

The initialization defaults to hsm for the first component and zero for the others, but the user can override this as desired. I suspect for most use cases, the first component will describe most of the PSF patter, and the later components will fill in the bits that weren't well modeled earlier (e.g. the tree-ring residuals we've seen in DES), so I think this will be a reasonable default initialization. Certainly we don't want multiple components all using the hsm initialization, since the sum would then be N x the PSF, which wouldn't be a good initial guess for the components. I suspect that getting good initial guesses for various components will be a big part of making composite PSFs work well, so there may be more work needed eventually on this front.

rmjarvis commented 1 year ago

@jmeyers314 @aaronroodman Would either of you like to take a look at this before merging? I'll be doing Convolution next if you're rather wait for that as a more realistic composite model.

rmjarvis commented 1 year ago

I'm game. Thoughts on what to use for the truth? Maybe a GalSim atmospheric screen and then use GP for the interpolation of Kolmogorov for the primary component. Would that have a usefully interesting residual to mop up? Or would I need to include some optical component to give it something that wouldn't be well described by Kolmogorov?

jmeyers314 commented 1 year ago

I'm not sure. If you keep the simulated exposure time short enough I'm sure an atmsopheric screen true psf would have interesting residuals to mop up.

You might be able to get away with something simpler though, e.g., truth = Moffat with quickly spatially varying beta maybe? Definitely bonus points though if you get this to work with a GP.

rmjarvis commented 6 months ago

Hi Josh, I finally got back to this after 8 months of letting your very good suggestion sit unaddressed.

I added a test using Atmospheric + Optical screens for the PSF. The model is a Kolmogorov PSF with GP interpolation + a PixelGrid with just a Mean interpolation.

If I don't include the PixelGrid part, here are the images of the residuals (made by the new unit test when running from main): test_atmpsf_stars2 You can see that there is a roughly consistent pattern to the residuals. Mostly because the optical screen aberrations were constant over the CCD, so they produces a pretty coherent pattern.

When I include the PixelGrid as a second component in the Sum, here are the residuals: test_atmpsf_stars

This seems pretty good to me and shows a more realistic use case for how the Sum PSF might be used in practice.