Repository navigation
Deprecate use of LMLSQFitter for models with bounds - #16994
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
The main reason the CI is failing in a number of places is because
For option 3, what's interesting is that for instance Option 1 is the easiest, so it might make the most sense for now (this is what's I'll implement here for now) |
|
I think the CI should be fixed now (I also think we need fixtures to avoid repeating the list of fitters in all test files, but that can wait) |
You mean wait to merge until you have time for it here? Or open follow up issue? Hope you can clarify. Thanks! |
|
I wonder how many downstream packages will be affected by this deprecation warning... 👀 |
I would hope that not too many people are using this new LMSQ fitter when the ones with good bounds support were added at the same time. If people are using this I would assume they are doing it because they don't understand that they would probably be better off using one of the other ones. |
|
This definitely needs to be reviewed by @nden or @perrygreenfield as this is not a trivial change. From searching code on GitHub I found a handful (perhaps a dozen or a little more) usages of Just for full disclosure, we could also still optionally support the current bounds algorithm via a |
|
I strongly think supporting |
ea9c322 to
5a91b8a
Compare
nden
left a comment
There was a problem hiding this comment.
This looks reasonable. I also agree we should not support use_min_max_bounds in LMLSQFitter . Those that find it useful can continue using it in LevMarLSQFitter.
|
@astrofrog FYI, this PR causes a
|
|
Does it make sense to move |
|
Uh oh... should we revert this? |
|
To prevent the breaking API change, all that would be needed is to update the |
|
Yes that would be great, thanks! |
|
The new |
* Deprecate use of LMLSQFitter for models with bounds * Don't run tests that use models that have bounds with the LMLSQFitter * Added changelog entry * Improve deprecation warning Co-authored-by: Clément Robert <[email protected]> --------- Co-authored-by: Clément Robert <[email protected]>
Now that we have support for different non-linear fitters in astropy.modeling, including several that have proper support for bounds, we should consider starting to phase out support for the 'hacky' bounds algorithm originally introduced in
LevMarLSQFitter. I noticed that in fact the newLMLSQFitteruses the hacky algorithm by default, with no way to turn it off.I think we should instead deprecate this behavior in
LMLSQFitterand recommend other fitters, and once the deprecation phase is over simply changesupported_constraintsto excludeboundson that fitter. There are other more suitable fitters for models with bounds, and we should be encouraging good practices. Note that at the moment most examples in the docs useLevMarLSQFitterso I think there is likely to be far more usage of that class in the wild. For that reason, I am not touching that class for now - instead, I want to make sure that the new classLMLSQFitterdoes 'The Right Thing' ™️ before there is too much uptake in it.If people are on board with this, I will update the tests, which currently fail due to the warning being emitted in several of them, and I will also add a changelog entry.