PetroFit / petrofit

Python package for calculating Petrosian properties and fitting galaxy light profiles
https://petrofit.readthedocs.io
28 stars 7 forks source link

`NonFiniteValueError` #140

Closed robelgeda closed 1 year ago

robelgeda commented 2 years ago

New Astropy error for out of bound parameter values that cause nan and inf values.

NonFiniteValueError: Objective function has encountered a non-finite value, this will cause the fit to fail!
Please remove non-finite values from your input data before fitting to avoid this error.

There are two solutions to this:

  1. Limit the model params to avoid any nan values.
  2. PSFConvolvedModel2D should return a value of 1e99 for example to divert the fitter when it wonders off into invalid values.

I think for now, doing both would be acceptable. Point (2) is needed because we cannot provide bounds for every model and users will probably want to use custom models.

robelgeda commented 2 years ago

this also affects fitting backgrounds

robelgeda commented 2 years ago

Astropy has a new way to avoid this, see https://github.com/astropy/astropy/pull/13259

robelgeda commented 2 years ago

100 adds bounds to Sersic models. This means that PetroFit is not recommended with astropy v5.1. I will keep this ticket open until v5.2 or v5.1.1 is released.