From 2e398527bf21752ab89d95b64dde11a4f284f053 Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Thu, 6 Jun 2024 11:43:34 -0700 Subject: [PATCH 1/2] bug fix for fit_amorphous_ring --- py4DSTEM/process/polar/polar_fits.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/py4DSTEM/process/polar/polar_fits.py b/py4DSTEM/process/polar/polar_fits.py index 18f059b61..a2fc04ca4 100644 --- a/py4DSTEM/process/polar/polar_fits.py +++ b/py4DSTEM/process/polar/polar_fits.py @@ -140,6 +140,21 @@ def fit_amorphous_ring( np.inf, np.inf, ) + else: + lb = (0, 0, radial_range[0], radial_range[0], -np.inf, 0, 0, 0, 1, 1, 1) + ub = ( + im.shape[0], + im.shape[1], + radial_range[1], + radial_range[1], + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + ) if show_fit_mask: # show image preview of fitting mask From 9db11d37b780c6434fb8ebc32429607c6b13a0ec Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Thu, 6 Jun 2024 15:57:35 -0700 Subject: [PATCH 2/2] remove redundant code --- py4DSTEM/process/polar/polar_fits.py | 43 +++++++++------------------- 1 file changed, 14 insertions(+), 29 deletions(-) diff --git a/py4DSTEM/process/polar/polar_fits.py b/py4DSTEM/process/polar/polar_fits.py index a2fc04ca4..7760726a7 100644 --- a/py4DSTEM/process/polar/polar_fits.py +++ b/py4DSTEM/process/polar/polar_fits.py @@ -126,35 +126,20 @@ def fit_amorphous_ring( sigma2 = (radial_range[1] - radial_range[0]) / 4 coefs = (x0, y0, a, b, t, int0, int12, k_bg, sigma0, sigma1, sigma2) - lb = (0, 0, radial_range[0], radial_range[0], -np.inf, 0, 0, 0, 1, 1, 1) - ub = ( - im.shape[0], - im.shape[1], - radial_range[1], - radial_range[1], - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - ) - else: - lb = (0, 0, radial_range[0], radial_range[0], -np.inf, 0, 0, 0, 1, 1, 1) - ub = ( - im.shape[0], - im.shape[1], - radial_range[1], - radial_range[1], - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - np.inf, - ) + lb = (0, 0, radial_range[0], radial_range[0], -np.inf, 0, 0, 0, 1, 1, 1) + ub = ( + im.shape[0], + im.shape[1], + radial_range[1], + radial_range[1], + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + np.inf, + ) if show_fit_mask: # show image preview of fitting mask