astropy / photutils

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

Warning about unsuccessful fit #972

Closed astrofrog closed 1 week ago

astrofrog commented 4 years ago

When doing PSF photometry, I sometimes get warnings about the fit being unsuccessful:

Screenshot from 2019-10-18 13-22-35

However the warning is unhelpful, since it's not clear where to access fit_info.

Onoddil commented 4 years ago

As I recall users don't actually get access to fit_info, do they? If I'm remembering right, this should come out of the self.fitter call in nstars, at which point we get this warning raised, but then don't allow the user access to self.fitter.fit_info in any obvious way.

The obvious, if slightly over-correcting, answer is to suppress the warning, since it relates to things outside of the scope of the user's access... Or is there a way to overwrite the warning (unlikely) to better tell the user to check the fitter they passed into the function. Does the fit_info attribute of the input fitter keep the fit_info attribute? That doesn't exactly help if they've not passed one and get the LevMarLSQFitter by default and thus can't access the thing at all, but is at least something that could be done. Can't think of any solution that solves all cases except suppressing the warning at the moment though.

marcusthomas11 commented 3 years ago

Quick bump. Has anything changed related to this as of 1.1.0? I'm very curious if I should be concerned with my fits.

larrybradley commented 3 years ago

Nothing has changed in version 1.1.0 to address this. The best test would be to look at the residual image to see if the fits failed.

larrybradley commented 1 week ago

With the PSF photometry tools, a "flags" column was added indicating certain error conditions and access to the fit_info for each model fit is available in the fit_results dictionary.