astrorama / SourceXtractorPlusPlus

SourceXtractor++, the next generation SExtractor
https://astrorama.github.io/SourceXtractorPlusPlus/
GNU Lesser General Public License v3.0
72 stars 9 forks source link

Multiband fitting with empty spots #474

Open mkuemmel opened 2 years ago

mkuemmel commented 2 years ago

When fitting on a multi-band data, it is not clear what happens at empty spots (data=weight=0.0) in one band. While the auto_flux is 0.0 in that band the fitted flux values are non-zero and the bulge-to-total ratio indicates often that "something" was done: empty_g

Also the residual image is negative at object positions: image_g

We need to clarify what happens in this situation and what should happen. I would expect that for a marginal coverage in one band there are no results in that band or at least there is a corresponding flag.

The data is available here (auto_flux[0]=0.0 selects the relevant sources): https://deepdip.iap.fr/#folder/627396c26c26b9d0d2c5e1a5

ayllon commented 2 years ago

Just to confirm that this happens with iterative and 'classic' fitting, so it is not something new.

Cutouts for the fitting are limited in size, so it should be possible to just remove the frame model as if it was outside the limits if the whole cutout is masked. The fitting engine will see if the flux parameter was not used and set it to NaN. The flag PARTIAL_FIT will be set.

If the parameter was used, even on a prior on a color (which could make sense to impute missing pixels?), it will be accessed and present on the output. The flag will not be set.

There may be literal corner cases where a handful of pixels are not masked, so the frame is not removed. This will not be caught directly, although I think the error column can hint at this because they tend to be tiny (O(1e-10) even less).

I imagine that doing a final raster of the model on the frame and counting how many pixels are affected (not masked), we could identify the two last scenarios. However, it still makes sense to keep the value if it was used by the fitting (priors).

I think we will probably need an additional set of flags, one per model frame.

mkuemmel commented 2 years ago

A long discussion in a telecon revealed different opinions on how to proceed:

@marcschefer is looking into what can be done concerning providing additional information such as a flag or a filling factor. This topic will be re-discussed soon.