Skip to content

Commit

Permalink
pr response
Browse files Browse the repository at this point in the history
  • Loading branch information
andped10 committed Nov 13, 2024
1 parent 3bda6df commit 1f4df44
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/easyscience/fitting/minimizers/minimizer_bumps.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ def fit(
minimizer_kwargs.update(engine_kwargs)

if tolerance is not None:
if 0.1 < tolerance:
raise ValueError('Tolerance must be equal or smaller than 0.1')
minimizer_kwargs['ftol'] = tolerance # tolerance for change in function value
minimizer_kwargs['xtol'] = tolerance # tolerance for change in parameter value, could be an independent value
if max_evaluations is not None:
Expand Down
2 changes: 1 addition & 1 deletion src/easyscience/fitting/minimizers/minimizer_dfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _prepare_kwargs(tolerance: Optional[float] = None, max_evaluations: Optional
if max_evaluations is not None:
kwargs['maxfun'] = max_evaluations # max number of function evaluations
if tolerance is not None:
if 0.1 < tolerance:
if 0.1 < tolerance: # dfo module throws errer if larger value
raise ValueError('Tolerance must be equal or smaller than 0.1')
kwargs['rhoend'] = tolerance # size of the trust region
return kwargs
2 changes: 1 addition & 1 deletion tests/integration_tests/Fitting/test_fitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def test_basic_max_evaluations(fit_engine):
assert "Objective has been called MAXFUN times" in str(e)


@pytest.mark.parametrize("fit_engine,tolerance", [(None, 10), (AvailableMinimizers.LMFit, 10), (AvailableMinimizers.Bumps, 0.1), (AvailableMinimizers.DFO, 0.1)])
@pytest.mark.parametrize("fit_engine,tolerance", [(None, 10), (AvailableMinimizers.LMFit, 10), (AvailableMinimizers.Bumps, 10), (AvailableMinimizers.DFO, 0.1)])
def test_basic_tolerance(fit_engine, tolerance):
ref_sin = AbsSin(0.2, np.pi)
sp_sin = AbsSin(0.354, 3.05)
Expand Down

0 comments on commit 1f4df44

Please sign in to comment.