GalSim icon indicating copy to clipboard operation
GalSim copied to clipboard

Add 2nd central moments to base+compound GSObjects

Open jmeyers314 opened this issue 9 years ago • 4 comments

I think it would be nice to have unweighted second central moment properties for our analytic GSObjects:

obj = galsim.Gaussian(half_light_radius=1)
print(obj.Ixx)  # 0.7205
print(obj.Ixy)  # 0.0

I think it's straightforward to define these for at least the analytic profiles in base.py. It should also be straightforward to propagate these through transformations and sums/convolutions, though it's probably good to avoid InterpolatedImage moments, or using moments as input.

jmeyers314 avatar Oct 17 '16 22:10 jmeyers314

How relevant are the analytic ones, considering that they ignore pixel convolution?

rmandelb avatar Oct 19 '16 01:10 rmandelb

How relevant are the analytic ones, considering that they ignore pixel convolution?

I think we can leave the pixel convolution up to the user:

gal = galsim.Gaussian(half_light_radius=1)
print(gal.Ixx)  # 0.7205
pix = galsim.Pixel(1)
print(pix.Ixx)  # 0.0833  (i.e., 1./12)
obj = galsim.Convolve(gal, pix)
print(obj.Ixx)  # 0.80383 = 0.7205+0.0833

jmeyers314 avatar Oct 19 '16 01:10 jmeyers314

Are you not concerned about the fact that we generally discourage users from explicitly doing the pixel convolution, hiding it under the rug in drawImage with the default image rendering methods, and here to get it right they do have to explicitly do it?

I'm trying to decide what I think about this. I don't love it but I suppose with adequate documentation plus maybe a demonstration in the demos, it's OK.

rmandelb avatar Oct 19 '16 01:10 rmandelb

I don't have a problem with this. Many of these objects have attributes like fwhm or half_light_radius when those are analytically known, and they don't include a pixel convolution. So it seems consistent for these not to as well.

If you do this, you should remember to update the calculateMomentRadius function to look for these values when they exist and skip the calculation. Right now, it only does so for Gaussian.

rmjarvis avatar Oct 19 '16 03:10 rmjarvis