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

The percentage of masked pixels is written out. #507

Closed mkuemmel closed 2 years ago

mkuemmel commented 2 years ago

The output is now such as: 2022-08-24T16:13:13CEST BackgroundModel INFO : Background for image: Masked(Masked(BufferedImage(jw02736-o001_t001_nircam_clear-f444w_i2d.fits[1])) with 0.0% masked pixels) with 57.1% masked pixels median: 0.255467 rms: 0.00261305!

which means the NAN's or thresholded pixels from the weight image are taken into account.

marcschefer commented 2 years ago

I think this implementation has some potential problems, the count is done in getChunk that can get called multiple times for the same part of the image (in case it's not fitting in memory)

It won't cause crashes or anything but the count could be wrong.

ayllon commented 2 years ago

🤦🏼 yes, you are right, it flew over my head. It may still be useful in case something weird like 100% of the pixels are masked, but indeed the count would be unreliable.

mkuemmel commented 2 years ago

Right now the corresponding repr() is only asked once after determining the background, and then it'll give the correct answer.

I'll put in some safeguards that it only ouputs a reasonable number.