Skip to content

Committing a piecewise exponential interactive fit raises ValueError: Unsupported fit type #12

Description

@PierreRaybaut

Summary

commit_interactive_fit() derives the Sigima fit type from the menu id:

dst.metadata["fit_params"] = _fit.create_fit_params(
    fit_id.removesuffix("_fit"), ...
)

For "piecewiseexponential_fit" this yields "piecewiseexponential", which is not a key of Sigima's FIT_TYPE_MAPPING. The 14 valid keys are:

cdf, doubleexponential, exponential, gaussian, linear, lorentzian,
multigaussian, multilorentzian, planckian, polynomial, sigmoid,
sinusoidal, twohalfgaussian, voigt

The menu id was chosen to match DataLab desktop's piecewiseexponential_fit, but the underlying computer is DoubleExponentialFitComputer, whose Sigima type is doubleexponential. Committing the fit therefore fails with ValueError: Unsupported fit type.

Location

src/runtime/dlw_interactive_fit.py_INTERACTIVE_FITS entry and commit_interactive_fit().

Proposed fix

Store the Sigima fit type explicitly on _FitKind instead of deriving it from the menu id by string surgery, and default it to fit_id.removesuffix("_fit") for the other twelve entries.

Root cause

tests/python/test_interactive_fit.py only exercises commit_interactive_fit() for gaussian_fit. A test parametrised over _INTERACTIVE_FITS would have caught this. The fix must add that loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions