Skip to content

Error when running constrained fit #3370

@krzywon

Description

@krzywon

Describe the bug
#3366 allows the constrained fit window to launch after part one of the fitting refactor, but fits are now failing with the following error. This is likely related to bumps v1 attempting to coerce parameter values to floats, where we have always sent uncertainty quantities. The fix is to set Parameter.slot to the uncertainty quantity and Parameter.val to the raw floating point value.

ERROR: Fitting failed: Traceback (most recent call last): File "sas\qtgui\Perspectives\Fitting\FitThread.py", line 17, in map_getattr return_value = getattr(classInstance, classFunc)(*args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "sas\sascalc\fit\BumpsFitting.py", line 315, in fit problem.setp_hook() File "sas\sascalc\fit\BumpsFitting.py", line 232, in call self.update() File "M2.background=M3.background M2.scale=M3.scale M2.radius=M3.radius M1.radius=M2.radius M1.background=M2.background M1.scale=M2.scale", line 11, in eval_expressions File "bumps\parameter.py", line 451, in value return int(self.slot) if self.discrete else float(self.slot) ^^^^^^^^^^^^^^^^ File "uncertainties\core.py", line 2611, in raise_error raise TypeError("can't convert an affine function (%s)" TypeError: can't convert an affine function () to float; use x.nominal_value

To Reproduce
Steps to reproduce the behavior:

  1. Launch sasview using an installer or code from Simultaneous fitting issues #3366
  2. Set up a series of fits and a constrained fit
  3. Run the constrained fit
  4. Wait for the first update
  5. See error

Expected behavior
The fit should continue without errors.

SasView version (please complete the following information):

  • Version: v6.1.0a1 with bumps v1.0.0b6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions