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

#142 Add optional fourth_order=True and raw_moments=True options for HSMCatalog #144

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

This PR adds two options to include higher-order moments in the HSM output file.

The first one, fourth_order=True, is the one I expect to be more useful in practice. It outputs additional columns: T4, g41, g42, h41, h42.

T4 is a spin-0 quantity with units of area (like T) based on fourth order moments. Specifically T4 = <r^4> / T. For a round Gaussian, it comes out equal to 2T. For an elliptical Gaussian, there is a correction of approximately (1-e^2)^0.5.

g4 is a spin-2 dimensionless quantity (like g). For this one, we subtract off the leading effect of the overall ellipticity (=3e), so g4 is really probing some additional spin-2 effect beyond the trivial geometry already indicated by the regular second-moment shape, g. For an elliptical Gaussian, this is close to 0. (Thanks for @ztq1996 for this suggestion.)

h5 is a spin-4 dimensionless quantity. I'm not sure what the uses for this might be, but it seemed worth including.

The second optional arguments is raw_moments=True. This is simply the raw output of calculate_moments, outputting all the moments that it can calculate without any scalings or correction terms. @aaronroodman thought this would be useful for checking the accuracy of the optical PSF fits, to check things like trefoil and such are accurately modeled.

Along the way, I discovered that the calculation of T from sigma that we did in #133 wasn't quite right. The sigma that HSM outputs is the fourth root of the determinant of the moment matrix, not the square root of half the trace. So there is a correction required involving the measured shape to get the definition of T that we want (i.e. the trace of the moment matrix). So I fixed that here.

rmjarvis commented 1 year ago

Thanks Theo! I think I addressed all your comments.