PaulHancock / Aegean

The Aegean source finding program and associated tools
http://aegeantools.rtfd.io/
Other
47 stars 14 forks source link

Duplication components fitted across separate islands #158

Closed tjgalvin closed 3 years ago

tjgalvin commented 3 years ago

As discussed in person, it looks like that there may be a small issue during the characterization of islands. During the flood fill procedure a bounding box is constructed around each island. In the case of large resolved islands, this tight box might also pick up unrelated islands within its bounds -- unrelated in the sense that they were isolated / disconnected from the subject island. During the flood fill procedure a label mask is calculated and used to evaluate whether an island can be fit.

This pixel level mask should be retain and carried forward to the island characterization stage. I found that without doing so a small island within the bounding box encompassing a larger island might be 'double counted' and will be fit for twice across two components across two different islands in complete isolation of one another. In a blind source finding model both components will correctly fit to the same sky brightness.

I have an initial patch in #157 that looks to fix the issue, but I have only patched the function version (not the corresponding/duplicate methods in the source finder class). I am a little unclear on what effects this might have on the lmfit optimisation. I think is the lmfit.model has had appropriate bounds constructed for each parameter, we may not have to nan the image data that is passed onto the optimsation function. In my small cutout tests it seems to work, but I am in the process of building a container to test on larger images.

Note the overlapping circles in the middle panel of the attached figure. The right panel is a patched aegean version. The left panel is the input image, and the colour images are the residuals from the current aegean and my quick patch version. ![Uploading image.png…]()

tjgalvin commented 3 years ago

When looking at this I also found similar cases in the island flood fill stage where diagonally adjacent pairs of pixels just above the flood fill level are also treated as separate islands. In The pull request above I have included a patch.

Also, I think the image in the previous post did not upload correctly, so here it is as a just in case ...

image

PaulHancock commented 3 years ago

@tjgalvin Now that the PR is closed, has this issue been resolved?

tjgalvin commented 3 years ago

Yes -- I think this fixes all the cases that I know of that can trigger the issue.