Repository navigation
Fix OverflowError in the curve fitting dialog when a fitted value is outside the slider range - #77
Merged
Merged
Conversation
… range The slider position was computed without clipping, so a fitted value far outside the [min, max] range of its parameter (unconstrained optimization methods) exceeded the 32-bit range of QSlider.setValue: OverflowError, slider signals left blocked and following parameters not updated. Non-finite values, empty ranges and log scale values below min - 1 raised similar errors. - Clip the slider position to the slider range, using the inverse mapping of slider_value_changed, and skip undefined positions - Restore the slider signal-blocking state in a finally clause - Show a warning icon with a tooltip when the value is outside the range - Reject non-finite values typed in the parameter field - Require at least 2 slider steps in the parameter properties dialog Fixes #76 Assisted-by: Claude Opus 5.5
Assisted-by: Claude Opus 5.5
Python 3.9 is no longer available on the Ubuntu 26.04 image used by ubuntu-latest, so the 3.9 job failed while setting up Python. The 2.11.x maintenance line still supports Python 3.9. Assisted-by: Claude Opus 5.5
This was referenced Oct 28, 2026
Closed
Merged
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 #76.
Problem
In the curve fitting dialog,
FitParam.update_slider_valueconverted the parameter value into a slider position without clipping it. All automatic fit methods except L-BFGS-B are unconstrained. When one of them leaves a parameter far outside its[min, max]range, the position exceeds the 32-bit range ofQSlider.setValue, which raisesOverflowError. The slider is then left with its signals blocked, and the following parameters are not updated. Non-finite values, empty ranges (min == max), log scale values belowmin - 1,nan/inftyped in a field and a "Steps" value of 1 raised similar errors.Changes (
plotpy/widgets/fit.py)slider_value_changed(steps - 1), so the maximum value is the last slider position. Undefined positions (non-finite value, empty or infinite range) leave the slider unchanged.finallyclause.[min, max]is shown with a warning icon at the right of its field. The icon is the standard Qt one, so it works with any theme. Its tooltip (translated) gives the slider range. The value itself is never modified.Tests
plotpy/tests/unit/test_fit_slider.py. 20 of them fail on the current code, with the same errors as reported in the issue, and all pass with the fix. They include a deterministic divergent automatic fit (linear model, fitted slope 1e6 times the slider range), independent of the SciPy version.plotpy/tests/features/test_fit*.pypass. The full test suite passes, excepttest_curve_tools.py::test_edit_point_tool, which already fails onreleasewithout these changes.Workflow
Hotfix for 2.11.2, following
doc/dev/gitworkflow.rst. Thereleasebranch was recreated frommaster(v2.11.1), and the fix will be cherry-picked intodeveloponce merged.