You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add regression test to cross-check against non-vectorized output. #182
The PySE run sourcefinder/utility/cli.py GRB201006A_final_2min_srcs-t0021-image-pb.fits --back-size-x 50 --back-size-y 50 offers an opportunity for an effective comparison between vectorized and non-vectorized output.
The correctness of vectorized source measurements has been covered by the test_measured_vectorized_forced_beam (167,281 artificial sources) and the test_measured_vectorized_free_shape (90,000 artificial sources) regression tests, which compare its outputs against ground truth values.
However, all of these artificial sources are well-formed, while GRB201006A_final_2min_srcs-t0021-image-pb.fits contains many ill-formed "sources", which can provide additional tests. ("sources" in quotes, since the ill-formed ones seem to appear mostly near the edges, i.e. perhaps they are artefacts of calibration and/or imaging).
The hard part about this cross-check is how to quantify acceptable thresholds wrt relative or absolute differences that can catch faulty extrapolations of brightnesses such as the ones encountered here: #180. That issue has been fixed for forced beam runs and is less likely to occur for free shape runs. However, it would be good to investigate the latter: i.e. does the faulty extrapolation not occur at all when --force-beam is left out?
So these are vectorized source measurements without forcing the beam shape.
What you see is that the peak derived from tweaked moments can become as large as 1.5 times the maximum pixel value of the island, but that is because that peak is bounded:
upp_bound = 1.5 * basevalue
If you replace that by, say, upp_bound = 1e6 * basevalue you can get derived peaks as high as 12.3 times the maximum pixel value.
Conclusion: For vectorized source measurements, also without forced beam shapes, the peak derived from tweaked moments should not have a maximum pixel value as basevalue, but the pixel value at the rounded barycenter position should be the only option. The latter is the first option in the current code, but tweaked moments reverts to the maximum pixel value and corresponding position if the rounded barycenter position is not part of the source island - indicating an "ill-formed" island. In that case we should instead revert to maxi * fudge_max_pix and not apply tweaked moments.
over those 60 FITS images with measure.moments_enhanced modified such that tweaked moments does not use the maximum pixel value as basevalue - unless the corresponding position coincides with the rounded barycenter position - gives a maximum ratio peak / maxi = 1.62, when we remove the upper bound: upp_bound = 1e6 * basevalue.
That seems acceptable.
Perhaps we could implement upp_bound = 2 * basevalue instead of upp_bound = 1.5 * basevalue.
Some background: that high ratio occurs with very small axes: smaj= 0.946, smin= 0.674.
The extrapolation is, of course, at the subpixel level: deltax= -0.358, deltay= 0.437.
Activity
HannoSpreeuw commentedon Dec 5, 2025
GRB201006A_final_2min_srcs-t0021-image-pb.fitshas a size of 67 MB, I am not sure if this will get us into trouble wrt our GH bandwidth limits.HannoSpreeuw commentedon Dec 6, 2025
I ran
on the 60 files shared here.
So these are vectorized source measurements without forcing the beam shape.
What you see is that the peak derived from tweaked moments can become as large as 1.5 times the maximum pixel value of the island, but that is because that peak is bounded:
If you replace that by, say,
upp_bound = 1e6 * basevalueyou can get derived peaks as high as 12.3 times the maximum pixel value.Conclusion: For vectorized source measurements, also without forced beam shapes, the peak derived from tweaked moments should not have a maximum pixel value as
basevalue, but the pixel value at the rounded barycenter position should be the only option. The latter is the first option in the current code, buttweaked momentsreverts to the maximum pixel value and corresponding position if the rounded barycenter position is not part of the source island - indicating an "ill-formed" island. In that case we should instead revert tomaxi * fudge_max_pixand not apply tweaked moments.Rerunning
over those 60 FITS images with measure.moments_enhanced modified such that tweaked moments does not use the maximum pixel value as
basevalue- unless the corresponding position coincides with the rounded barycenter position - gives a maximum ratiopeak / maxi = 1.62, when we remove the upper bound:upp_bound = 1e6 * basevalue.That seems acceptable.
Perhaps we could implement
upp_bound = 2 * basevalueinstead ofupp_bound = 1.5 * basevalue.Some background: that high ratio occurs with very small axes:
smaj= 0.946, smin= 0.674.The extrapolation is, of course, at the subpixel level:
deltax= -0.358, deltay= 0.437.HannoSpreeuw commentedon Dec 6, 2025
We would get a warning:
Restrict "tweaked moments" for "free shape"