Repository navigation
Open fit dialogs when the initial automatic fit fails - #27
Merged
Merged
Conversation
`guifit` only ignored `ValueError` raised by the initial automatic fit: any other error (e.g. `TypeError` from `leastsq` with fewer points than parameters) propagated and the fit dialog was never shown. The initial fit only gives a better starting point, so any failure now leaves the initial parameter values in the dialog. Fixes #26 Assisted-by: Claude Opus 5.5
…l fit Assisted-by: Claude Opus 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26. Complements PlotPyStack/PlotPy#77 (PlotPyStack/PlotPy#76).
Problem
guifitruns an automatic fit before showing the fit dialog, and only ignoredValueErrorif it failed. Any other error propagated, and the dialog was never shown. For example, a fit with fewer points than parameters raisesTypeErrorinleastsq. With PlotPy up to 2.11.1, a fitted value far outside its slider range raisedOverflowErrorat this point.Change
The initial fit only gives a better starting point.
guifitnow ignores any exception it raises (broad-except, as elsewhere in SigimaX), and the dialog opens with the initial parameter values.Tests
test_guifit_opens_when_initial_fit_fails:FitDialog.autofitraisesTypeError,OverflowErrororZeroDivisionError, and the dialog is still shown with the initial values.test_gaussian_fit_dialog_opens_with_too_few_points: the real case of a Gaussian fit on 3 points.sigimax/tests/widgets/test_fitdialog.pypasses (38 tests). Ruff passes and Pylint gives 10/10 onfitdialog.py.Documentation
Release note in "Curve fitting dialogs" (
release_1.01.md), with its French translation. Only this entry was added to the catalog, which is already out of date for other recent entries.