GalSim-developers / GalSim

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

Add options to convert HSM moments to sky coordinates #1219

Closed rmjarvis closed 1 year ago

rmjarvis commented 1 year ago

This PR involves code that I've been copying around to various places (e.g. it is in the piff.Star.hsm method) knowing each time that I should really put it into GalSim directly. But it was always more expedient to just copy it. So today, as I was about to copy it yet again, I decided to do it right and add it here.

The HSM moments are natively measured in pixel coordinates. Indeed the back end code doesn't have any knowledge of the WCS. However, it's fairly straightforward to convert these (x,y) moments in to (u,v) moments using the jacobian of the WCS. This PR adds two ways the user can do this:

ShapeData.applyWCS(wcs) converts a ShapeData instance into one where the size and shape values are based on the u,v moments rather than x,y. image.FindAdaptiveMom(use_sky_coords=True) does this for you using the wcs that is in the image.

rmjarvis commented 1 year ago

Thanks Matt. They were relics of a copy/paste I forgot to clean up.

rmjarvis commented 1 year ago

@rmandelb I have two reviews already, but I thought you might like to take a look at this too. Happy to hold off merging this if you are interested.

rmandelb commented 1 year ago

Also, thanks for your work on this feature; it's a nice addition!

rmjarvis commented 1 year ago

Thanks Rachel! I think I addressed all the relevant docs.