From 3e5844369e1086398caabb54523e0744441387af Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 23 Aug 2024 19:18:27 -0700 Subject: [PATCH] Allowing user to specify # of fitting iterations --- py4DSTEM/process/polar/polar_peaks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/py4DSTEM/process/polar/polar_peaks.py b/py4DSTEM/process/polar/polar_peaks.py index fdd0a6a2e..d2c45c530 100644 --- a/py4DSTEM/process/polar/polar_peaks.py +++ b/py4DSTEM/process/polar/polar_peaks.py @@ -832,6 +832,7 @@ def model_radial_background( ring_sigma=None, ring_int=None, refine_model=True, + maxfev = None, plot_result=True, figsize=(8, 4), returnfig=True, @@ -861,6 +862,7 @@ def model_radial_background( self.background_mask ] self.background_radial_mean[np.logical_not(self.background_mask)] = 0 + self.background_radial_mean = np.maximum(self.background_radial_mean, 0.0) # init if ring_position is not None: @@ -932,8 +934,9 @@ def background_model(q, *coefs): self.qq[self.background_mask], self.background_radial_mean[self.background_mask], p0=self.background_coefs, - xtol=1e-12, + xtol=1e-8, bounds=(lb, ub), + maxfev = maxfev, )[0] # plotting