Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1999: Clip fitting values set outside the fit range #2422

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,9 @@ def paramDictFromResults(self, results):
logger.error(msg)
return

if results.mesg:
logger.warning(results.mesg)

param_list = results.param_list # ['radius', 'radius.width']
param_values = results.pvec # array([ 0.36221662, 0.0146783 ])
param_stderr = results.stderr # array([ 1.71293015, 1.71294233])
Expand Down
7 changes: 5 additions & 2 deletions src/sas/sascalc/fit/BumpsFitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def abort_test():
return True
return False

errors = []
fitclass, options = get_fitter()
steps = options.get('steps', 0)
if steps == 0:
Expand All @@ -388,16 +389,18 @@ def abort_test():
]
fitdriver = fitters.FitDriver(fitclass, problem=problem,
abort_test=abort_test, **options)
clipped = fitdriver.clip()
if clipped:
errors.append(f"The initial value for {clipped} was outside the fitting range and was coerced.")
omp_threads = int(os.environ.get('OMP_NUM_THREADS', '0'))
mapper = MPMapper if omp_threads == 1 else SerialMapper
fitdriver.mapper = mapper.start_mapper(problem, None)
#import time; T0 = time.time()
try:
best, fbest = fitdriver.fit()
errors = []
except Exception as exc:
best, fbest = None, np.NaN
errors = [str(exc), traceback.format_exc()]
errors.extend([str(exc), traceback.format_exc()])
finally:
mapper.stop_mapper(fitdriver.mapper)

Expand Down