Skip to content

Add regression test to cross-check against non-vectorized output. #182

Open
1 of 1 issue completed
Open

Description

@HannoSpreeuw

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?

Activity

  1. self-assigned this
    on Nov 29, 2025
  2. HannoSpreeuw commented on Dec 5, 2025

    @HannoSpreeuw
    CollaboratorAuthor

    GRB201006A_final_2min_srcs-t0021-image-pb.fits has a size of 67 MB, I am not sure if this will get us into trouble wrt our GH bandwidth limits.

  3. HannoSpreeuw commented on Dec 6, 2025

    @HannoSpreeuw
    CollaboratorAuthor

    I ran

    pyse GRB201006A/*.fits --vectorized --back-size-x 50 --back-size-y 50
    

    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:

                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.

    Rerunning

    pyse GRB201006A/*.fits --vectorized --back-size-x 50 --back-size-y 50
    

    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.

  4. HannoSpreeuw commented on Dec 6, 2025

    @HannoSpreeuw
    CollaboratorAuthor

    GRB201006A_final_2min_srcs-t0021-image-pb.fits has a size of 67 MB, I am not sure if this will get us into trouble wrt our GH bandwidth limits.

    We would get a warning:

    If you attempt to add or update a file that is larger than 50 MiB, 
    you will receive a warning from Git. 
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions