Closed aaronroodman closed 3 years ago
The adaptive moment calculation is a bit fragile for undersampled profiles, meaning small changes in the profile definition can affect convergence. This behavior is mentioned briefly in the docstring for FindAdaptiveMom
. My guess is that that is the reason for this issue. (If you query the profile itself to find out its Nyquist scale, profile.nyquist_scale()
is ~0.12 arcsec, so the image with 0.26 arcsec pixel scale is significantly undersampled.)
If you need robust moment estimates for undersampled objects, you could perhaps use the unweighted second moment size, which is provided as profile.calculateMomentRadius()
?
Thanks for the insight - I can work around this issue...
OK. My student Tianqing Zhang has been carrying out unweighted moment measurement (for other moments beyond size) on simulated images for quite a while, so you may be able to get some tips from him if you want to go that route.
Closing #1132.
I fixed this particular case in #1149 (sort of by accident -- I was trying to fix different images). But Rachel is right that once the object gets too small, HSM simply can't reliably find a good solution.
It turns out that in these cases, Newton's method (or LM or dogleg or other similar nonlinear solvers) can find a solution. However, these methods are all much more fragile on not-very-Gaussian galaxy images. I spent far too long trying to make one of them work reliably, but finally gave up. Since we definitely care more about HSM being reliable on galaxy images than on undersampled stars, I nixed that whole line of work. The only thing I included in #1149 about these cases is to update the error message to say that the object is too small for HSM to find a solution. So at least a little better error reporting than the previous somewhat cryptic error message.
this snippet shows the problem:
which returns
galsim.hsm.ShapeData(image_bounds=galsim.BoundsI(xmin=0, xmax=0, ymin=0, ymax=0), observed_shape=galsim.Shear(0j), correction_status=-10, error_message='Error: non positive-definite weight in find_ellipmom_2.\n')
Moments are successfully found if the value of L0 is changed to 12.0 or the 1/2 pixel shift is changed by a small amount