Repository navigation
Description
Current behavior
Interactive fits (Processing > Fitting > Interactive fitting) are recorded in the History panel as recompute_fit UI actions holding the canonical fit_params of the accepted fit (__row_compute_fit).
- Replay recomputes the fitted curve in place from these parameters through
sigima.tools.signal.fitting.evaluate_fit, for every built-in fit type. - Step-by-step replay never opens the fit dialog. When the interactive fit action is selected alone, DataLab shows "Interactive fits cannot be edited from the History panel: the fit dialog cannot be reopened with the recorded parameters. The recorded fit is kept as is." and leaves the fit unchanged (
recompute_fit,report_non_editable); within a session, the fit is recomputed with its recorded parameters. This behavior is covered bytest_interactive_fit_records_replays_in_place_and_refuses_edit.
The parameters of an interactive fit therefore cannot be reviewed or adjusted from the History panel: the only way to change them is to run the fit again, which creates a new curve and a new history entry instead of updating the recorded ones and their downstream actions.
Expected behavior
Step-by-step replay of an interactive fit action reopens the same fit dialog on the source signal, starting from the recorded fit_params (no automatic fit on opening; the Auto fit button stays available).
- Accepting the dialog updates the recorded
fit_paramsand the fitted curve in place (same UUID), and the edit propagates to the downstream dependent actions, as for the other actions edited step by step. - Cancelling the dialog stops the replay, as for the other step-by-step dialogs.
Dependency
The SigimaX fit dialogs cannot be opened with given parameter values yet: this requires step 2 of DataLab-Platform/SigimaX#3 (open the dialog matching a canonical fit_params dict and return the updated dict on acceptance), planned for SigimaX 1.2.0.
Proposed implementation
- In
recompute_fit(edit=True), open the SigimaX dialog matchingfit_params["fit_type"]with the recorded parameters instead of the information message, then store the returnedfit_paramsin the action. - The mapping from canonical fit types to dialogs (
"doubleexponential"→ piecewise exponential dialog,"linear"/"polynomial"with the degree given by the number of coefficients, multi-peak types with their recorded peak positionsx0_i) should be provided by SigimaX rather than duplicated in DataLab. - Fit actions recorded by earlier versions (including
.dlhistfiles and workspaces) already hold canonicalfit_params: they become editable without migration.
Tests
- Adapt
test_interactive_fit_records_replays_in_place_and_refuses_edit: step-by-step replay opens the dialog (deterministic stand-in in tests) with the recorded parameters, updates the fitted curve in place and the recordedfit_params, and recomputes the downstream actions; cancelling leaves the fit untouched. - A multi-peak fit keeps its recorded peak positions
x0_iafter an edit.
Notes
- The information message above (and its French translation) becomes obsolete.
- Update the Step-by-step description in the History panel documentation (
doc/features/common/historypanel.rst).
Activity