astropy / photutils

Astropy package for source detection and photometry. Maintainer: @larrybradley
https://photutils.readthedocs.io
BSD 3-Clause "New" or "Revised" License
231 stars 131 forks source link

Calculating FWHM on bad photo iterates way too long #1775

Closed PieterVuylsteke closed 1 week ago

PieterVuylsteke commented 3 weeks ago

I am using Photutils version 1.11.0 in a windows environment.

When I analyse a timeseries of photo's it can happen that there are bad photo's in the series. Asking for the value of FWHM on an Aperture can then take gigantically long.

After some searching it appears the while loop in stats.py, _covariance routine is the culprit.

Just before the while loop I added this code :
if covar_det < -1000: covar = [[None,None],[None,None]] return covar

In my case the covar_det was -48988638457.28642, so that would have taken extremely long.

larrybradley commented 2 weeks ago

@PieterVuylsteke Many thanks for reporting this. I'm preparing a fix. Could you please share an image with a short example that I can use as a test case? I'm having a hard coming up with an example image that triggers this loop. Thanks!

PieterVuylsteke commented 1 week ago

@larrybradley : do you still need an example ? I have a bit difficulty for the moment to find one, and I see you solved the issue ?

larrybradley commented 1 week ago

The issue should be fixed. Please let me know if you find any issues in the next release (1.13.0). Thanks again.